iformat for optional

This commit is contained in:
Sébastien Loriot 2023-06-29 18:08:57 +02:00
parent f31d41c1f2
commit 9e22fdfcb8
1 changed files with 13 additions and 0 deletions

View File

@ -267,6 +267,19 @@ public:
std::istream& operator()( std::istream& is) const { return (is >> t); }
};
template <class T>
class Input_rep<std::optional<T>>
{
std::optional<T>& t;
public:
//! initialize with a reference to \a t.
Input_rep( std::optional<T>& tt) : t(tt) {}
//! perform the input, calls \c operator\>\> by default.
std::istream& operator()( std::istream& is) const { return (is >> t.value()); }
};
#if CGAL_FORCE_IFORMAT_DOUBLE || \
( ( _MSC_VER > 1600 ) && ( _MSC_VER < 1910 ) && (! defined( CGAL_NO_IFORMAT_DOUBLE )) )