AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
aui::parameter_pack Namespace Reference

Provides an easy way to iterate over a parameter pack. More...

Detailed Description

Provides an easy way to iterate over a parameter pack.

without with
template<typename Arg, typename... Args> void helperFunc(Arg&& arg, Args&&... args) {
// do something with arg
std::cout << std::forward<Arg>(arg) << std::endl;
if constexpr (sizeof...(args) > 0) {
helperFunc(std::forward<Args>(args)...); // continue iteration
}
}
template<typename... Args> void yourFunc(Args&&... args) {
helperFunc(std::forward<Args>(args)...);
}
API_AUI_CORE const ACommandLineArgs & args() noexcept
Definition: OSAndroid.cpp:29
template<typename... Args> void yourFunc(Args&&... args) {
aui::parameter_pack::for_each([](auto&& i) {
// do something with arg
std::cout << i << " ";
}, std::forward<Args>(args)...);
}

Typedefs

template<typename... Types>
using first = typename impl::first< Types... >::type