• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[#get_col]
2[section get_col]
3
4[h1 Synopsis]
5
6  template <class SourcePosition>
7  struct get_col;
8
9This is a [link lazy_metafunction lazy template metafunction].
10
11[table Arguments
12  [[Name]             [Type]]
13  [[`SourcePosition`] [[link source_position source position]]]
14]
15
16[h1 Description]
17
18Returns the column of a source position.
19
20[h1 Header]
21
22  #include <boost/metaparse/get_col.hpp>
23
24[h1 Expression semantics]
25
26For any `l`, `c` compile-time wrapped integral values and `ch` compile-time
27wrapped character the following are equivalent
28
29  get_col<source_position<l, c, ch>>::type
30
31  c::type
32
33[h1 Example]
34
35  #include <boost/metaparse/get_col.hpp>
36  #include <boost/metaparse/source_position.hpp>
37
38  #include <type_traits>
39
40  using namespace boost::metaparse;
41
42  struct returns_source_position
43  {
44    using type =
45      source_position<
46        std::integral_constant<int, 11>,
47        std::integral_constant<int, 13>,
48        std::integral_constant<char, 0>
49      >;
50  };
51
52  static_assert(
53    get_col<
54      source_position<
55        std::integral_constant<int, 11>,
56        std::integral_constant<int, 13>,
57        std::integral_constant<char, 0>
58      >
59    >::type::value == 13,
60    "It should return the column of a source position"
61  );
62
63  static_assert(
64    get_col<returns_source_position>::type::value == 13,
65    "It should support lazy evaluation"
66  );
67
68[endsect]
69
70