Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9038/boost-sandbox/boost/units
Modified Files:
quantity.hpp
Log Message:
Fixed dimensionless conversions
Index: quantity.hpp
===================================================================
RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- quantity.hpp 4 Apr 2007 23:04:08 -0000 1.14
+++ quantity.hpp 9 Apr 2007 16:50:41 -0000 1.15
@@ -188,14 +188,21 @@
}
/// implicit conversion between different unit systems is allowed
- template<class System2>
- quantity(const quantity<unit<dimensionless_type,System2>,Y>& source) :
+ template<class System2, class Y2>
+ quantity(const quantity<unit<dimensionless_type,homogeneous_system<System2> >,Y2>& source) :
val_(source.value())
{ }
+ /// conversion between different unit systems is explicit when
+ /// the units are not equivalent.
+ template<class System2, class Y2>
+ explicit quantity(const quantity<unit<dimensionless_type,System2>,Y2>& source) :
+ val_(conversion_helper<quantity<unit<dimensionless_type,System2>,Y2>, this_type>::convert(source).value())
+ { }
+
/// implicit assignment between different unit systems is allowed
template<class System2>
- this_type& operator=(const quantity<unit<dimensionless_type,System2>,Y>& source)
+ this_type& operator=(const quantity<unit<dimensionless_type,homogeneous_system<System2> >,Y>& source)
{
*this = this_type(source);
|