FlatImage
A configurable Linux containerization system
Loading...
Searching...
No Matches
ns_concept::IsContainerOf Concept Reference

Concept for containers holding a specific value type. More...

#include <concept.hpp>

Concept definition

template<typename T, typename U>
concept ns_concept::IsContainerOf = requires
{
typename T::value_type;
requires std::same_as<typename T::value_type, U>;
requires Iterable<T>;
}
Concept for containers holding a specific value type.
Definition concept.hpp:257
Concept for iterable containers (has begin() and end())
Definition concept.hpp:227

Detailed Description

Concept for containers holding a specific value type.

Template Parameters
TThe container type
UThe expected value type

Checks if a container's value_type matches the specified type and is iterable.

Example:

template<IsContainerOf<int> Container>
int sum(const Container& c) {
int total = 0;
for (int val : c) total += val;
return total;
}
Concept for standard library container types.
Definition concept.hpp:319

Definition at line 257 of file concept.hpp.