29#include "../Interval.h"
44 template<
typename Valtype>
45 std::ostream& operator << ( std::ostream& os,
const common::Interval<Valtype>& i );
49 template<
typename Valtype>
50 std::istream&
operator >> ( std::istream& is, common::Interval<Valtype>& i );
55template<
typename Valtype>
inline
57 os <<
"Interval( " << i.
Near() <<
", " << i.
Far() <<
" )";
61inline void StreamInHead( std::istream& is,
const std::string& head ){
63 std::getline( is, token,
'(' );
64 token.erase( std::remove_if( token.begin(), token.end(), [](
unsigned char x) { return std::isspace(x); }), token.end() );
66 is.setstate( std::ios_base::failbit );
67 throw std::runtime_error(
"Stream in head: " + token +
" is not " + head );
71template<
typename Valtype>
inline
74 StreamInHead( is,
"Interval" );
78 is >> c; assert( c ==
',' );
80 is >> c; assert( c ==
')' );
std::istream & operator>>(std::istream &is, common::Interval< Valtype > &i)
Streams Interval data in.
Definition CommonSupportStream.h:72
Namespace of common utility classes and methods.
Definition Helpers.h:43
An interval describes the area between two numbers. It is understood to contain the near one and exlu...
Definition Interval.h:42
constexpr Valtype Near() const noexcept
Definition Interval.h:381
constexpr Valtype Far() const noexcept
Definition Interval.h:386
Valtype m_Far
The 'right' side of the interval; usually the bigger value.
Definition Interval.h:45
Valtype m_Near
The 'left' side of the interval; usually the smaller value.
Definition Interval.h:44