|
From: Matthias S. <mat...@us...> - 2007-04-10 22:57:25
|
Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10814 Modified Files: quantity.hpp Log Message: streamline runtime comparison operators Index: quantity.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- quantity.hpp 9 Apr 2007 16:50:41 -0000 1.15 +++ quantity.hpp 10 Apr 2007 22:57:24 -0000 1.16 @@ -851,107 +851,179 @@ } /// runtime operator== -template<class System, - class Dim1, - class Dim2, +template<class Unit, class X, class Y> inline bool -operator==(const quantity<unit<Dim1,System>,X>& val1, - const quantity<unit<Dim2,System>,Y>& val2) +operator==(const quantity<Unit,X>& val1, + const quantity<Unit,Y>& val2) { - // ensure dimension lists are commensurate - BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); - return val1.value() == val2.value(); } /// runtime operator!= -template<class System, - class Dim1, - class Dim2, +template<class Unit, class X, class Y> inline bool -operator!=(const quantity<unit<Dim1,System>,X>& val1, - const quantity<unit<Dim2,System>,Y>& val2) +operator!=(const quantity<Unit,X>& val1, + const quantity<Unit,Y>& val2) { - // ensure dimension lists are commensurate - BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); - return val1.value() != val2.value(); } /// runtime operator< -template<class System, - class Dim1, - class Dim2, +template<class Unit, class X, class Y> inline bool -operator<(const quantity<unit<Dim1,System>,X>& val1, - const quantity<unit<Dim2,System>,Y>& val2) +operator<(const quantity<Unit,X>& val1, + const quantity<Unit,Y>& val2) { - // ensure dimension lists are commensurate - BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); - return val1.value() < val2.value(); } /// runtime operator<= -template<class System, - class Dim1, - class Dim2, +template<class Unit, class X, class Y> inline bool -operator<=(const quantity<unit<Dim1,System>,X>& val1, - const quantity<unit<Dim2,System>,Y>& val2) +operator<=(const quantity<Unit,X>& val1, + const quantity<Unit,Y>& val2) { - // ensure dimension lists are commensurate - BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); - return val1.value() <= val2.value(); } /// runtime operator> -template<class System, - class Dim1, - class Dim2, +template<class Unit, class X, class Y> inline bool -operator>(const quantity<unit<Dim1,System>,X>& val1, - const quantity<unit<Dim2,System>,Y>& val2) +operator>(const quantity<Unit,X>& val1, + const quantity<Unit,Y>& val2) { - // ensure dimension lists are commensurate - BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); - return val1.value() > val2.value(); } /// runtime operator>= -template<class System, - class Dim1, - class Dim2, +template<class Unit, class X, class Y> inline bool -operator>=(const quantity<unit<Dim1,System>,X>& val1, - const quantity<unit<Dim2,System>,Y>& val2) +operator>=(const quantity<Unit,X>& val1, + const quantity<Unit,Y>& val2) { - // ensure dimension lists are commensurate - BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); - return val1.value() >= val2.value(); } +///// runtime operator== +//template<class System, +// class Dim1, +// class Dim2, +// class X, +// class Y> +//inline +//bool +//operator==(const quantity<unit<Dim1,System>,X>& val1, +// const quantity<unit<Dim2,System>,Y>& val2) +//{ +// // ensure dimension lists are commensurate +// BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); +// +// return val1.value() == val2.value(); +//} +// +///// runtime operator!= +//template<class System, +// class Dim1, +// class Dim2, +// class X, +// class Y> +//inline +//bool +//operator!=(const quantity<unit<Dim1,System>,X>& val1, +// const quantity<unit<Dim2,System>,Y>& val2) +//{ +// // ensure dimension lists are commensurate +// BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); +// +// return val1.value() != val2.value(); +//} +// +///// runtime operator< +//template<class System, +// class Dim1, +// class Dim2, +// class X, +// class Y> +//inline +//bool +//operator<(const quantity<unit<Dim1,System>,X>& val1, +// const quantity<unit<Dim2,System>,Y>& val2) +//{ +// // ensure dimension lists are commensurate +// BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); +// +// return val1.value() < val2.value(); +//} +// +///// runtime operator<= +//template<class System, +// class Dim1, +// class Dim2, +// class X, +// class Y> +//inline +//bool +//operator<=(const quantity<unit<Dim1,System>,X>& val1, +// const quantity<unit<Dim2,System>,Y>& val2) +//{ +// // ensure dimension lists are commensurate +// BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); +// +// return val1.value() <= val2.value(); +//} +// +///// runtime operator> +//template<class System, +// class Dim1, +// class Dim2, +// class X, +// class Y> +//inline +//bool +//operator>(const quantity<unit<Dim1,System>,X>& val1, +// const quantity<unit<Dim2,System>,Y>& val2) +//{ +// // ensure dimension lists are commensurate +// BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); +// +// return val1.value() > val2.value(); +//} +// +///// runtime operator>= +//template<class System, +// class Dim1, +// class Dim2, +// class X, +// class Y> +//inline +//bool +//operator>=(const quantity<unit<Dim1,System>,X>& val1, +// const quantity<unit<Dim2,System>,Y>& val2) +//{ +// // ensure dimension lists are commensurate +// BOOST_STATIC_ASSERT((is_same<Dim1,Dim2>::value == true)); +// +// return val1.value() >= val2.value(); +//} + } // namespace units } // namespace boost |