<!DOCTYPE html><htmllang='en'><head><title>[qty.derived.unit]</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'><h1><aclass='secnum'style='min-width:50pt'>5</a> Quantities and units library <aclass='abbr_ref'href='index.html#quantities'>[quantities]</a></h1><h2><aclass='secnum'style='min-width:65pt'>5.4</a> Reference <aclass='abbr_ref'href='qty.ref.html#qty.derived.unit'>[qty.ref]</a></h2><h3><aclass='secnum'style='min-width:80pt'>5.4.4</a> Unit <aclass='abbr_ref'href='qty.unit.html#qty.derived.unit'>[qty.unit]</a></h3><h4><aclass='secnum'style='min-width:95pt'>5.4.4.5</a> Types <aclass='abbr_ref'href='qty.unit.types.html#qty.derived.unit'>[qty.unit.types]</a></h4><h4><aclass='secnum'style='min-width:110pt'>5.4.4.5.6</a> Derived <aclass='abbr_ref'>[qty.derived.unit]</a></h4><divclass='texpara'><spanid='lib:derived_unit'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#lib:derived_unit'>🔗</a></div><spanclass='codeblock'><spanclass='keyword'>namespace</span> mp_units <spanclass='curlybracket'>{</span>
</span></span></div><divclass='para'id='1'><divclass='marginalizedparent'><aclass='marginalized'href='#1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L2879'>#</a></div><divclass='texpara'><divid='1.sentence-1'class='sentence'><spanclass='texttt'>derived_<spanclass='shy'></span>unit</span> is used by the library
to represent a derived unit (<ahref="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-19">IEC 60050, 112-01-19</a>)<aclass='hidden_link'href='#1.sentence-1'>.</a></div><divid='example-1'class='example'><divclass='texpara'>[<i>Example <ahref='#example-1'>1</a></i>: <spanclass='codeblock'><spanclass='keyword'>using</span><spanclass='keyword'>namespace</span> si<spanclass='operator'>::</span>unit_symbols;
<spanclass='keyword'>int</span> x <spanclass='operator'>=</span> m <spanclass='operator'>*</span> m; <spanclass='comment'>// error: cannot construct from <spanclass='tcode_in_codeblock'>derived_<spanclass='shy'></span>unit<power<si​::​metre, 2>></span></span>
<spanclass='keyword'>int</span> y <spanclass='operator'>=</span> m <spanclass='operator'>*</span> s; <spanclass='comment'>// error: cannot construct from <spanclass='tcode_in_codeblock'>derived_<spanclass='shy'></span>unit<si​::​metre, si​::​second></span></span>
<spanclass='keyword'>int</span> z <spanclass='operator'>=</span> m <spanclass='operator'>/</span> s; <spanclass='comment'>// error: cannot construct from <spanclass='tcode_in_codeblock'>derived_<spanclass='shy'></span>unit<si​::​metre, per<si​::​second>></span></span>