add CGAL_CAN_USE_CXX20_FORMAT macro for <format> support (C++20)

This commit is contained in:
Laurent Rineau 2024-04-26 13:44:57 +02:00
parent 877e8322d2
commit bc76d8cbda
2 changed files with 6 additions and 3 deletions

View File

@ -493,6 +493,10 @@ namespace cpp11{
# define CGAL_FALLTHROUGH while(false){} # define CGAL_FALLTHROUGH while(false){}
#endif #endif
#if __cpp_lib_format >= 201907L || __cplusplus >= 202000L || _MSVC_LANG >= 202000L
# define CGAL_CAN_USE_CXX20_FORMAT 1
#endif
#ifndef CGAL_NO_ASSERTIONS #ifndef CGAL_NO_ASSERTIONS
# define CGAL_NO_ASSERTIONS_BOOL false # define CGAL_NO_ASSERTIONS_BOOL false
#else #else

View File

@ -995,8 +995,7 @@ inline void read_float_or_quotient(std::istream& is, Rat &z)
} // namespace CGAL } // namespace CGAL
#if __has_include(<format>) && \ #if CGAL_CAN_USE_CXX20_FORMAT
(__cpp_lib_format >= 201907L || __cplusplus >= 202000L || _MSVC_LANG >= 202000L)
# include <format> # include <format>
# include <sstream> # include <sstream>
@ -1041,7 +1040,7 @@ struct formatter<CGAL::Output_rep<T, F>, CharT> : public std::formatter<std::bas
}; };
} // namespace std } // namespace std
#endif // __cpp_lib_format >= 201907L #endif // CGAL_CAN_USE_CXX20_FORMAT
#include <CGAL/enable_warnings.h> #include <CGAL/enable_warnings.h>