1 #ifndef SIPLASPLAS_TYPEERASURE_FEATURES_IOSTREAM_HPP 2 #define SIPLASPLAS_TYPEERASURE_FEATURES_IOSTREAM_HPP 4 #include <siplasplas/utility/staticif.hpp> 5 #include <siplasplas/utility/exception.hpp> 6 #include <siplasplas/typeerasure/concepts/iostream.hpp> 37 return cpp::staticIf<cpp::concepts::OStreamable<T>::value>([&](
auto identity) -> std::ostream&
39 return identity(os) << value;
40 }).Else([](
auto) -> std::ostream&
42 throw cpp::exception<std::runtime_error>(
43 "{} is not ostreamable!",
44 ctti::type_id<T>().name()
73 return cpp::staticIf<cpp::concepts::IStreamable<T>::value>([&](
auto identity) -> std::istream&
75 return identity(is) >> value;
76 }).Else([](
auto) -> std::istream&
78 throw cpp::exception<std::runtime_error>(
79 "{} is not istreamable!",
80 ctti::type_id<T>().name()
89 #endif // SIPLASPLAS_TYPEERASURE_FEATURES_IOSTREAM_HPP Definition: canary_allocator.hpp:7
static std::istream & apply(std::istream &is, T &value) noexcept(cpp::concepts::IStreamable< T >::no_except)
Implements read from input stream feature.
Definition: iostream.hpp:71
Implements write to an standard output stream.
Definition: iostream.hpp:18
Checks whether a vaue of type T can be written to a standard stream.
Definition: iostream.hpp:45
Implements read from an standard input stream.
Definition: iostream.hpp:54
static std::ostream & apply(std::ostream &os, const T &value) noexcept(cpp::concepts::OStreamable< T >::no_except)
Implements write to output stream feature.
Definition: iostream.hpp:35
Checks whether a vaue of type T can be read from a standard stream.
Definition: iostream.hpp:75