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>
20 template <
typename... Fns>
25 std::decay_t<Fns>...>(
LEXY_FWD(fns)...);
31 template <
typename ReturnType,
typename... Fns>
37 template <
typename Sink>
45 template <
typename... Args>
49 auto cb =
_sink.sink();
56 template <
typename Sink,
typename = lexy::sink_callback<Sink>>
65 template <
typename MemFn>
71 #define LEXY_MAKE_MEM_FN_TRAITS(...) \
72 template <typename ReturnType, typename... Args> \
73 struct _mem_fn_traits<ReturnType(Args...) __VA_ARGS__> \
75 using return_type = ReturnType; \
77 template <typename ReturnType, typename... Args> \
78 struct _mem_fn_traits<ReturnType(Args..., ...) __VA_ARGS__> \
80 using return_type = ReturnType; \
83 #define LEXY_MAKE_MEM_FN_TRAITS_CV(...) \
84 LEXY_MAKE_MEM_FN_TRAITS(__VA_ARGS__) \
85 LEXY_MAKE_MEM_FN_TRAITS(const __VA_ARGS__) \
86 LEXY_MAKE_MEM_FN_TRAITS(volatile __VA_ARGS__) \
87 LEXY_MAKE_MEM_FN_TRAITS(const volatile __VA_ARGS__)
89 #define LEXY_MAKE_MEM_FN_TRAITS_CV_REF(...) \
90 LEXY_MAKE_MEM_FN_TRAITS_CV(__VA_ARGS__) \
91 LEXY_MAKE_MEM_FN_TRAITS_CV(&__VA_ARGS__) \
92 LEXY_MAKE_MEM_FN_TRAITS_CV(&&__VA_ARGS__)
97 #undef LEXY_MAKE_MEM_FN_TRAITS_CV_REF
98 #undef LEXY_MAKE_MEM_FN_TRAITS_CV
99 #undef LEXY_MAKE_MEM_FN_TRAITS
101 template <
typename Fn>
103 template <
typename MemFn,
typename T>
110 template <
typename... Args>
119 template <
typename MemFn,
typename T>
126 #endif // LEXY_CALLBACK_ADAPTER_HPP_INCLUDED
decltype(LEXY_DECLVAL(Sink).sink(LEXY_DECLVAL(Args)...)) sink_callback
Returns the type of the .sink() function.
typename _cb::return_type return_type
constexpr bool is_callback
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)...))
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(...)