SpECTRE  v2024.05.11
tt::is_iterable< T, typename > Struct Template Reference

Check if type T has a begin() and end() function. More...

#include <IsIterable.hpp>

Detailed Description

template<typename T, typename = std::void_t<>>
struct tt::is_iterable< T, typename >

Check if type T has a begin() and end() function.

Details

Given a type T inherits from std::true_type if T has member functions begin() and end(), otherwise inherits from std::false_type

Usage

For any type T

using result = tt::is_iterable<T>;
Check if type T has a begin() and end() function.
Definition: IsIterable.hpp:40

Returns: std::bool_constant

Semantics: If T has member function begin() and end() then

typename result::type = std::true_type;

otherwise

typename result::type = std::false_type;

Example

"Failed testing type trait is_iterable");
"Failed testing type trait is_iterable");
static_assert(tt::is_iterable_v<std::vector<double>>,
"Failed testing type trait is_iterable");
"Failed testing type trait is_iterable");
constexpr T & value(T &t)
Returns t.value() if t is a std::optional otherwise returns t.
Definition: OptionalHelpers.hpp:32
typename is_iterable< T >::type is_iterable_t
Definition: IsIterable.hpp:55
Template Parameters
Tthe type to check

The documentation for this struct was generated from the following file: