From: Steven W. <ste...@us...> - 2007-04-15 01:41:48
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29959/boost-sandbox/boost/units Modified Files: base_dimension.hpp Log Message: make sure that we can refer to base_dimension without causing erros Index: base_dimension.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/base_dimension.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- base_dimension.hpp 14 Apr 2007 21:52:00 -0000 1.3 +++ base_dimension.hpp 15 Apr 2007 01:41:48 -0000 1.4 @@ -41,10 +41,14 @@ template<long N> struct long_ {}; +template<class T, long N> +struct base_dimension_pair {}; + /// Again this needs to be in the same namespace as long_ +/// we need a mangled name because it must be found by ADL /// INTERNAL ONLY -template<long N> -no boost_units_prevent_double_definition(units::long_<N>) { return(no()); } +template<class T> +no boost_units_prevent_double_definition(const T&) { return(no()); } /// Defines a base dimensions. To define a dimension you need to provide /// the derived class and a unique integer. @@ -54,11 +58,13 @@ template<class Derived, long N, class = typename ordinal_has_already_been_defined< - sizeof(boost_units_prevent_double_definition(units::long_<N>())) == sizeof(yes) + sizeof(boost_units_prevent_double_definition(units::long_<N>())) == sizeof(yes) && + sizeof(boost_units_prevent_double_definition(units::base_dimension_pair<Derived, N>())) != sizeof(yes) >::type> struct base_dimension : mpl::long_<N> { - friend yes boost_units_prevent_double_definition(units::long_<N>) { return(yes()); } - typedef Derived this_type; + friend yes boost_units_prevent_double_definition(const units::long_<N>&) { return(yes()); } + friend yes boost_units_prevent_double_definition(const units::base_dimension_pair<Derived, N>&) { return(yes()); } + typedef base_dimension this_type; typedef mpl::long_<N> value; typedef dimension_list<dim<Derived,static_rational<1> >, dimensionless_type> type; }; |