From: Steven W. <ste...@us...> - 2007-04-29 02:38:04
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12750/boost-sandbox/boost/units/experimental Modified Files: base_unit.hpp Log Message: Minor name changes, made base_unit and base_dimension independent Index: base_unit.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/experimental/base_unit.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- base_unit.hpp 29 Apr 2007 00:48:15 -0000 1.2 +++ base_unit.hpp 29 Apr 2007 02:36:22 -0000 1.3 @@ -23,20 +23,26 @@ namespace units { +/// This must be in namespace boost::units so that ADL +/// will work with friend functions defined inline. +/// Base dimensions and base units are independent. +/// INTERNAL ONLY +template<long N> struct base_unit_ordinal { }; + /// INTERNAL ONLY template<class T, long N> struct base_unit_pair { }; -/// Defines a base dimension. To define a dimension you need to provide -/// the derived class (CRTP) and a unique integer. -/// struct my_dimension : boost::units::base_dimension<my_dimension, 1> {}; +/// Defines a base dimension. To define a unit you need to provide +/// the derived class (CRTP), a dimension list and a unique integer. +/// struct my_unit : boost::units::base_unit<my_dimension, length_type, 1> {}; /// It is designed so that you will get an error message if you try /// to use the same value in multiple definitions. template<class Derived, class Dim, long N, class = typename detail::ordinal_has_already_been_defined< - sizeof(prevent_ordinal_redefinition(units::long_<N>())) == sizeof(detail::yes) && - sizeof(prevent_ordinal_redefinition(units::base_unit_pair<Derived, N>())) != sizeof(detail::yes) + sizeof(boost_units_is_registered(units::base_unit_ordinal<N>())) == sizeof(detail::yes) && + sizeof(boost_units_is_registered(units::base_unit_pair<Derived, N>())) != sizeof(detail::yes) >::type> class base_unit : public mpl::long_<N> @@ -50,13 +56,13 @@ /// Register this ordinal /// INTERNAL ONLY friend detail::yes - prevent_ordinal_redefinition(const units::long_<N>&) + boost_units_is_registered(const units::base_unit_ordinal<N>&) { return(detail::yes()); } /// But make sure we can identify the current instantiation! /// INTERNAL ONLY friend detail::yes - prevent_ordinal_redefinition(const units::base_unit_pair<Derived, N>&) + boost_units_is_registered(const units::base_unit_pair<Derived, N>&) { return(detail::yes()); } }; |