| Home | Libraries | People | FAQ | More

## Class template quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System), Y>

boost::units::quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System), Y>

## Synopsis

    // In header: <boost/units/quantity.hpp>

    template<typename System, typename Y>
    class quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System), Y> {
    public:
      // types
      typedef quantity< unit< dimensionless_type, System >, Y > this_type;
      typedef Y                                                 value_type;
      typedef System                                            system_type;
      typedef dimensionless_type                                dimension_type;
      typedef unit< dimension_type, system_type >               unit_type;

      // construct/copy/destruct
      quantity& operator=(const this_type &);
      template<typename YY>
        quantity& operator=(const quantity< unit< dimension_type, system_type >, YY > &);
      template<typename System2>
        quantity& operator=(const quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(System2), Y > &);

      // public member functions
       quantity() ;
       quantity(value_type) ;
       quantity(const this_type &) ;
      template<typename YY>
         quantity(const quantity< unit< dimension_type, system_type >, YY > &,
                  unspecified = 0) ;
      template<typename YY>
         quantity(const quantity< unit< dimension_type, system_type >, YY > &,
                  unspecified = 0) ;
      template<typename System2, typename Y2>
         quantity(const quantity< unit< dimensionless_type, System2 >, Y2 > &,
                  unspecified = 0, unspecified = 0, unspecified = 0) ;
      template<typename System2, typename Y2>
         quantity(const quantity< unit< dimensionless_type, System2 >, Y2 > &,
                  unspecified = 0, unspecified = 0, unspecified = 0) ;
      template<typename System2, typename Y2>
         quantity(const quantity< unit< dimensionless_type, System2 >, Y2 > &,
                  unspecified = 0) ;
      operator value_type() const;
      const value_type & value() const;
      this_type & operator+=(const this_type &) ;
      this_type & operator-=(const this_type &) ;
      this_type & operator*=(const value_type &) ;
      this_type & operator/=(const value_type &) ;

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

## Description

Specialization for dimensionless quantities. Implicit conversions between unit systems are allowed because all dimensionless quantities are equivalent. Implicit construction and assignment from and conversion to `value_type` is also allowed.

### `quantity` public construct/copy/destruct

1.     quantity& operator=(const this_type & source);

2.     template<typename YY>
         quantity& operator=(const quantity< unit< dimension_type, system_type >, YY > & source);

3.     template<typename System2>
         quantity& operator=(const quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(System2), Y > & source);

### `quantity` public member functions

1.      quantity() ;

2.      quantity(value_type val) ;

   `value_type`

3.      quantity(const this_type & source) ;

4.     template<typename YY>
          quantity(const quantity< unit< dimension_type, system_type >, YY > & source,
                   unspecified = 0) ;

5.     template<typename YY>
          quantity(const quantity< unit< dimension_type, system_type >, YY > & source,
                   unspecified = 0) ;

6.     template<typename System2, typename Y2>
          quantity(const quantity< unit< dimensionless_type, System2 >, Y2 > & source,
                   unspecified = 0, unspecified = 0, unspecified = 0) ;

7.     template<typename System2, typename Y2>
          quantity(const quantity< unit< dimensionless_type, System2 >, Y2 > & source,
                   unspecified = 0, unspecified = 0, unspecified = 0) ;

8.     template<typename System2, typename Y2>
          quantity(const quantity< unit< dimensionless_type, System2 >, Y2 > & source,
                   unspecified = 0) ;

   conversion between different unit systems is explicit when the units are not equivalent.

9.     operator value_type() const;

   `value_type`

10.     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

11.     this_type & operator+=(const this_type & source) ;

12.     this_type & operator-=(const this_type & source) ;

13.     this_type & operator*=(const value_type & val) ;

14.     this_type & operator/=(const value_type & val) ;

### `quantity` public static functions

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

   `value_type`