Update of /cvsroot/boost-sandbox/boost-sandbox/boost/units
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16315
Modified Files:
measurement.hpp quantity.hpp
Log Message:
minor update
Index: measurement.hpp
===================================================================
RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/measurement.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- measurement.hpp 2 Apr 2007 23:26:24 -0000 1.5
+++ measurement.hpp 3 Apr 2007 14:54:27 -0000 1.6
@@ -37,8 +37,9 @@
class measurement
{
public:
- typedef measurement<Y> this_type;
- typedef Y value_type;
+ typedef measurement<Y> this_type;
+ typedef Y value_type;
+ typedef numeric::interval<value_type> interval_type;
measurement(const value_type& val = value_type(),
const value_type& err = value_type()) :
@@ -70,7 +71,7 @@
value_type lower_bound() const { return value_-uncertainty_; }
value_type upper_bound() const { return value_+uncertainty_; }
- interval<value_type> get_interval() const { return interval<value_type>(lower_bound(),upper_bound()); }
+ interval_type get_interval() const { return interval_type(lower_bound(),upper_bound()); }
this_type& operator+=(const value_type& val)
{
Index: quantity.hpp
===================================================================
RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/units/quantity.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- quantity.hpp 29 Mar 2007 22:43:48 -0000 1.9
+++ quantity.hpp 3 Apr 2007 14:54:27 -0000 1.10
@@ -261,83 +261,6 @@
return const_cast<Y&>(q.value());
}
-/// swap quantities
-template<class Unit,class Y>
-inline void swap(quantity<Unit,Y>& lhs, quantity<Unit,Y>& rhs)
-{
- using std::swap;
- swap(quantity_reinterpret_cast<Y&>(lhs),quantity_reinterpret_cast<Y&>(rhs));
-}
-
-/// utility class to simplify construction of dimensionless quantities
-template<class System,class Y>
-struct dimensionless_quantity
-{
- typedef quantity<typename dimensionless_unit<System>::type,Y> type;
-};
-
-/// check that a type is a quantity
-template<typename T>
-struct is_quantity :
- public mpl::false_
-{ };
-
-template<class Unit,
- class Y>
-struct is_quantity< quantity<Unit,Y> > :
- public mpl::true_
-{ };
-
-/// check that a type is a quantity in a specified system
-template<class T,class System>
-struct is_quantity_of_system :
- public mpl::false_
-{ };
-
-template<class Dim,
- class System,
- class Y>
-struct is_quantity_of_system< quantity< unit<Dim,System>,Y>,System > :
- public mpl::true_
-{ };
-
-/// check that a type is a quantity of the specified dimension
-template<class T,class Dim>
-struct is_quantity_of_dimension :
- public mpl::false_
-{ };
-
-template<class Dim,class System,class Y>
-struct is_quantity_of_dimension< quantity< unit<Dim,System>,Y>,Dim > :
- public mpl::true_
-{ };
-
-/// check that a type is dimensionless
-template<class System,class Y>
-struct is_dimensionless< quantity<unit<dimensionless_type,System>,Y> > :
- public mpl::true_
-{ };
-
-/// check that a type is a dimensionless quantity
-template<class T>
-struct is_dimensionless_quantity :
- public is_quantity_of_dimension<T,dimensionless_type>
-{ };
-
-/// get dimension
-template<class Unit,class Y>
-struct get_dimension< quantity<Unit,Y> >
-{
- typedef typename get_dimension<Unit>::type type;
-};
-
-/// get system
-template<class Unit,class Y>
-struct get_system< quantity<Unit,Y> >
-{
- typedef typename get_system<Unit>::type type;
-};
-
/// helper class for quantity_cast
template<class X,class Y> struct quantity_cast_helper;
@@ -427,6 +350,7 @@
return qch(source);
}
+
template<class X,class Y>
inline
typename quantity_cast_helper<X,const Y>::type
@@ -437,6 +361,83 @@
return qch(source);
}
+/// swap quantities
+template<class Unit,class Y>
+inline void swap(quantity<Unit,Y>& lhs, quantity<Unit,Y>& rhs)
+{
+ using std::swap;
+ swap(quantity_reinterpret_cast<Y&>(lhs),quantity_reinterpret_cast<Y&>(rhs));
+}
+
+/// utility class to simplify construction of dimensionless quantities
+template<class System,class Y>
+struct dimensionless_quantity
+{
+ typedef quantity<typename dimensionless_unit<System>::type,Y> type;
+};
+
+/// check that a type is a quantity
+template<typename T>
+struct is_quantity :
+ public mpl::false_
+{ };
+
+template<class Unit,
+ class Y>
+struct is_quantity< quantity<Unit,Y> > :
+ public mpl::true_
+{ };
+
+/// check that a type is a quantity in a specified system
+template<class T,class System>
+struct is_quantity_of_system :
+ public mpl::false_
+{ };
+
+template<class Dim,
+ class System,
+ class Y>
+struct is_quantity_of_system< quantity< unit<Dim,System>,Y>,System > :
+ public mpl::true_
+{ };
+
+/// check that a type is a quantity of the specified dimension
+template<class T,class Dim>
+struct is_quantity_of_dimension :
+ public mpl::false_
+{ };
+
+template<class Dim,class System,class Y>
+struct is_quantity_of_dimension< quantity< unit<Dim,System>,Y>,Dim > :
+ public mpl::true_
+{ };
+
+/// check that a type is dimensionless
+template<class System,class Y>
+struct is_dimensionless< quantity<unit<dimensionless_type,System>,Y> > :
+ public mpl::true_
+{ };
+
+/// check that a type is a dimensionless quantity
+template<class T>
+struct is_dimensionless_quantity :
+ public is_quantity_of_dimension<T,dimensionless_type>
+{ };
+
+/// get dimension
+template<class Unit,class Y>
+struct get_dimension< quantity<Unit,Y> >
+{
+ typedef typename get_dimension<Unit>::type type;
+};
+
+/// get system
+template<class Unit,class Y>
+struct get_system< quantity<Unit,Y> >
+{
+ typedef typename get_system<Unit>::type type;
+};
+
/// specialize unary plus typeof helper
template<class Unit,class Y>
struct unary_plus_typeof_helper< quantity<Unit,Y> >
|