Hi Stephen,

I don't have much experience with creating new units and new systems in Boost Units, but I find that the predefined units and systems and prefixes already have most needs covered. For example, see:

http://www.boost.org/doc/libs/1_48_0/doc/html/boost_units/Examples.html#boost_units.Examples.RadarBeamHeightExample 

for the use of "kilo*meters".

Of course you can typedef your own kilometer, if you absolutely must, as in:

http://www.boost.org/doc/libs/1_48_0/doc/html/boost_units/Units.html#boost_units.Units.scaled_base_units

Furthermore, you can static_cast between quantities (as long as the conversion is defined somewhere [it already is for degrees and radians]). See:

http://www.boost.org/doc/libs/1_48_0/doc/html/boost_units/Quantities.html#boost_units.Quantities.Conversions


Lastly, creating a dimensionless angle type is possible but I would advise against it, as it then puts you in the territory of not being able to distinguish between solid angular quantities and pseudovectors, and breaks your interoperability with all the provided angular units. See the first 2 points in this FAQ for some rationale behind angles: 

http://www.boost.org/doc/libs/1_48_0/doc/html/boost_units/FAQ.html#boost_units.FAQ.Distinguishing_Quantities_With_Same_Units

The situation does sometimes lead to code that doesn't look as elegant as the maths did on paper, but it does maintain correctness which leads to less uncertainty about its operation.

Best of luck with using Boost.Units, I hope the above links help a little.

Regards,

Edmund Fokschaner

On 9 December 2011 16:30, Stephen Torri <stephen.torri@gmail.com> wrote:
Below is a dump of the build output from compiling the stand alone
example. In order to understand what I am doing I am trying to setup a
boost unit system where length is in kilometers, angle is in degrees
and time is in minutes. I would like to have the ability to enter
automatically convert angles from degrees to radians. In addition I am
attemping to make the angle types I use to be dimensionless.

Regards,
Stephen

-----------
1>Compiling...
1>boost_units.cpp
1>C:\boost\boost/units/detail/linear_algebra.hpp(342) : error C3083:
'item': the symbol to the left of a '::' must be a type
1>        C:\boost\boost/units/detail/linear_algebra.hpp(310) : see
reference to class template instantiation
'boost::units::detail::invert_handle_inital_rows<0>::apply<RowsBegin,IdentityBegin>'
being compiled
1>        with
1>        [
1>            RowsBegin=boost::units::list<boost::units::detail::eliminate_from_pair_of_equations_impl<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::static_rational<0,1>,boost::units::static_rational<1>>::type,boost::units::detail::invert_handle_after_pivot_row<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>>::new_matrix>,
1>            IdentityBegin=boost::units::list<boost::units::list<boost::units::static_rational<-1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::list<boost::units::dim<boost::units::plane_angle_base_dimension,boost::units::static_rational<1>>,boost::units::dimensionless_type>>::type,boost::units::list<boost::units::static_rational<1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::detail::invert_handle_after_pivot_row<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>>::identity_result>
1>        ]
1>        C:\boost\boost/units/detail/linear_algebra.hpp(310) : see
reference to class template instantiation
'boost::units::detail::invert_handle_inital_rows<N>::apply<RowsBegin,IdentityBegin>'
being compiled
1>        with
1>        [
1>            N=1,
1>            RowsBegin=boost::units::list<boost::units::dimensionless_type,boost::units::list<boost::units::detail::eliminate_from_pair_of_equations_impl<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::static_rational<0,1>,boost::units::static_rational<1>>::type,boost::units::detail::invert_handle_after_pivot_row<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>>::new_matrix>>,
1>            IdentityBegin=boost::units::list<boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::list<boost::units::list<boost::units::static_rational<-1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::list<boost::units::dim<boost::units::plane_angle_base_dimension,boost::units::static_rational<1>>,boost::units::dimensionless_type>>::type,boost::units::list<boost::units::static_rational<1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::detail::invert_handle_after_pivot_row<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>>::identity_result>>
1>        ]
1>        C:\boost\boost/units/detail/linear_algebra.hpp(501) : see
reference to class template instantiation
'boost::units::detail::invert_handle_inital_rows<N>::apply<RowsBegin,IdentityBegin>'
being compiled
1>        with
1>        [
1>            N=2,
1>            RowsBegin=boost::units::list<boost::units::detail::eliminate_from_pair_of_equations_impl<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::static_rational<0,1>,boost::units::static_rational<1>>::type,boost::units::list<boost::units::dimensionless_type,boost::units::list<boost::units::detail::eliminate_from_pair_of_equations_impl<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::static_rational<0,1>,boost::units::static_rational<1>>::type,boost::units::detail::invert_handle_after_pivot_row<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>>::new_matrix>>>,
1>            IdentityBegin=boost::units::list<boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::list<boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::list<boost::units::list<boost::units::static_rational<-1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::list<boost::units::dim<boost::units::plane_angle_base_dimension,boost::units::static_rational<1>>,boost::units::dimensionless_type>>::type,boost::units::list<boost::units::static_rational<1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::detail::invert_handle_after_pivot_row<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>>::identity_result>>>
1>        ]
1>        C:\boost\boost/units/detail/linear_algebra.hpp(503) : see
reference to class template instantiation
'boost::units::detail::invert_impl<N>::apply<RowsBegin,IdentityBegin>'
being compiled
1>        with
1>        [
1>            N=1,
1>            RowsBegin=boost::units::list<boost::units::detail::eliminate_from_pair_of_equations_impl<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::static_rational<0,1>,boost::units::static_rational<1>>::type,boost::units::list<boost::units::dimensionless_type,boost::units::list<boost::units::detail::eliminate_from_pair_of_equations_impl<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::static_rational<0,1>,boost::units::static_rational<1>>::type,boost::units::detail::invert_handle_after_pivot_row<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>>::new_matrix>>>,
1>            IdentityBegin=boost::units::list<boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::list<boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::list<boost::units::list<boost::units::static_rational<-1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::list<boost::units::dim<boost::units::plane_angle_base_dimension,boost::units::static_rational<1>>,boost::units::dimensionless_type>>::type,boost::units::list<boost::units::static_rational<1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::detail::invert_handle_after_pivot_row<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>>::identity_result>>>
1>        ]
1>        C:\boost\boost/units/detail/linear_algebra.hpp(503) : see
reference to class template instantiation
'boost::units::detail::invert_impl<N>::apply<RowsBegin,IdentityBegin>'
being compiled
1>        with
1>        [
1>            N=2,
1>            RowsBegin=boost::units::list<boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>,boost::units::list<boost::units::list<boost::units::static_rational<1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>,boost::units::list<boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>,boost::units::detail::determine_extra_equations_impl<0>::apply<boost::units::dimensionless_type,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>::type>>>,
1>            IdentityBegin=boost::units::list<boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::list<boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::list<boost::units::list<boost::units::static_rational<-1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::list<boost::units::dim<boost::units::plane_angle_base_dimension,boost::units::static_rational<1>>,boost::units::dimensionless_type>>::type,boost::units::list<boost::units::static_rational<1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::detail::invert_handle_after_pivot_row<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>>::identity_result>>>
1>        ]
1>        C:\boost\boost/units/detail/linear_algebra.hpp(542) : see
reference to class template instantiation
'boost::units::detail::invert_impl<N>::apply<RowsBegin,IdentityBegin>'
being compiled
1>        with
1>        [
1>            N=3,
1>            RowsBegin=boost::units::list<boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>,boost::units::list<boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::list<boost::units::dim<boost::units::plane_angle_base_dimension,boost::units::static_rational<1>>,boost::units::dimensionless_type>>::type,boost::units::list<boost::units::static_rational<1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>,boost::units::list<boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>,boost::units::dimensionless_type>>>,
1>            IdentityBegin=boost::units::list<boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::list<boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::list<boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::list<boost::units::dim<boost::units::plane_angle_base_dimension,boost::units::static_rational<1>>,boost::units::dimensionless_type>>::type,boost::units::list<boost::units::static_rational<1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::detail::make_identity<0>::apply<3>::type>>>
1>        ]
1>        C:\boost\boost/units/detail/linear_algebra.hpp(828) : see
reference to class template instantiation
'boost::units::detail::make_square_and_invert<Matrix>' being compiled
1>        with
1>        [
1>            Matrix=boost::units::list<boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>,boost::units::list<boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::list<boost::units::dim<boost::units::plane_angle_base_dimension,boost::units::static_rational<1>>,boost::units::dimensionless_type>>::type,boost::units::list<boost::units::static_rational<1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>,boost::units::list<boost::units::list<boost::units::static_rational<1>,boost::units::list<boost::units::detail::calculate_base_dimension_coefficients_func<false>::apply<boost::units::dimensionless_type>::type,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>,boost::units::dimensionless_type>>>
1>        ]
1>        C:\boost\boost/units/detail/linear_algebra.hpp(1032) : see
reference to class template instantiation
'boost::units::detail::normalize_units<T>' being compiled
1>        with
1>        [
1>            T=boost::units::list<myproject::units::minute_base_unit,boost::units::list<myproject::units::angle::degree_base_unit,boost::units::list<myproject::units::earth::kilometer_base_unit,boost::units::dimensionless_type>>>
1>        ]
1>        C:\boost\boost/units/detail/linear_algebra.hpp(1051) : see
reference to class template instantiation
'boost::units::detail::calculate_base_unit_exponents_impl<false>::apply<T,Dimensions>'
being compiled
1>        with
1>        [
1>            T=boost::units::list<myproject::units::minute_base_unit,boost::units::list<myproject::units::angle::degree_base_unit,boost::units::list<myproject::units::earth::kilometer_base_unit,boost::units::dimensionless_type>>>,
1>            Dimensions=boost::units::length_dimension
1>        ]
1>        C:\boost\boost/units/heterogeneous_system.hpp(243) : see
reference to class template instantiation
'boost::units::detail::calculate_base_unit_exponents<T,Dimensions>'
being compiled
1>        with
1>        [
1>            T=boost::units::list<myproject::units::minute_base_unit,boost::units::list<myproject::units::angle::degree_base_unit,boost::units::list<myproject::units::earth::kilometer_base_unit,boost::units::dimensionless_type>>>,
1>            Dimensions=boost::units::length_dimension
1>        ]
1>        C:\boost\boost/units/unit.hpp(92) : see reference to class
template instantiation
'boost::units::detail::make_heterogeneous_system<Dimensions,System>'
being compiled
1>        with
1>        [
1>            Dimensions=boost::units::length_dimension,
1>            System=myproject::units::earth::system
1>        ]
1>        C:\boost\boost/units/unit.hpp(99) : see reference to class
template instantiation 'boost::units::reduce_unit<Unit>' being
compiled
1>        with
1>        [
1>            Unit=boost::units::unit<boost::units::length_dimension,myproject::units::earth::system>
1>        ]
1>        ..\..\..\apps\boost_units\boost_units.cpp(81) : see
reference to class template instantiation
'boost::units::is_implicitly_convertible<S1,S2>' being compiled
1>        with
1>        [
1>            S1=boost::units::unit<boost::units::length_dimension,myproject::units::earth::system>,
1>            S2=boost::units::unit<boost::units::length_dimension,myproject::units::earth::system>
1>        ]
1>C:\boost\boost/units/detail/linear_algebra.hpp(342) : error C2039:
'Numerator' : is not a member of 'boost::units::dimensionless_type'
1>        C:\boost\boost/units/dimensionless_type.hpp(37) : see
declaration of 'boost::units::dimensionless_type'
1>C:\boost\boost/units/detail/linear_algebra.hpp(342) : error C2065:
'Numerator' : undeclared identifier

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users