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