Go to the documentation of this file.
4 #ifndef LEXY_CALLBACK_ADAPTER_HPP_INCLUDED
5 #define LEXY_CALLBACK_ADAPTER_HPP_INCLUDED
11 template <
typename ReturnType,
typename... Fns>
19 template <
typename ReturnType,
typename... Fns>
24 template <
typename State>
30 template <
typename... Args>
39 template <
typename State>
47 template <
typename... Fns>
52 std::decay_t<Fns>...>(
LEXY_FWD(fns)...);
56 template <
typename ReturnType,
typename... Fns>
63 template <
typename... Fns>
68 std::decay_t<Fns>...>(
LEXY_FWD(fns)...);
72 template <
typename ReturnType,
typename... Fns>
78 template <
typename Sink>
86 template <
typename... Args>
90 auto cb =
_sink.sink();
97 template <
typename Sink,
typename = lexy::sink_callback<Sink>>
106 template <
typename MemFn>
112 #define LEXY_MAKE_MEM_FN_TRAITS(...) \
113 template <typename ReturnType, typename... Args> \
114 struct _mem_fn_traits<ReturnType(Args...) __VA_ARGS__> \
116 using return_type = ReturnType; \
118 template <typename ReturnType, typename... Args> \
119 struct _mem_fn_traits<ReturnType(Args..., ...) __VA_ARGS__> \
121 using return_type = ReturnType; \
124 #define LEXY_MAKE_MEM_FN_TRAITS_CV(...) \
125 LEXY_MAKE_MEM_FN_TRAITS(__VA_ARGS__) \
126 LEXY_MAKE_MEM_FN_TRAITS(const __VA_ARGS__) \
127 LEXY_MAKE_MEM_FN_TRAITS(volatile __VA_ARGS__) \
128 LEXY_MAKE_MEM_FN_TRAITS(const volatile __VA_ARGS__)
130 #define LEXY_MAKE_MEM_FN_TRAITS_CV_REF(...) \
131 LEXY_MAKE_MEM_FN_TRAITS_CV(__VA_ARGS__) \
132 LEXY_MAKE_MEM_FN_TRAITS_CV(&__VA_ARGS__) \
133 LEXY_MAKE_MEM_FN_TRAITS_CV(&&__VA_ARGS__)
138 #undef LEXY_MAKE_MEM_FN_TRAITS_CV_REF
139 #undef LEXY_MAKE_MEM_FN_TRAITS_CV
140 #undef LEXY_MAKE_MEM_FN_TRAITS
142 template <
typename Fn>
144 template <
typename MemFn,
typename T>
151 template <
typename... Args>
160 template <
typename MemFn,
typename T>
167 #endif // LEXY_CALLBACK_ADAPTER_HPP_INCLUDED
decltype(LEXY_DECLVAL(Sink).sink(LEXY_DECLVAL(Args)...)) sink_callback
Returns the type of the .sink() function.
constexpr auto callback_with_state(Fns &&... fns)
Creates a callback that also receives the parse state.
typename _cb::return_type return_type
constexpr bool is_callback
constexpr _callback_with_state(Fns... fns)
constexpr auto operator()(Args &&... args) const -> decltype((LEXY_DECLVAL(_cb &)(LEXY_FWD(args)),..., LEXY_DECLVAL(_cb &&).finish()))
constexpr auto callback(Fns &&... fns)
Creates a callback.
#define LEXY_MAKE_MEM_FN_TRAITS_CV_REF(...)
constexpr auto operator()(Args &&... args) const -> decltype(_detail::_mem_invoker< MemFn T::* >::invoke(_fn, LEXY_FWD(args)...))
const _callback_with_state & _cb
constexpr auto mem_fn(MemFn T::*fn)
Creates a callback from a member function.
constexpr auto invoke(F ClassT::*f, Args &&... args) -> decltype(_mem_invoker< F ClassT::* >::invoke(f, LEXY_FWD(args)...))
constexpr _callback(Fns... fns)
typename _mem_fn_traits< MemFn >::return_type return_type
lexy::sink_callback< Sink > _cb
#define LEXY_DECLVAL(...)
constexpr return_type operator()(Args &&... args) const &&
constexpr auto operator[](State &state) const