12 public unit_base < ENUM >
17 constexpr targeted_unit() :
18 unit_base<ENUM>(0, allowed_units::allowed_units()[0])
23 template < prototype_
integral INTEGRAL >
24 constexpr targeted_unit(INTEGRAL i, ENUM eunit) :
25 unit_base<ENUM>(i, eunit)
27 assert_allowed(eunit);
30 template < prototype_
floating FLOATING >
31 constexpr targeted_unit(FLOATING f, ENUM eunit) :
32 unit_base<ENUM>(f, eunit)
34 assert_allowed(eunit);
37 constexpr targeted_unit(
const unit_base <ENUM > & unit) :
40 assert_allowed(this->m_eunit);
44 constexpr static void assert_allowed(ENUM eunit)
47 if (!is_allowed(eunit))
50 throw ::bad_unit_exception < ENUM >(eunit);
56 constexpr static bool is_allowed(ENUM eunit)
61 auto pallowed = allowed_units::allowed_units();
65 while ((eallowed = *pallowed) != e_unit_none)
68 if (eallowed == eunit)
84 template < prototype_
floating FLOATING >
85 constexpr targeted_unit & operator = (FLOATING f)
88 unit_base <ENUM >::operator = (f);
90 assert_allowed(this->m_eunit);
97 constexpr targeted_unit & operator = (
const unit_base <ENUM> & unit)
100 unit_base <ENUM >::operator =(unit);
102 assert_allowed(this->m_eunit);
108 constexpr void set_unit(ENUM eunit)
111 assert_allowed(eunit);
113 this->m_eunit = eunit;
118 template < prototype_
floating FLOATING >
119 targeted_unit & operator *= (FLOATING f)
122 unit_base < ENUM >::operator *=(f);
129 template < prototype_
floating FLOATING >
130 targeted_unit & operator /= (FLOATING f)
133 unit_base < ENUM >::operator /=(f);
140 template < prototype_
floating FLOATING >
141 targeted_unit operator * (FLOATING f)
const
153 template < prototype_
floating FLOATING >
154 targeted_unit operator / (FLOATING f)
const