<!DOCTYPE html><htmllang='en'><head><title>14882</title><metacharset='UTF-8'/><linkrel='stylesheet'type='text/css'href='14882.css'/><linkrel='stylesheet'type='text/css'href='https://fonts.googleapis.com/css2?family=Noto+Serif'/><linkrel='stylesheet'type='text/css'href='https://fonts.googleapis.com/css2?family=Noto+Sans'/><linkrel='stylesheet'type='text/css'href='https://fonts.googleapis.com/css2?family=Noto+Sans+Mono'/><linkrel='icon'href='icon.png'/><linkrel='stylesheet'type='text/css'href='expanded.css'title='Normal'/><linkrel='alternate stylesheet'type='text/css'href='colored.css'title='Notes and examples colored'/><linkrel='alternate stylesheet'type='text/css'href='normative-only.css'title='Notes and examples hidden'/></head><body><divclass='wrapper'><divid='scope'class='section'><h1><aclass='secnum'style='min-width:50pt'>1</a> Scope <aclass='abbr_ref'href='index.html#scope'>[scope]</a></h1><divclass='para'><divclass='marginalizedparent'><aclass='marginalized'href='scope.html#1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/intro.tex#L6'>#</a></div><divclass='texpara'><divid='scope-1.sentence-1'class='sentence'><aclass='index'id=':scope'></a>This document describes the contents of the <aclass='hidden_link'href='#def:mp-units_library'title='1 Scope [scope]'><spanid='def:mp-units_library'><i>mp-units library</i></span></a><aclass='hidden_link'href='#scope-1.sentence-1'>.</a></div></div></div></div><divid='refs'class='section'><h1><aclass='secnum'style='min-width:50pt'>2</a> References <aclass='abbr_ref'href='index.html#refs'>[refs]</a></h1><divclass='para'><divclass='marginalizedparent'><aclass='marginalized'href='refs.html#1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/intro.tex#L14'>#</a></div><divclass='texpara'><divid='refs-1.sentence-1'class='sentence'><aclass='index'id=':references'></a>The following documents are referred to in the text
constitutes requirements of this document<aclass='hidden_link'href='#refs-1.sentence-1'>.</a></div><divid='refs-1.sentence-2'class='sentence'>For dated references, only the edition cited applies<aclass='hidden_link'href='#refs-1.sentence-2'>.</a></div><divid='refs-1.sentence-3'class='sentence'>For undated references,
the latest edition of the referenced document
(including any amendments) applies<aclass='hidden_link'href='#refs-1.sentence-3'>.</a></div><ulclass='itemize'><liid='refs-1.1'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#refs-1.1'>(1.1)</a></div><divclass='texpara'><divid='refs-1.1.sentence-1'class='sentence'>IEC 60050-102:2007/AMD3:2021,
<i>Amendment 3 — International Electrotechnical Vocabulary (IEV) —
Part 102: Mathematics — General concepts and linear algebra</i></div></div></li><liid='refs-1.2'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#refs-1.2'>(1.2)</a></div><divclass='texpara'><divid='refs-1.2.sentence-1'class='sentence'>IEC 60050-112:2010/AMD2:2020,
<i>Amendment 2 — International Electrotechnical Vocabulary (IEV) —
Part 112: Quantities and units</i></div></div></li><liid='refs-1.3'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#refs-1.3'>(1.3)</a></div><divclass='texpara'><divid='refs-1.3.sentence-1'class='sentence'>ISO 80000 (all parts), <i>Quantities and units</i></div></div></li><liid='refs-1.4'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#refs-1.4'>(1.4)</a></div><divclass='texpara'><divid='refs-1.4.sentence-1'class='sentence'>The C++ Standards Committee<aclass='hidden_link'href='#refs-1.4.sentence-1'>.</a></div><divid='refs-1.4.sentence-2'class='sentence'>N4971: <i>Working Draft, Standard for Programming Language C++</i><aclass='hidden_link'href='#refs-1.4.sentence-2'>.</a></div><divid='refs-1.4.sentence-3'class='sentence'>Edited by Thomas Köppe<aclass='hidden_link'href='#refs-1.4.sentence-3'>.</a></div><divid='refs-1.4.sentence-4'class='sentence'>Available from: <ahref='https://wg21.link/N4971'>https://wg21.link/N4971</a></div></div></li><liid='refs-1.5'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#refs-1.5'>(1.5)</a></div><divclass='texpara'><divid='refs-1.5.sentence-1'class='sentence'>The C++ Standards Committee<aclass='hidden_link'href='#refs-1.5.sentence-1'>.</a></div><divid='refs-1.5.sentence-2'class='sentence'>SD-8: <i>Standard Library Compatibility</i><aclass='hidden_link'href='#refs-1.5.sentence-2'>.</a></div><divid='refs-1.5.sentence-3'class='sentence'>Edited by Bryce Lelbach<aclass='hidden_link'href='#refs-1.5.sentence-3'>.</a></div><divid='refs-1.5.sentence-4'class='sentence'>Available from: <ahref='https://wg21.link/SD8'>https://wg21.link/SD8</a></div></div></li></ul></div></div></div><divid='defs'class='section'><h1><aclass='secnum'style='min-width:50pt'>3</a> Terms and definitions <aclass='abbr_ref'href='index.html#defs'>[defs]</a></h1><divclass='para'><divclass='marginalizedparent'><aclass='marginalized'href='defs.html#1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/intro.tex#L50'>#</a></div><divclass='texpara'><divid='defs-1.sentence-1'class='sentence'><aclass='index'id=':definitions'></a>For the purposes of this document,
and the following apply<aclass='hidden_link'href='#defs-1.sentence-1'>.</a></div></div></div><divclass='para'><divclass='marginalizedparent'><aclass='marginalized'href='defs.html#2'>2</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/intro.tex#L61'>#</a></div><divclass='texpara'><divid='defs-2.sentence-1'class='sentence'>ISO and IEC maintain terminology databases
<ulclass='itemize'><liid='defs-2.1'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#defs-2.1'>(2.1)</a></div>ISO Online browsing platform: available at <ahref='https://www.iso.org/obp'>https://www.iso.org/obp</a></li><liid='defs-2.2'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#defs-2.2'>(2.2)</a></div>IEC Electropedia: available at <ahref='http://www.electropedia.org'>http://www.electropedia.org</a></li></ul>
<ahref="https://wg21.link/description">N4971, [description]</a>, <ahref="https://wg21.link/requirements">N4971, [requirements]</a>, <ahref="https://wg21.link/concepts.equality">N4971, [concepts.equality]</a>, and SD-8,
all assumingly amended for the context of this library<aclass='hidden_link'href='#spec.ext-1.sentence-1'>.</a></div><divid='spec.ext-note-1'class='note'><divclass='texpara'>[<i>Note <ahref='#spec.ext-note-1'>1</a></i>: <divid='spec.ext-1.sentence-2'class='sentence'>This means that, non exhaustively,
<ulclass='itemize'><liid='spec.ext-1.1'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#spec.ext-1.1'>(1.1)</a></div><spanclass='texttt'><spanclass='operator'>​::​</span>mp_<spanclass='shy'></span>units2</span> is a reserved namespace, and</li><liid='spec.ext-1.2'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#spec.ext-1.2'>(1.2)</a></div><spanclass='texttt'>std<spanclass='operator'>​::​</span>vector<spanclass='anglebracket'><</span>mp_<spanclass='shy'></span>units<spanclass='operator'>​::​</span><i>type</i><spanclass='anglebracket'>></span></span>
is a program-defined specialization and a library-defined specialization
from the point of view of the C++ standard library and the mp-units library, respectively<aclass='hidden_link'href='#spec.ext-1.sentence-2'>.</a></li></ul></div> — <i>end note</i>]</div></div></div></div><divclass='para'><divclass='marginalizedparent'><aclass='marginalized'href='spec.ext.html#2'>2</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/intro.tex#L91'>#</a></div><divclass='texpara'><divid='spec.ext-2.sentence-1'class='sentence'>The mp-units library is not part of the C++ implementation<aclass='hidden_link'href='#spec.ext-2.sentence-1'>.</a></div></div></div></div><divid='spec.cats'class='section'><h2><aclass='secnum'style='min-width:65pt'>4.2</a> Categories <aclass='abbr_ref'href='spec.cats.html'>[spec.cats]</a></h2><divclass='para'><divclass='marginalizedparent'><aclass='marginalized'href='spec.cats.html#1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/intro.tex#L96'>#</a></div><divclass='texpara'><divid='spec.cats-1.sentence-1'class='sentence'>Detailed specifications for each of the components in the library are in
as shown in Table <ahref='#tab:lib.cats'title='Table 1: Library categories'>1</a><aclass='hidden_link'href='#spec.cats-1.sentence-1'>.</a></div></div><divclass='texpara'><divclass='numberedTable'id='tab:lib.cats'>Table <ahref='#tab:lib.cats'>1</a>: Library categories <ahref='./tab:lib.cats.html'>[tab:lib.cats]</a><br><table><trid='tab:lib.cats-row-1'class='rowsep'><tdclass='hidden'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#tab:lib.cats-row-1'>🔗</a></div></td><tdclass='left'><divclass='texpara'><divid='tab:lib.cats-row-1-column-1-sentence-1'class='sentence'><b>Clause</b></div></div></td><tdclass='left'><divclass='texpara'><divid='tab:lib.cats-row-1-column-2-sentence-1'class='sentence'><b>Category</b></div></div></td></tr><trid='tab:lib.cats-row-2'class='capsep'><tdclass='hidden'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#tab:lib.cats-row-2'>🔗</a></div></td><tdclass='left'><divclass='texpara'><divid='tab:lib.cats-row-2-column-1-sentence-1'class='sentence'><ahref='#qties'title='5 Quantities library'>[qties]</a></div></div></td><tdclass='left'><divclass='texpara'><divid='tab:lib.cats-row-2-column-2-sentence-1'class='sentence'>Quantities library</div></div></td></tr></table></div></div></div><divclass='para'><divclass='marginalizedparent'><aclass='marginalized'href='spec.cats.html#2'>2</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/intro.tex#L108'>#</a></div><divclass='texpara'><divid='spec.cats-2.sentence-1'class='sentence'>The quantities library (<ahref='#qties'title='5 Quantities library'>[qties]</a>)
describes components for dealing with quantities<aclass='hidden_link'href='#spec.cats-2.sentence-1'>.</a></div></div></div></div><divid='spec.mods'class='section'><h2><aclass='secnum'style='min-width:65pt'>4.3</a> Modules <aclass='abbr_ref'href='spec.mods.html'>[spec.mods]</a></h2><divclass='para'><divclass='marginalizedparent'><aclass='marginalized'href='spec.mods.html#1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/intro.tex#L114'>#</a></div><divclass='texpara'><divid='spec.mods-1.sentence-1'class='sentence'>The mp-units library provides the
</code></div></div><divclass='para'><divclass='marginalizedparent'><aclass='marginalized'href='qty.helpers.html#1'>1</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/quantities.tex#L122'>#</a></div><divclass='texpara'><divid='qty.helpers-1.sentence-1'class='sentence'><i>Preconditions</i>: <spanclass='texttt'>is_<spanclass='shy'></span>type<spanclass='parenthesis'>(</span>type<spanclass='parenthesis'>)</span><spanclass='operator'>&</span><spanclass='operator'>&</span> is_<spanclass='shy'></span>template<spanclass='parenthesis'>(</span>template_<spanclass='shy'></span>name<spanclass='parenthesis'>)</span></span> is <spanclass='texttt'><spanclass='literal'>true</span></span><aclass='hidden_link'href='#qty.helpers-1.sentence-1'>.</a></div></div></div></div><divclass='para'><divclass='marginalizedparent'><aclass='marginalized'href='qty.helpers.html#2'>2</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/quantities.tex#L126'>#</a></div><divclass='texpara'><divid='qty.helpers-2.sentence-1'class='sentence'><i>Returns</i>: <spanclass='texttt'><spanclass='literal'>true</span></span> if
<spanclass='texttt'><spanclass='squarebracket'>[</span><spanclass='operator'>:</span>type<spanclass='operator'>:</span><spanclass='squarebracket'>]</span></span> has an unambiguous and accessible base
that is a specialization of <spanclass='texttt'><spanclass='squarebracket'>[</span><spanclass='operator'>:</span>template_<spanclass='shy'></span>name<spanclass='operator'>:</span><spanclass='squarebracket'>]</span></span>, and
users may specialize <spanclass='texttt'>is_<spanclass='shy'></span>scalar</span>, <spanclass='texttt'>is_<spanclass='shy'></span>vector</span>, and <spanclass='texttt'>is_<spanclass='shy'></span>tensor</span> to <spanclass='texttt'><spanclass='literal'>true</span></span>
for cv-unqualified program-defined types
which respectively represent
a scalar (<ahref="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-02-18">IEC 60050, 102-02-18</a>),
a vector (<ahref="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-03-04">IEC 60050, 102-03-04</a>), and
a tensor,
and <spanclass='texttt'><spanclass='literal'>false</span></span> for types which respectively do not<aclass='hidden_link'href='#qty.traits-1.sentence-1'>.</a></div></div></div></div></div><divid='qty.concepts'class='section'><h2><aclass='secnum'style='min-width:65pt'>5.7</a> Concepts <aclass='abbr_ref'href='qty.concepts.html'>[qty.concepts]</a></h2><divclass='texpara'><divclass='itemdecl'id='concept:representation'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#concept:representation'>🔗</a></div><codeclass='itemdeclcode'><spanclass='keyword'>export</span><spanclass='keyword'>template</span><spanclass='anglebracket'><</span><spanclass='keyword'>typename</span> T<spanclass='anglebracket'>></span>
that is a specialization of <spanclass='texttt'>quantity</span> or <spanclass='texttt'>quantity_<spanclass='shy'></span>point</span><aclass='hidden_link'href='#qty.types.general-1.sentence-1'>.</a></div><divid='qty.types.general-1.sentence-2'class='sentence'><spanclass='texttt'><i>Q</i></span> represents a quantity (<ahref="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-01">IEC 60050, 112-01-01</a>)
with <spanclass='texttt'><i>Q</i><spanclass='operator'>​::​</span>rep</span> as its number
and <spanclass='texttt'><i>Q</i><spanclass='operator'>​::​</span>reference</span> as its reference<aclass='hidden_link'href='#qty.types.general-1.sentence-2'>.</a></div><divid='qty.types.general-1.sentence-3'class='sentence'><spanclass='texttt'><i>Q</i></span> is a structural type (<ahref="https://wg21.link/temp.paramterm.structural.type">N4971, [temp.param]</a>)
if <spanclass='texttt'><i>Q</i><spanclass='operator'>​::​</span>rep</span> is a structural type<aclass='hidden_link'href='#qty.types.general-1.sentence-3'>.</a></div></div></div><divclass='para'><divclass='marginalizedparent'><aclass='marginalized'href='qty.types.general.html#2'>2</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/quantities.tex#L206'>#</a></div><divclass='texpara'><divid='qty.types.general-2.sentence-1'class='sentence'>Each class template defined in subclause <ahref='#qty.types'title='5.8 Types'>[qty.<spanclass='shy'></span>types]</a>
has data members and special members specified below, and
has no base classes or members other than those specified<aclass='hidden_link'href='#qty.types.general-2.sentence-1'>.</a></div></div></div></div><divid='qty.type'class='section'><h3><aclass='secnum'style='min-width:80pt'>5.8.2</a> Class template <spanclass='texttt'>quantity</span><aclass='abbr_ref'href='qty.type.html'>[qty.type]</a></h3><divclass='texpara'><spanclass='codeblock'><spanclass='keyword'>namespace</span> mp_units <spanclass='curlybracket'>{</span>
</span></div><divclass='texpara'><divid='qty.type-sentence-1'class='sentence'>Let <spanclass='texttt'><i>Q</i></span> be a specialization of <spanclass='texttt'>quantity</span><aclass='hidden_link'href='#qty.type-sentence-1'>.</a></div><ulclass='itemize'><li><divclass='texpara'><divid='qty.type-sentence-1'class='sentence'>If <spanclass='texttt'>Rep</span> is a scalar,
<spanclass='texttt'><i>Q</i></span> represents a scalar quantity (<ahref="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-02-19">IEC 60050, 102-02-19</a>)<aclass='hidden_link'href='#qty.type-sentence-1'>.</a></div></div></li><li><divclass='texpara'><divid='qty.type-sentence-1'class='sentence'>If <spanclass='texttt'>Rep</span> is a vector,
<spanclass='texttt'><i>Q</i></span> represents a vector (<ahref="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-03-04">IEC 60050, 102-03-04</a>)<aclass='hidden_link'href='#qty.type-sentence-1'>.</a></div></div></li></ul></div></div><divid='qty.point.type'class='section'><h3><aclass='secnum'style='min-width:80pt'>5.8.3</a> Class template <spanclass='texttt'>quantity_<spanclass='shy'></span>point</span><aclass='abbr_ref'href='qty.point.type.html'>[qty.point.type]</a></h3><divclass='texpara'><spanclass='codeblock'><spanclass='keyword'>namespace</span> mp_units <spanclass='curlybracket'>{</span>
</span></div><divclass='texpara'><divid='qty.point.type-sentence-1'class='sentence'>A <aclass='hidden_link'href='#def:type,quantity_point'title='5.8.3 Class template quantity_­point [qty.point.type]'><spanid='def:type,quantity_point'><i>quantity point type</i></span></a> is a specialization of <spanclass='texttt'>quantity_<spanclass='shy'></span>point</span><aclass='hidden_link'href='#qty.point.type-sentence-1'>.</a></div><divid='qty.point.type-sentence-2'class='sentence'>Let <spanclass='texttt'><i>Q</i></span> be a quantity point type<aclass='hidden_link'href='#qty.point.type-sentence-2'>.</a></div><divid='qty.point.type-sentence-3'class='sentence'><spanclass='texttt'><i>Q</i><spanclass='operator'>​::​</span>point_<spanclass='shy'></span>origin</span> represents
the origin point of a position vector (<ahref="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-03-15">IEC 60050, 102-03-15</a>)<aclass='hidden_link'href='#qty.point.type-sentence-3'>.</a></div><ulclass='itemize'><li><divclass='texpara'><divid='qty.point.type-sentence-1'class='sentence'>If <spanclass='texttt'>Rep</span> is a scalar,
<spanclass='texttt'><i>Q</i></span> represents the scalar quantity (<ahref="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-02-19">IEC 60050, 102-02-19</a>)
of a position vector<aclass='hidden_link'href='#qty.point.type-sentence-1'>.</a></div></div></li><li><divclass='texpara'><divid='qty.point.type-sentence-1'class='sentence'>If <spanclass='texttt'>Rep</span> is a vector,
<spanclass='texttt'><i>Q</i></span> represents a position vector<aclass='hidden_link'href='#qty.point.type-sentence-1'>.</a></div></div></li></ul></div></div></div><divid='qty.compat'class='section'><h2><aclass='secnum'style='min-width:65pt'>5.9</a> Compatibility <aclass='abbr_ref'href='qty.compat.html'>[qty.compat]</a></h2></div><divid='qty.one'class='section'><h2><aclass='secnum'style='min-width:65pt'>5.10</a> Dimension one <aclass='abbr_ref'href='qty.one.html'>[qty.one]</a></h2></div><divid='qty.systems'class='section'><h2><aclass='secnum'style='min-width:65pt'>5.11</a> Systems <aclass='abbr_ref'href='qty.systems.html'>[qty.systems]</a></h2></div><divid='qty.chrono'class='section'><h2><aclass='secnum'style='min-width:65pt'>5.12</a><spanclass='texttt'>std​::​chrono</span> compatibility <aclass='abbr_ref'href='qty.chrono.html'>[qty.chrono]</a></h2></div></div></div></body></html>