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 for the latest Boost documentation.
PrevUpHomeNext

Class template base_unit

boost::units::base_unit

Synopsis

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

template<typename Derived, typename Dim, long N> 
class base_unit {
public:
  // types
  typedef Dim         dimension_type;  // The dimensions of this base unit. 
  typedef Derived     type;            // Provided for mpl compatability. 
  typedef unspecified unit_type;       // The unit corresponding to this base unit. 
};

Description

Defines a base unit. To define a unit you need to provide the derived class (CRTP), a dimension list and a unique integer.

 struct my_unit : boost::units::base_unit<my_unit, length_dimension, 1> {};

It is designed so that you will get an error message if you try to use the same value in multiple definitions.


PrevUpHomeNext