@@ -24,20 +24,25 @@ TOML_DISABLE_WARNINGS;
2424#include < vector>
2525#include < map>
2626#include < iosfwd>
27+ #include < new>
2728#if !TOML_HAS_CUSTOM_OPTIONAL_TYPE
2829 #include < optional>
2930#endif
30- #if TOML_HAS_INCLUDE(<version>)
31- #include < version>
32- #endif
3331TOML_ENABLE_WARNINGS;
3432
35- #ifdef __cpp_lib_launder
33+ #if defined( __cpp_lib_launder) && __cpp_lib_launder >= 201606
3634 #define TOML_LAUNDER (x ) std::launder(x)
3735#else
3836 #define TOML_LAUNDER (x ) x
3937#endif
4038
39+ #if defined(__cpp_char8_t) && __cpp_char8_t >= 201811 \
40+ && defined (__cpp_lib_char8_t ) && __cpp_lib_char8_t >= 201907
41+ #define TOML_HAS_CHAR8 1
42+ #else
43+ #define TOML_HAS_CHAR8 0
44+ #endif
45+
4146// #====================================================================================================================
4247// # ENVIRONMENT GROUND-TRUTHS
4348// #====================================================================================================================
@@ -174,7 +179,7 @@ TOML_NAMESPACE_START // abi namespace
174179 #if TOML_WINDOWS_COMPAT
175180 [[nodiscard]] TOML_API std::string narrow (std::wstring_view) noexcept ;
176181 [[nodiscard]] TOML_API std::wstring widen (std::string_view) noexcept ;
177- #ifdef __cpp_lib_char8_t
182+ #if TOML_HAS_CHAR8
178183 [[nodiscard]] TOML_API std::wstring widen (std::u8string_view) noexcept ;
179184 #endif
180185 #endif // TOML_WINDOWS_COMPAT
@@ -460,7 +465,7 @@ TOML_IMPL_NAMESPACE_START
460465 template <size_t N> struct value_traits <const char [N]> : string_value_traits<const char [N]> {};
461466 template <> struct value_traits <char *> : string_value_traits<char *> {};
462467 template <size_t N> struct value_traits <char [N]> : string_value_traits<char [N]> {};
463- #ifdef __cpp_lib_char8_t
468+ #if TOML_HAS_CHAR8
464469 template <> struct value_traits <std::u8string> : string_value_traits<std::u8string> {};
465470 template <> struct value_traits <std::u8string_view> : string_value_traits<std::u8string_view> {};
466471 template <> struct value_traits <const char8_t *> : string_value_traits<const char8_t *> {};
@@ -795,8 +800,6 @@ TOML_NAMESPACE_START
795800 // / \brief A source document region.
796801 // /
797802 // / \detail \cpp
798- // / #include <fstream>
799- // /
800803 // / auto tbl = toml::parse_file("config.toml"sv);
801804 // / if (auto server = tbl.get("server"))
802805 // / {
0 commit comments