The Gaudi Framework  v30r3 (a5ef0a68)
apply.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_APPLY_H
2 #define GAUDIKERNEL_APPLY_H
3 #include <tuple>
4 
5 #if __cplusplus > 201402L
6 namespace Gaudi
7 {
8  using std::apply;
9 }
10 #else
11 
12 #include "GaudiKernel/invoke.h"
13 namespace Gaudi
14 {
15  namespace detail
16  {
17  template <class F, class Tuple, std::size_t... I>
18  constexpr decltype( auto ) apply_impl( F&& f, Tuple&& t, std::index_sequence<I...> ) noexcept(
19  noexcept( Gaudi::invoke( std::forward<F>( f ), std::get<I>( std::forward<Tuple>( t ) )... ) ) )
20  {
21  return Gaudi::invoke( std::forward<F>( f ), std::get<I>( std::forward<Tuple>( t ) )... );
22  }
23  } // namespace detail
24 
25  //
26  // implementation of std::apply -- see http://en.cppreference.com/w/cpp/utility/apply --
27  // Invokes the Callable object f with a tuple of arguments, i.e.
28  // returns f( std::get<0>(t), std::get<1>(t), ... )
29  //
30  template <class F, class Tuple>
31  constexpr decltype( auto ) apply( F&& f, Tuple&& t ) noexcept( noexcept(
32  detail::apply_impl( std::forward<F>( f ), std::forward<Tuple>( t ),
33  std::make_index_sequence<std::tuple_size<std::remove_reference_t<Tuple>>::value>{} ) ) )
34  {
35  return detail::apply_impl( std::forward<F>( f ), std::forward<Tuple>( t ),
36  std::make_index_sequence<std::tuple_size<std::remove_reference_t<Tuple>>::value>{} );
37  }
38 }
39 #endif
40 #endif
STL namespace.
decltype(auto) constexpr apply(F &&f, Tuple &&t) noexcept(noexcept( detail::apply_impl(std::forward< F >(f), std::forward< Tuple >(t), std::make_index_sequence< std::tuple_size< std::remove_reference_t< Tuple >>::value >{})))
Definition: apply.h:31
TupleObj.h GaudiAlg/TupleObj.h namespace with few technical implementations.
decltype(auto) constexpr apply_impl(F &&f, Tuple &&t, std::index_sequence< I... >) noexcept( noexcept(Gaudi::invoke(std::forward< F >(f), std::get< I >(std::forward< Tuple >(t))...)))
Definition: apply.h:18
auto invoke(F &&f, ArgTypes &&...args) noexcept(noexcept(detail2::INVOKE(std::forward< F >(f), std::forward< ArgTypes >(args)...))) -> decltype(detail2::INVOKE(std::forward< F >(f), std::forward< ArgTypes >(args)...))
Definition: invoke.h:93
Helper functions to set/get the application return code.
Definition: __init__.py:1