KUMI v3.1.0
Exquisite Epidote
Loading...
Searching...
No Matches
kumi::is_container< T > Struct Template Reference

Traits detecting types behaving like a kumi::container. More...

#include <kumi/utils/traits.hpp>

Detailed Description

template<typename T>
struct kumi::is_container< T >

Traits detecting types behaving like a kumi::container.

To be treated like a container, a user defined type must expose a type and a statically know size encoded in the type. It shall also provide general container utilities.

Note
The type shall be templated on the type and the size to be picked up.

Helper value

template<typename T> inline constexpr auto is_container = is_container<T>::value;
Traits detecting types behaving like a kumi::container.
Definition traits.hpp:195

Example:

#include <kumi/kumi.hpp>
#include <iostream>
#include <array>
#include <span>
#include <vector>
int main()
{
auto data = std::array{1,2,3,4,5,6,7,8,9,10};
kumi::for_each([](auto elt){ std::cout << elt << ", "; }, data);
std::cout << "\n";
auto my_span = std::span(data);
kumi::for_each([](auto elt){ std::cout << elt << ", "; }, kumi::to_tuple(my_span));
}
Concept specifying a type follows the Product Type semantic.
Definition concepts.hpp:87
Concept specifying a type follows the Container Type semantic.
Definition concepts.hpp:134
constexpr void for_each(Function f, T &&t, Ts &&... ts)
Applies the Callable object f on each element of a product type. f is applied on the values if the gi...
Definition for_each.hpp:36