Construction¶
From Other Tuples¶
From Containers¶
-
template<typename T, std::size_t N>
constexpr auto core::tp::from_array(std::array<T, N> &array)¶ Create a new tuple from the given array.
- Template Parameters:
T – The array element type.
N – The size of the array.
- Returns:
A new tuple with the elements from the given array.
-
template<std::size_t N, class C>
constexpr auto core::tp::from_container(const C &c)¶ Create a new tuple from the given container c.
The template parameter N must be supplied by the caller because it cannot, in general, be inferred from the container at compile time. Also, the container C must have an indexing operator[].
- Template Parameters:
N – The size of the container.
T – The container element type.
- Returns:
A new tuple with the elements from container c.
-
template<typename T, std::size_t N>
constexpr auto core::tp::from_vector(std::vector<T> &vec)¶ Create a new tuple from the given vector vec.
The template parameter N must be supplied by the caller because it cannot be inferred from the vector at compile time.
- Template Parameters:
T – The vector element type.
N – The size of the container.
- Returns:
A new tuple with the elements from vector vec.
From Strings¶
-
template<typename T, std::size_t N = mp::size_v<T>>
mp::rename_t<T, std::tuple> core::tp::parse(const std::vector<std::string_view> &vec)¶ Create a new tuple by parsing the given string_view’s according to the type of the coresponding tuple element.
This function requires the cxx_core_string library to be installed in order to parse the individual elements.
- Template Parameters:
T – The type of tuple to create.
N – The tuple arity.