Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

int_to_digit_c

Synopsis

namespace util
{
  template <int C>
  struct int_to_digit_c;
}

This is a template class similar to a template metafunction but taking an int value as argument.

Table 42. Arguments

Name

Type

C

int value in the range [0-9]


Description

Converts an integer value in the range [0-9] to a character representing that decimal value.

Header

#include <boost/metaparse/util/int_to_digit_c.hpp>

Expression semantics

The following pairs of expressions are equivalent

int_to_digit_c<0>::type
boost::mpl::char_<'0'>

int_to_digit<9>::type
boost::mpl::char_<'9'>

Example

#include <boost/metaparse/util/int_to_digit_c.hpp>

using namespace boost::metaparse;

static_assert(
  util::int_to_digit_c<0>::type::value == '0',
  "it should convert an integer value to the corresponding character"
);

static_assert(
  util::int_to_digit_c<3>::type::value == '3',
  "it should convert an integer to the corresponding character"
);

static_assert(
  util::int_to_digit_c<9>::type::value == '9',
  "it should convert an integer value to the corresponding character"
);

PrevUpHomeNext