Go to the documentation of this file.
4 #ifndef LEXY_CALLBACK_COMPOSITION_HPP_INCLUDED
5 #define LEXY_CALLBACK_COMPOSITION_HPP_INCLUDED
11 template <
typename Cb,
typename State,
typename =
void>
19 template <
typename... Args>
25 template <
typename Cb,
typename State>
33 template <
typename... Args>
40 template <
typename First,
typename Second>
46 constexpr
explicit _compose_cb(First&& first, Second&& second)
52 template <
typename State,
53 typename = std::enable_if_t<lexy::is_callback_state<First, State>
54 || lexy::is_callback_state<Second, State>>>
62 template <
typename... Args>
70 template <
typename Sink,
typename Callback>
78 template <
typename... Args>
84 template <
typename State,
typename = std::enable_if_t<lexy::is_callback_state<Callback, State>>>
90 template <
typename... Args>
98 template <
typename First,
typename Second,
typename = _detect_callback<First>,
99 typename = _detect_callback<Second>>
104 template <
typename S,
typename Cb,
typename Second>
112 template <
typename Sink,
typename Callback,
typename = _detect_callback<Callback>>
119 #endif // LEXY_CALLBACK_COMPOSITION_HPP_INCLUDED
constexpr auto operator[](State &state) const
constexpr auto operator()(Args &&... args) const -> decltype(_cb(LEXY_FWD(args)...))
constexpr auto operator()(Args &&... args) const -> decltype(_cb[_state](LEXY_FWD(args)...))
typename Cb::return_type return_type
constexpr auto operator|(First first, Second second)
Composes two callbacks.
typename Callback::return_type return_type
constexpr auto sink(Args &&... args) const -> decltype(_sink.sink(LEXY_FWD(args)...))
LEXY_EMPTY_MEMBER First _first
constexpr auto operator()(Args &&... args) const -> LEXY_DECAY_DECLTYPE(_first(LEXY_FWD(args)...), LEXY_DECLVAL(return_type))
constexpr auto operator()(Args &&... args) const -> decltype(_callback(LEXY_FWD(args)...))
#define LEXY_DECAY_DECLTYPE(...)
constexpr _compose_cb(First &&first, Second &&second)
constexpr auto operator[](State &state) const
LEXY_EMPTY_MEMBER Sink _sink
LEXY_EMPTY_MEMBER Second _second
constexpr auto operator>>(Sink sink, Callback cb)
Composes a sink with a callback.
typename Cb::return_type return_type
#define LEXY_EMPTY_MEMBER
LEXY_EMPTY_MEMBER Callback _callback
#define LEXY_DECLVAL(...)
typename Second::return_type return_type
typename std::enable_if< B, T >::type enable_if_t