SpECTRE  v2024.04.12
tt::is_streamable< S, T, typename > Struct Template Reference

Check if type T has operator<<(S, T) defined. More...

#include <IsStreamable.hpp>

Detailed Description

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

Check if type T has operator<<(S, T) defined.

Details

Inherits from std::true_type if the type T has operator<<(S, T) defined for a stream S, otherwise inherits from std::false_type

Usage

For any type T and stream type S,

using result = tt::is_streamable<S, T>;
Check if type T has operator<<(S, T) defined.
Definition: IsStreamable.hpp:45

Returns: std::bool_constant

Semantics: If the type T has operator<<(S, T) defined for stream S, then

typename result::type = std::true_type;

otherwise

typename result::type = std::false_type;

Example

"Failed testing type trait is_streamable");
"Failed testing type trait is_streamable");
static_assert(not tt::is_streamable_v<std::ostream, C>,
"Failed testing type trait is_streamable");
"Failed testing type trait is_streamable");
"Failed testing type trait is_streamable");
static_assert(tt::is_streamable_v<std::ostream, std::vector<TestHelpers::D>>,
"Failed testing type trait is_streamable");
typename is_streamable< S, T >::type is_streamable_t
Definition: IsStreamable.hpp:62
See also
std::cout std::ifstream std::sstream std::ostream
Template Parameters
Sthe stream type, e.g. std::stringstream or std::ostream
Tthe type we want to know if it has operator<<

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