2.10.0
Freundlich's C++ toolkit
Typedefs | Functions
fcppt.container.tuple

Description

Functions for std::tuple

Typedefs

template<typename Tuple , typename Function >
using fcppt::container::tuple::map_result = typename fcppt::container::tuple::detail::map_result< std::make_index_sequence< std::tuple_size< fcppt::type_traits::remove_cv_ref_t< Tuple > >::value >, Tuple, fcppt::type_traits::remove_cv_ref_t< Function > >::type
 The result type of fcppt::container::tuple::map. More...
 
template<typename Tuple , std::size_t Index>
using fcppt::container::tuple::move_element = std::integral_constant< bool, fcppt::not_(std::is_lvalue_reference< Tuple >::value||std::is_lvalue_reference< fcppt::container::tuple::type_at< fcppt::type_traits::remove_cv_ref_t< Tuple >, Index > >::value)||std::is_rvalue_reference< fcppt::container::tuple::type_at< fcppt::type_traits::remove_cv_ref_t< Tuple >, Index > >::value >
 If a tuple element should be moved. More...
 
template<typename Tuple , typename NewElement >
using fcppt::container::tuple::push_back_result = typename fcppt::container::tuple::detail::push_back_result< Tuple, NewElement >::type
 The result type of fcppt::container::tuple::push_back. More...
 
template<typename Tuple , std::size_t Index>
using fcppt::container::tuple::type_at = ::brigand::at_c< fcppt::container::tuple::types_of< Tuple >, fcppt::cast::size< unsigned int >(Index) >
 The type of the tuple element at a given position. More...
 
template<typename Tuple >
using fcppt::container::tuple::types_of = typename fcppt::container::tuple::detail::types_of< Tuple >::type
 The types of a tuple as a brigand sequence. More...
 

Functions

template<typename Tuple , typename Function >
fcppt::container::tuple::map_result< Tuple, Function > fcppt::container::tuple::map (Tuple &&_tuple, Function const &_function)
 Maps over a tuple. More...
 
template<typename Tuple , typename NewElement >
fcppt::container::tuple::push_back_result< fcppt::type_traits::remove_cv_ref_t< Tuple >, fcppt::type_traits::remove_cv_ref_t< NewElement >> fcppt::container::tuple::push_back (Tuple &&_tuple, NewElement &&_new_element)
 Pushes an element to the back of a std::tuple. More...
 
template<typename Tuple , typename Function >
decltype(auto) FCPPT_PP_PUSH_WARNING fcppt::container::tuple::to_varargs (Tuple &&_tuple, Function const &_function)
 Passes tuple elements as variadic parameters to a function. More...
 
template<typename Tuple , typename AnchorFunction , typename ElementFunction >
decltype(auto) fcppt::container::tuple::vararg_map (Tuple &&_tuple, AnchorFunction const &_anchor_function, ElementFunction const &_element_function)
 Combination of fcppt::container::tuple::map and fcppt::container::tuple::to_varargs. More...
 

Typedef Documentation

◆ map_result

template<typename Tuple , typename Function >
using fcppt::container::tuple::map_result = typedef typename fcppt::container::tuple::detail::map_result< std::make_index_sequence< std::tuple_size< fcppt::type_traits::remove_cv_ref_t< Tuple > >::value >, Tuple, fcppt::type_traits::remove_cv_ref_t< Function > >::type

The result type of fcppt::container::tuple::map.

◆ move_element

template<typename Tuple , std::size_t Index>
using fcppt::container::tuple::move_element = typedef std::integral_constant< bool, fcppt::not_( std::is_lvalue_reference< Tuple >::value || std::is_lvalue_reference< fcppt::container::tuple::type_at< fcppt::type_traits::remove_cv_ref_t< Tuple >, Index > >::value ) || std::is_rvalue_reference< fcppt::container::tuple::type_at< fcppt::type_traits::remove_cv_ref_t< Tuple >, Index > >::value >

If a tuple element should be moved.

In fcppt, an element of a struct is moved if and only if the struct itself is not an lvalue reference. For tuples, however, the situation is slighly more complicated. Tuples can be used to perfectly forward arguments using std::forward_as_tuple, which actually stores lvalue or rvalue references in a tuple.

Template Parameters
TupleMust be a std::tuple.

◆ push_back_result

template<typename Tuple , typename NewElement >
using fcppt::container::tuple::push_back_result = typedef typename fcppt::container::tuple::detail::push_back_result< Tuple, NewElement >::type

◆ type_at

template<typename Tuple , std::size_t Index>
using fcppt::container::tuple::type_at = typedef ::brigand::at_c< fcppt::container::tuple::types_of< Tuple >, fcppt::cast::size< unsigned int >( Index ) >

The type of the tuple element at a given position.

Template Parameters
TupleMust be a std::tuple.

◆ types_of

template<typename Tuple >
using fcppt::container::tuple::types_of = typedef typename fcppt::container::tuple::detail::types_of< Tuple >::type

The types of a tuple as a brigand sequence.

Template Parameters
TupleMust be a std::tuple.

Function Documentation

◆ map()

template<typename Tuple , typename Function >
fcppt::container::tuple::map_result< Tuple, Function> fcppt::container::tuple::map ( Tuple &&  _tuple,
Function const &  _function 
)
inline

Maps over a tuple.

Let _tuple be (v_1,...,v_n). The result of the function is the tuple (_function(v_1),...,_function(v_n)).

Template Parameters
TupleMust be a std::tuple.
FunctionMust be callable with every type in Tuple.

◆ push_back()

template<typename Tuple , typename NewElement >
fcppt::container::tuple::push_back_result< fcppt::type_traits::remove_cv_ref_t< Tuple >, fcppt::type_traits::remove_cv_ref_t< NewElement >> fcppt::container::tuple::push_back ( Tuple &&  _tuple,
NewElement &&  _new_element 
)

Pushes an element to the back of a std::tuple.

Let _tuple be (v_1,...,v_n). The result of the function is (v_1,...,v_n,_new_element).

Template Parameters
TupleMust be a std::tuple.

◆ to_varargs()

template<typename Tuple , typename Function >
decltype( auto ) FCPPT_PP_PUSH_WARNING fcppt::container::tuple::to_varargs ( Tuple &&  _tuple,
Function const &  _function 
)
inline

Passes tuple elements as variadic parameters to a function.

For _tuple = (x_1,...,x_n), _function(x_1,...,_x_n) is returned.

Template Parameters
TupleMust be a std::tuple.
FunctionA function callable as R (T_1,...,T_n), where Tuple=(T_1,...,T_n) and R is the result type.

◆ vararg_map()

template<typename Tuple , typename AnchorFunction , typename ElementFunction >
decltype( auto ) fcppt::container::tuple::vararg_map ( Tuple &&  _tuple,
AnchorFunction const &  _anchor_function,
ElementFunction const &  _element_function 
)
inline

Combination of fcppt::container::tuple::map and fcppt::container::tuple::to_varargs.

Template Parameters
TupleMust be a std::tuple.