-
template <typename T, typename... Args> constexpr size_t index_for_type_v
defines the index (position) of type T in theArgs...
pack. Results in compilation error if the type is not found. -
template <size_t index, typename... Args> using type_by_index
defines the type atindex
inArgs...
. -
template <size_t index, typename... Args> constexpr auto value_by_index(Args&&... args) noexcept
returns the value at positionindex
fromargs
. -
template <typename Functor, class... Args> void apply(Functor&& f, Args&&... args)
iterates the packargs
and calls functorf
with each value in the pack.
Example:apply([](auto&& value){std::cout << value << std::endl;}, 0, -1.0f, "text");
-
template <typename... Args, typename Functor> void for_type(Functor&& f)
calls functorf
for each type in the argument pack. The type is passed usingtype_wrapper
helper template defined inutils/template_magic.hpp
.
Example:for_type<int, float, std::string> ([](auto&& t){ using Type = typename decltype(t)::type; });
Files
parameter_pack
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||