Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2109/boost-sandbox/boost/units
Modified Files:
quantity.hpp
Log Message:
Optimized quantity_cast for UDTs (enabled RVO)
Index: quantity.hpp
===================================================================
RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- quantity.hpp 29 Mar 2007 19:10:39 -0000 1.7
+++ quantity.hpp 29 Mar 2007 19:19:54 -0000 1.8
@@ -375,7 +375,10 @@
{
typedef quantity<Unit1,Y> type;
- type operator()(quantity<Unit2,X>& source) { return type(source); }
+ type operator()(quantity<Unit2,X>& source)
+ {
+ return conversion_helper<quantity<Unit2,X>,quantity<Unit1,Y> >::convert(source);
+ }
};
/// specialization for casting from one unit system to another
@@ -384,7 +387,10 @@
{
typedef quantity<Unit1,Y> type;
- type operator()(const quantity<Unit2,X>& source) { return type(source); }
+ type operator()(const quantity<Unit2,X>& source)
+ {
+ return conversion_helper<quantity<Unit2,X>,quantity<Unit1,Y> >::convert(source);
+ }
};
/// specialization for casting to the value type
|