Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

get_col

Synopsis

template <class SourcePosition>
struct get_col;

This is a lazy template metafunction.

Table 31. Arguments

Name

Type

SourcePosition

source position


Description

Returns the column of a source position.

Header

#include <boost/metaparse/get_col.hpp>

Expression semantics

For any l, c compile-time wrapped integral values and ch compile-time wrapped character the following are equivalent

get_col<source_position<l, c, ch>>::type

c::type

Example

#include <boost/metaparse/get_col.hpp>
#include <boost/metaparse/source_position.hpp>

#include <type_traits>

using namespace boost::metaparse;

struct returns_source_position
{
  using type =
    source_position<
      std::integral_constant<int, 11>,
      std::integral_constant<int, 13>,
      std::integral_constant<char, 0>
    >;
};

static_assert(
  get_col<
    source_position<
      std::integral_constant<int, 11>,
      std::integral_constant<int, 13>,
      std::integral_constant<char, 0>
    >
  >::type::value == 13,
  "It should return the column of a source position"
);

static_assert(
  get_col<returns_source_position>::type::value == 13,
  "It should support lazy evaluation"
);

PrevUpHomeNext