Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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  using std::apply;
8 }
9 #else
10 
11 # include "GaudiKernel/invoke.h"
12 namespace Gaudi {
13  namespace detail {
14  template <class F, class Tuple, std::size_t... I>
15  constexpr decltype( auto ) apply_impl( F&& f, Tuple&& t, std::index_sequence<I...> ) noexcept(
16  noexcept( Gaudi::invoke( std::forward<F>( f ), std::get<I>( std::forward<Tuple>( t ) )... ) ) ) {
17  return Gaudi::invoke( std::forward<F>( f ), std::get<I>( std::forward<Tuple>( t ) )... );
18  }
19  } // namespace detail
20 
21  //
22  // implementation of std::apply -- see http://en.cppreference.com/w/cpp/utility/apply --
23  // Invokes the Callable object f with a tuple of arguments, i.e.
24  // returns f( std::get<0>(t), std::get<1>(t), ... )
25  //
26  template <class F, class Tuple>
27  constexpr decltype( auto ) apply( F&& f, Tuple&& t ) noexcept( noexcept(
28  detail::apply_impl( std::forward<F>( f ), std::forward<Tuple>( t ),
29  std::make_index_sequence<std::tuple_size<std::remove_reference_t<Tuple>>::value>{} ) ) ) {
30  return detail::apply_impl( std::forward<F>( f ), std::forward<Tuple>( t ),
31  std::make_index_sequence<std::tuple_size<std::remove_reference_t<Tuple>>::value>{} );
32  }
33 } // namespace Gaudi
34 #endif
35 #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:27
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:15
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:82
Helper functions to set/get the application return code.
Definition: __init__.py:1