71 lines
1.4 KiB
Plaintext
71 lines
1.4 KiB
Plaintext
[#get_line]
|
|
[section get_line]
|
|
|
|
[h1 Synopsis]
|
|
|
|
template <class SourcePosition>
|
|
struct get_line;
|
|
|
|
This is a [link lazy_metafunction lazy template metafunction].
|
|
|
|
[table Arguments
|
|
[[Name] [Type]]
|
|
[[`SourcePosition`] [[link source_position source position]]]
|
|
]
|
|
|
|
[h1 Description]
|
|
|
|
Returns the line of a source position.
|
|
|
|
[h1 Header]
|
|
|
|
#include <boost/metaparse/get_line.hpp>
|
|
|
|
[h1 Expression semantics]
|
|
|
|
For any `l`, `c` compile-time wrapped integral values and `ch` compile-time
|
|
wrapped character the following are equivalent
|
|
|
|
get_line<source_position<l, c, ch>>::type
|
|
|
|
l::type
|
|
|
|
[h1 Example]
|
|
|
|
#include <boost/metaparse/get_line.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_line<
|
|
source_position<
|
|
std::integral_constant<int, 11>,
|
|
std::integral_constant<int, 13>,
|
|
std::integral_constant<char, 0>
|
|
>
|
|
>::type::value == 11,
|
|
"It should return the line of a source position"
|
|
);
|
|
|
|
static_assert(
|
|
get_line<returns_source_position>::type::value == 11,
|
|
"It should support lazy evaluation"
|
|
);
|
|
|
|
|
|
[endsect]
|
|
|