cmoon::meta::type_list<Types...>::for_each





template<template<typename> class Function>
[[nodiscard]] static constexpr void for_each() noexcept(/* see below */);


(1)

Runs the given function for each type as such:



    std::invoke(Function<T>{})
    

for each T in Types....

Parameters

(none)

Return value

(none)

Exceptions

1) noexcept specification:



noexcept(std::conjunction_v<std::is_nothrow_invocable<Function<Types>>...>)


Complexity

Constant.

Example



import <type_traits>;
import <iostream>;

import cmoon.meta;

template<class T>
struct print_type
{
    void operator()() const
    {
        std::cout << typeid(T).name() << ' ';
    }
};

int main()
{
    using tl = cmoon::meta::type_list<float, double, long double>;
    tl::for_each<print_type>();
}