metaparse/doc/int_to_digit_c.qbk
2015-07-19 09:53:35 +02:00

62 lines
1.2 KiB
Plaintext

[#int_to_digit_c]
[section int_to_digit_c]
[h1 Synopsis]
namespace util
{
template <int C>
struct int_to_digit_c;
}
This is a template class similar to a [link metafunction template metafunction]
but taking an `int` value as argument.
[table Arguments
[[Name] [Type]]
[[`C`] [`int` value in the range `[0-9]`]]
]
[h1 Description]
Converts an integer value in the range `[0-9]` to a character representing that
decimal value.
[h1 Header]
#include <boost/metaparse/util/int_to_digit_c.hpp>
[h1 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'>
[h1 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"
);
[endsect]