get_col.qbk 1.4 KB

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