15 #ifndef ROOT7_Impl_Tuple_Apply 16 #define ROOT7_Impl_Tuple_Apply 18 #include "RConfigure.h" 25 #ifndef R__HAS_STD_INVOKE 28 template <
class F,
class... Args>
30 decltype(std::forward<F>(
f)(std::forward<Args>(args)...)) {
31 return std::forward<F>(
f)(std::forward<Args>(args)...);
34 template <
class Base,
class T,
class Derived>
35 inline auto INVOKE(
T Base::*pmd, Derived&& ref) ->
36 decltype(std::forward<Derived>(ref).*pmd) {
37 return std::forward<Derived>(ref).*pmd;
40 template <
class PMD,
class Po
inter>
41 inline auto INVOKE(PMD pmd, Pointer&& ptr) ->
42 decltype((*std::forward<Pointer>(ptr)).*pmd) {
43 return (*std::forward<Pointer>(ptr)).*pmd;
46 template <
class Base,
class T,
class Derived,
class... Args>
47 inline auto INVOKE(T Base::*pmf, Derived&& ref, Args&&... args) ->
48 decltype((std::forward<Derived>(ref).*pmf)(std::forward<Args>(args)...)) {
49 return (std::forward<Derived>(ref).*pmf)(std::forward<Args>(args)...);
52 template <
class PMF,
class Pointer,
class... Args>
53 inline auto INVOKE(PMF pmf, Pointer&& ptr, Args&&... args) ->
54 decltype(((*std::forward<Pointer>(ptr)).*pmf)(std::forward<Args>(args)...)) {
55 return ((*std::forward<Pointer>(ptr)).*pmf)(std::forward<Args>(args)...);
61 inline namespace __ROOT {
63 template<
class F,
class... ArgTypes>
64 decltype(
auto)
invoke(
F&&
f, ArgTypes&&... args) {
70 #endif // ndef R__HAS_STD_INVOKE 72 #ifndef R__HAS_STD_APPLY 76 template<
class F,
class Tuple, std::size_t...
I>
78 std::index_sequence<
I...>) {
80 std::get<I>(std::forward<Tuple>(t))...);
87 inline namespace __ROOT {
88 template<
class F,
class Tuple>
89 constexpr decltype(
auto)
apply(
F &&
f, Tuple &&t) {
92 std::decay_t < Tuple >> {} > {});
96 #endif // ndef R__HAS_STD_APPLY 98 #endif //ROOT7_TUPLE_APPLY_H Namespace for new ROOT classes and functions.
auto INVOKE(F &&f, Args &&... args) -> decltype(std::forward< F >(f)(std::forward< Args >(args)...))
decltype(auto) constexpr apply_impl(F &&f, Tuple &&t, std::index_sequence< I... >)
decltype(auto) invoke(F &&f, ArgTypes &&... args)
make_integer_sequence< size_t, _Np > make_index_sequence
decltype(auto) constexpr apply(F &&f, Tuple &&t)