From 9e22fdfcb8df6333d59df93a80b2114820f87c17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 29 Jun 2023 18:08:57 +0200 Subject: [PATCH] iformat for optional --- Stream_support/include/CGAL/IO/io.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Stream_support/include/CGAL/IO/io.h b/Stream_support/include/CGAL/IO/io.h index 8634c38f88d..3460398bea9 100644 --- a/Stream_support/include/CGAL/IO/io.h +++ b/Stream_support/include/CGAL/IO/io.h @@ -267,6 +267,19 @@ public: std::istream& operator()( std::istream& is) const { return (is >> t); } }; +template +class Input_rep> +{ + std::optional& t; + +public: + //! initialize with a reference to \a t. + Input_rep( std::optional& 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 )) )