Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Class template quantity

boost::units::quantity — class declaration

Synopsis

template<typename Unit, typename Y = double> 
class quantity {
public:
  // types
  typedef quantity< Unit, Y > this_type; 
  typedef Y                   value_type;
  typedef Unit                unit_type; 

  // construct/copy/destruct
  quantity();
  quantity(const this_type &);
  template<typename YY> 
    quantity(const quantity< Unit, YY > &, unspecified = 0);
  template<typename YY> 
    quantity(const quantity< Unit, YY > &, unspecified = 0);
  template<typename Unit2, typename YY> 
    quantity(const quantity< Unit2, YY > &, unspecified = 0);
  template<typename Unit2, typename YY> 
    quantity(const quantity< Unit2, YY > &, unspecified = 0);
  quantity(const value_type &);
  quantity& operator=(const this_type &);
  template<typename YY> quantity& operator=(const quantity< Unit, YY > &);
  template<typename Unit2, typename YY> 
    quantity& operator=(const quantity< Unit2, YY > &);

  // private member functions
   BOOST_MPL_ASSERT_NOT(unspecified) ;

  // public member functions
  const value_type & value() const;
  template<typename Unit2, typename YY> 
    this_type & operator+=(const quantity< Unit2, YY > &) ;
  template<typename Unit2, typename YY> 
    this_type & operator-=(const quantity< Unit2, YY > &) ;
  template<typename Unit2, typename YY> 
    this_type & operator*=(const quantity< Unit2, YY > &) ;
  template<typename Unit2, typename YY> 
    this_type & operator/=(const quantity< Unit2, YY > &) ;
  this_type & operator*=(const value_type &) ;
  this_type & operator/=(const value_type &) ;

  // public static functions
  static this_type from_value(const value_type &) ;
};

Description

quantity public construct/copy/destruct

  1. quantity();
  2. quantity(const this_type & source);
  3. template<typename YY> 
      quantity(const quantity< Unit, YY > & source, unspecified = 0);
  4. template<typename YY> 
      quantity(const quantity< Unit, YY > & source, unspecified = 0);
  5. template<typename Unit2, typename YY> 
      quantity(const quantity< Unit2, YY > & source, unspecified = 0);
  6. template<typename Unit2, typename YY> 
      quantity(const quantity< Unit2, YY > & source, unspecified = 0);
  7. quantity(const value_type & val);
  8. quantity& operator=(const this_type & source);
  9. template<typename YY> quantity& operator=(const quantity< Unit, YY > & source);
  10. template<typename Unit2, typename YY> 
      quantity& operator=(const quantity< Unit2, YY > & source);

quantity private member functions

  1.  BOOST_MPL_ASSERT_NOT(unspecified) ;

quantity public member functions

  1. const value_type & value() const;

    can add a quantity of the same type if add_typeof_helper<value_type,value_type>::type is convertible to value_type

  2. template<typename Unit2, typename YY> 
      this_type & operator+=(const quantity< Unit2, YY > & source) ;
  3. template<typename Unit2, typename YY> 
      this_type & operator-=(const quantity< Unit2, YY > & source) ;
  4. template<typename Unit2, typename YY> 
      this_type & operator*=(const quantity< Unit2, YY > & source) ;
  5. template<typename Unit2, typename YY> 
      this_type & operator/=(const quantity< Unit2, YY > & source) ;
  6. this_type & operator*=(const value_type & source) ;
  7. this_type & operator/=(const value_type & source) ;

quantity public static functions

  1. static this_type from_value(const value_type & val) ;
    value_type

PrevUpHomeNext