Class constant
Synopsis
#include "breeze/meta/constant.hpp"
template< typename T, T v >
class constant
Description
Wrapper for (integral) constant expressions.
This template is a fundamental building block for our meta-programming facilities, which date from when C++ didn't have constexpr
. So, it wraps a constant into a type.
- Type requirements
- T must be a type suitable for declaring an integral constant expression or a const-qualified version of such a type (e.g.
int const
). - Naming rationale
- Though at the time of writing (September 2006) only constants of integral and enumeration type are allowed in C++, we chose a name which doesn't mention either families of types, in order to eventually accommodate, for instance, floating point types as well, if ever allowed by the standard.
Source
Lines 43-59 in breeze/meta/constant.hpp.
template< typename T, T v >
class constant
{
public:
//! A typedef for the type \c T.
// -----------------------------------------------------------------------
typedef T value_type ;
//! The same as \c constant< T, v >.
// -----------------------------------------------------------------------
typedef constant type ;
//! The result of the metafunction.
// -----------------------------------------------------------------------
static value_type const
value = v ;
} ;