From: Steven W. <ste...@us...> - 2007-04-15 02:09:25
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8273/boost-sandbox/boost/units Modified Files: base_dimension.hpp Log Message: More comments + INTERNAL ONLY Index: base_dimension.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/base_dimension.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- base_dimension.hpp 15 Apr 2007 01:47:05 -0000 1.5 +++ base_dimension.hpp 15 Apr 2007 02:09:19 -0000 1.6 @@ -39,12 +39,14 @@ } -/// this must be in namespace boost::units so that ADL +/// This must be in namespace boost::units so that ADL /// will work with friend functions defined inline. /// INTERNAL ONLY template<long N> struct long_ {}; +/// Ditto. +/// INTERNAL ONLY template<class T, long N> struct base_dimension_pair {}; @@ -54,8 +56,8 @@ template<class T> detail::no boost_units_prevent_double_definition(const T&) { return(detail::no()); } -/// Defines a base dimensions. To define a dimension you need to provide -/// the derived class and a unique integer. +/// 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> {}; /// It is designed so that you will get an error message if you try /// to use the same value in multiple definitions. @@ -66,7 +68,11 @@ sizeof(boost_units_prevent_double_definition(units::base_dimension_pair<Derived, N>())) != sizeof(detail::yes) >::type> struct base_dimension : mpl::long_<N> { + /// Register this ordinal + /// INTERNAL ONLY friend detail::yes boost_units_prevent_double_definition(const units::long_<N>&) { return(detail::yes()); } + /// But make sure we can identify the current instantiation! + /// INTERNAL ONLY friend detail::yes boost_units_prevent_double_definition(const units::base_dimension_pair<Derived, N>&) { return(detail::yes()); } typedef base_dimension this_type; typedef mpl::long_<N> value; |