@@ -24,20 +24,25 @@ TOML_DISABLE_WARNINGS;
24
24
#include < vector>
25
25
#include < map>
26
26
#include < iosfwd>
27
+ #include < new>
27
28
#if !TOML_HAS_CUSTOM_OPTIONAL_TYPE
28
29
#include < optional>
29
30
#endif
30
- #if TOML_HAS_INCLUDE(<version>)
31
- #include < version>
32
- #endif
33
31
TOML_ENABLE_WARNINGS;
34
32
35
- #ifdef __cpp_lib_launder
33
+ #if defined( __cpp_lib_launder) && __cpp_lib_launder >= 201606
36
34
#define TOML_LAUNDER (x ) std::launder(x)
37
35
#else
38
36
#define TOML_LAUNDER (x ) x
39
37
#endif
40
38
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
+
41
46
// #====================================================================================================================
42
47
// # ENVIRONMENT GROUND-TRUTHS
43
48
// #====================================================================================================================
@@ -174,7 +179,7 @@ TOML_NAMESPACE_START // abi namespace
174
179
#if TOML_WINDOWS_COMPAT
175
180
[[nodiscard]] TOML_API std::string narrow (std::wstring_view) noexcept ;
176
181
[[nodiscard]] TOML_API std::wstring widen (std::string_view) noexcept ;
177
- #ifdef __cpp_lib_char8_t
182
+ #if TOML_HAS_CHAR8
178
183
[[nodiscard]] TOML_API std::wstring widen (std::u8string_view) noexcept ;
179
184
#endif
180
185
#endif // TOML_WINDOWS_COMPAT
@@ -460,7 +465,7 @@ TOML_IMPL_NAMESPACE_START
460
465
template <size_t N> struct value_traits <const char [N]> : string_value_traits<const char [N]> {};
461
466
template <> struct value_traits <char *> : string_value_traits<char *> {};
462
467
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
464
469
template <> struct value_traits <std::u8string> : string_value_traits<std::u8string> {};
465
470
template <> struct value_traits <std::u8string_view> : string_value_traits<std::u8string_view> {};
466
471
template <> struct value_traits <const char8_t *> : string_value_traits<const char8_t *> {};
@@ -795,8 +800,6 @@ TOML_NAMESPACE_START
795
800
// / \brief A source document region.
796
801
// /
797
802
// / \detail \cpp
798
- // / #include <fstream>
799
- // /
800
803
// / auto tbl = toml::parse_file("config.toml"sv);
801
804
// / if (auto server = tbl.get("server"))
802
805
// / {
0 commit comments