diff --git a/Stream_support/include/CGAL/IO/io.h b/Stream_support/include/CGAL/IO/io.h index e287fe8e16f..8634c38f88d 100644 --- a/Stream_support/include/CGAL/IO/io.h +++ b/Stream_support/include/CGAL/IO/io.h @@ -32,6 +32,8 @@ #include #include #include +#include +#include namespace CGAL { @@ -186,6 +188,30 @@ public: std::ostream& operator()( std::ostream& os) const { return (os << t); } }; +template +class Output_rep, F> +{ + const std::optional& t; + +public: + Output_rep( const std::optional& tt) : t(tt) {} + std::ostream& operator()( std::ostream& os) const { + if (t==std::nullopt) return (os << "--"); + return (os << t.value()); } +}; + +template +class Output_rep, F> +{ + const std::variant& t; + +public: + Output_rep( const std::variant& tt) : t(tt) {} + std::ostream& operator()( std::ostream& os) const { + return (os << "--"); + } +}; + /*! \relates Output_rep \brief stream output of the \c Output_rep calls its \c operator().