From b2be6dbbef3b5b62ecbfc82164f740cbc4ca568f Mon Sep 17 00:00:00 2001 From: Sebastien Loriot Date: Fri, 18 Aug 2023 09:25:39 +0200 Subject: [PATCH] fix istream for optional Co-authored-by: Laurent Rineau --- Stream_support/include/CGAL/IO/io.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Stream_support/include/CGAL/IO/io.h b/Stream_support/include/CGAL/IO/io.h index e57d4327bac6..d9c2ea7f761a 100644 --- a/Stream_support/include/CGAL/IO/io.h +++ b/Stream_support/include/CGAL/IO/io.h @@ -281,7 +281,11 @@ class Input_rep> 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()); } + std::istream& operator()( std::istream& is) const { + T v; + if(is >> v) t = v; + return is; + } }; #if CGAL_FORCE_IFORMAT_DOUBLE || \