Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Struct template dim

boost::units::dim — Dimension tag/exponent pair for a single fundamental dimension.
boost::units::dim — 單個基本量綱的量綱標籤/指數對。

Synopsis

template<typename T, typename V> 
struct dim {
  // types
  typedef dim         type;      
  typedef unspecified tag;       
  typedef T           tag_type;  
  typedef V           value_type;
};

Description

The dim class represents a single dimension tag/dimension exponent pair. That is, dim<tag_type,value_type> is a pair where tag_type represents the fundamental dimension being represented and value_type represents the exponent of that fundamental dimension as a static_rational. tag_type must be a derived from a specialization of base_dimension. Specialization of the following Boost.MPL metafunctions are provided
dim類表示了一個基本量綱的標籤/指數對。dim<tag_type,value_type>是一個二元組,其中tag_type是基本量綱,value_type表示了基本量綱的指數,類似於static_rationaltag_type必須是從base_dimension的特化派生下來的。下面提供了一些Boost.MPL元函數特化

  • mpl::plus for two dims
    mpl::plus用於兩個dims

  • mpl::minus for two dims
    mpl::minus用於兩個dims

  • mpl::negate for a dim
    mpl::negate用於一個dim

These metafunctions all operate on the exponent, and require that the dim operands have the same base dimension tag. In addition, multiplication and division by static_rational is supported.
這些元函數都作用於指數,並且要求dim是相同基礎量綱的標籤。另外對於static_rational的乘除也同樣被支持。

  • mpl::times for a static_rational and a dim in either order
    mpl::times應用於static_rationaldim,順序無關

  • mpl::divides for a static_rational and a dim in either order
    mpl::divides應用于于static_rationaldim,順序無關

These metafunctions likewise operate on the exponent only.
這幾個元函數也同樣只應用於指數。


PrevUpHomeNext