4.6.0
Freundlich's C++ toolkit
|
Like std::tuple but with a proper constructor.
Classes | |
class | fcppt::tuple::object< Types > |
Like std::tuple but with a proper constructor. More... | |
Typedefs | |
template<typename Function , typename... Tuples> | |
using | fcppt::tuple::apply_result |
Result of fcppt::tuple::apply. | |
template<std::size_t I, typename T , typename = fcppt::tuple::is_object<T>> | |
using | fcppt::tuple::element = std::tuple_element_t<I, fcppt::tuple::impl_type<T>> |
The type of the I'th element of a tuple. | |
template<typename Array , typename = std::enable_if_t<fcppt::array::is_object<Array>::value>> | |
using | fcppt::tuple::from_array_result |
Result of fcppt::tuple::from_array. | |
template<typename T > | |
using | fcppt::tuple::is_object = typename fcppt::tuple::detail::is_object<T>::type |
Tests whether a type is a tuple. | |
template<typename Tuple , typename Function > | |
using | fcppt::tuple::map_result |
The result type of fcppt::tuple::map. | |
template<typename Tuple , typename NewElement > | |
using | fcppt::tuple::push_back_result |
The result type of fcppt::tuple::push_back. | |
template<typename T , typename = std::enable_if_t<fcppt::tuple::is_object<T>::value>> | |
using | fcppt::tuple::types_of = typename fcppt::tuple::detail::types_of<T>::type |
The types of a tuple as an mpl::list . | |
Functions | |
template<typename Function , typename... Tuples> | |
fcppt::tuple::apply_result< Function, Tuples... > | fcppt::tuple::apply (Function const &_function, Tuples &&..._tuples) |
Applies a function to each tuple of elements of multiple tuples and returns a tuple containing the results. | |
template<typename Result , typename Tuple > requires (fcppt::tuple::is_object<std::remove_cvref_t<Tuple>>::value) | |
constexpr Result | fcppt::tuple::as_struct (Tuple &&_tuple) |
Converts a tuple to a struct. | |
template<typename... Types> | |
bool | fcppt::tuple::operator== (fcppt::tuple::object< Types... > const &a, fcppt::tuple::object< Types... > const &b) |
Compares two tuples for equality. | |
template<typename... Tuples> requires (std::conjunction_v<fcppt::tuple::is_object<Tuples>...>) | |
decltype(auto) | fcppt::tuple::concat (Tuples &&..._tuples) |
Concatenates multiple tuples. | |
template<typename Array > requires (fcppt::array::is_object<std::remove_cvref_t<Array>>::value) | |
fcppt::tuple::from_array_result< std::remove_cvref_t< Array > > | fcppt::tuple::from_array (Array &&_source) |
Converts an fcppt::array::object to an fcppt::tuple::object. | |
template<std::size_t I, typename... Types> requires (std::less<>{}(I, sizeof...(Types))) | |
constexpr fcppt::tuple::element< I, fcppt::tuple::object< Types... > > & | fcppt::tuple::get (fcppt::tuple::object< Types... > &_value) noexcept |
Returns the I'th element of a nonconst tuple. | |
template<std::size_t I, typename... Types> requires (std::less<>{}(I, sizeof...(Types))) | |
constexpr fcppt::tuple::element< I, fcppt::tuple::object< Types... > > const & | fcppt::tuple::get (fcppt::tuple::object< Types... > const &_value) noexcept |
Returns the I'th element of a const tuple. | |
template<typename Tuple , typename Function > requires (fcppt::tuple::is_object<Tuple>::value) | |
Tuple | fcppt::tuple::init (Function const &_function) |
Constructs a tuple by calling a function with static indices. | |
template<typename F , typename Tuple > requires (std::conjunction_v< fcppt::tuple::is_object<std::remove_cvref_t<Tuple>>, fcppt::mpl::is_invocable<F, fcppt::tuple::types_of<std::remove_cvref_t<Tuple>>>>) | |
constexpr decltype(auto) | fcppt::tuple::invoke (F const &_f, Tuple &&_tuple) |
Calls a function with the elements of a tuple. | |
template<typename Tuple , typename Function > requires (fcppt::tuple::is_object<std::remove_cvref_t<Tuple>>::value) | |
fcppt::tuple::map_result< Tuple, Function > | fcppt::tuple::map (Tuple &&_tuple, Function const &_function) |
Maps over a tuple. | |
template<typename Ch , typename Traits , typename... Types> | |
std::basic_ostream< Ch, Traits > & | fcppt::tuple::operator<< (std::basic_ostream< Ch, Traits > &_stream, fcppt::tuple::object< Types... > const &_tuple) |
Outputs a tuple to a stream. | |
template<typename Tuple , typename NewElement > | |
fcppt::tuple::push_back_result< std::remove_cvref_t< Tuple >, std::remove_cvref_t< NewElement > > | fcppt::tuple::push_back (Tuple &&_tuple, NewElement &&_new_element) |
Pushes an element to the back of a fcppt::tuple::object . | |
using fcppt::tuple::apply_result |
Result of fcppt::tuple::apply.
using fcppt::tuple::element = std::tuple_element_t<I, fcppt::tuple::impl_type<T>> |
The type of the I'th element of a tuple.
using fcppt::tuple::from_array_result |
using fcppt::tuple::is_object = typename fcppt::tuple::detail::is_object<T>::type |
Tests whether a type is a tuple.
using fcppt::tuple::map_result |
The result type of fcppt::tuple::map.
using fcppt::tuple::push_back_result |
The result type of fcppt::tuple::push_back.
using fcppt::tuple::types_of = typename fcppt::tuple::detail::types_of<T>::type |
The types of a tuple as an mpl::list
.
fcppt::tuple::apply_result< Function, Tuples... > fcppt::tuple::apply | ( | Function const & | _function, |
Tuples &&... | _tuples ) |
Applies a function to each tuple of elements of multiple tuples and returns a tuple containing the results.
Let Tuples=(t_1,...,t_n)
, where t_i = u_{i,1}, ..., u_{i,k}
. Calculates r_j = function(u{1,j}, ..., u_{n,j})
for every 1 <= j <= k
.
Tuples | Must be fcppt::tuple::object s. |
|
nodiscardconstexpr |
Converts a tuple to a struct.
Result | Has to be constructible from the tuple's types, i.e. if Tuple = (t_1,..,t_n) , then Result has to be constructible from t_1, ..., t_n . TODO(philipp): concepts |
decltype(auto) fcppt::tuple::concat | ( | Tuples &&... | _tuples | ) |
Concatenates multiple tuples.
|
nodiscard |
Converts an fcppt::array::object to an fcppt::tuple::object.
|
nodiscardconstexprnoexcept |
Returns the I'th element of a nonconst tuple.
|
nodiscardconstexprnoexcept |
Returns the I'th element of a const tuple.
|
inlinenodiscard |
Constructs a tuple by calling a function with static indices.
Constructs a tuple of type Tuple by calling _function(std::integral_constant<std::size_t, Index>)
for every index.
Tuple | Must be an fcppt::tuple::object . |
Function | Must be a function callable as T_i (std::integral_constant<std::size_t, i>) for 1 <= i <= n , where Tuple=(T_1,...,T_n) . |
|
nodiscardconstexpr |
Calls a function with the elements of a tuple.
This is the same as std::apply
. Let _tuple = (x_1,...,x_n)
. Then the result is f(x_1,...,x_n)
.
fcppt::tuple::map_result< Tuple, Function > fcppt::tuple::map | ( | Tuple && | _tuple, |
Function const & | _function ) |
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))
.
Tuple | Must be an fcppt::tuple::object . |
Function | Must be callable with every type in Tuple. |
std::basic_ostream< Ch, Traits > & fcppt::tuple::operator<< | ( | std::basic_ostream< Ch, Traits > & | _stream, |
fcppt::tuple::object< Types... > const & | _tuple ) |
Outputs a tuple to a stream.
|
inlinenodiscard |
Compares two tuples for equality.
fcppt::tuple::push_back_result< std::remove_cvref_t< Tuple >, std::remove_cvref_t< NewElement > > fcppt::tuple::push_back | ( | Tuple && | _tuple, |
NewElement && | _new_element ) |
Pushes an element to the back of a fcppt::tuple::object
.
Let _tuple be (v_1,...,v_n)
. The result of the function is (v_1,...,v_n,_new_element)
.
Tuple | Must be a fcppt::tuple::object . |