| Home | Libraries | People | FAQ | More

## Struct template conversion_helper

boost::units::conversion_helper

## Synopsis

    template<typename From, typename To>
    struct conversion_helper {

      // public static functions
      static To convert(const From &) ;
    };

## Description

Template for defining conversions between quantities. This template should be specialized for every quantity that allows conversions. For example, if you have a two units called pair and dozen you would write

     namespace boost {
     namespace units {
     template<class T0, class T1>
     struct conversion_helper<quantity<dozen, T0>, quantity<pair, T1> >
     {
         static quantity<pair, T1> convert(const quantity<dozen, T0>& source)
         {
             return(quantity<pair, T1>::from_value(6 * source.value()));
         }
     };
     }
     }

### `conversion_helper` public static functions

1.     static To convert(const From &) ;