also:
- fixed `noexcept(...)` sometimes being incorrectly derived on `for_each()
- refactors
This commit is contained in:
Mark Gillard 2023-09-05 13:53:23 +03:00
parent 882d9d1c34
commit d46cac705a
60 changed files with 1072 additions and 453 deletions

View File

@ -8,14 +8,15 @@ tab_width = 4
end_of_line = lf
trim_trailing_whitespace = true
charset = utf-8
max_line_length = 120
[*.{md,markdown}]
trim_trailing_whitespace = false
[*.{gitattributes,yaml,yml,vcxproj,vcxproj.filters,sln,rc,clang-format,toml}]
[*.{gitattributes,yaml,yml,vcxproj,vcxproj.filters,sln,rc,clang-format,toml,py,cmake}]
indent_style = space
[{Doxyfile,Doxyfile-mcss}]
[{Doxyfile,Doxyfile-mcss,CMakeLists.txt}]
indent_style = space
[*.{hlsl,rc,sln,vcxproj,vcxproj.filters}]

12
.gitattributes vendored
View File

@ -7,17 +7,17 @@
*.cs eol=lf diff=csharp
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.doc binary
*.DOC binary
*.docx binary
*.DOCX binary
*.pdf binary
*.PDF binary
*.ai binary
*.bin binary
*.bmp binary

View File

@ -3,39 +3,35 @@
Thanks for contributing!
-->
**What does this change do?**
<!--
Changes all Foos to Bars.
--->
**Is it related to an exisiting bug report or feature request?**
<!--
Fixes #69.
--->
**Pre-merge checklist**
<!--
Not all of these will necessarily apply, particularly if you're not making a code change (e.g. fixing documentation).
That's OK. Tick the ones that do by placing an x in them, e.g. [x]
--->
- [ ] I've read [CONTRIBUTING.md]
- [ ] I've rebased my changes against the current HEAD of `origin/master` (if necessary)
- [ ] I've added new test cases to verify my change
- [ ] I've regenerated toml.hpp ([how-to])
- [ ] I've updated any affected documentation
- [ ] I've rebuilt and run the tests with at least one of:
- [ ] Clang 6 or higher
- [ ] GCC 7 or higher
- [ ] MSVC 19.20 (Visual Studio 2019) or higher
- [ ] I've added my name to the list of contributors in [README.md](https://github.com/marzer/tomlplusplus/blob/master/README.md)
- [ ] I've read [CONTRIBUTING.md]
- [ ] I've rebased my changes against the current HEAD of `origin/master` (if necessary)
- [ ] I've added new test cases to verify my change
- [ ] I've regenerated toml.hpp ([how-to])
- [ ] I've updated any affected documentation
- [ ] I've rebuilt and run the tests with at least one of:
- [ ] Clang 8 or higher
- [ ] GCC 8 or higher
- [ ] MSVC 19.20 (Visual Studio 2019) or higher
- [ ] I've added my name to the list of contributors in [README.md](https://github.com/marzer/tomlplusplus/blob/master/README.md)
[CONTRIBUTING.md]: https://github.com/marzer/tomlplusplus/blob/master/CONTRIBUTING.md
[how-to]: https://github.com/marzer/tomlplusplus/blob/master/CONTRIBUTING.md#regenerating-tomlhpp

View File

@ -29,6 +29,8 @@ template:
- fixed `toml::value::flags()` not being cleared when `std::move`-ing a value
- fixed error in README (#195) (@andrewkcorcoran)
- fixed compiler error when using NVCC (#198) (@thompsonnoahe)
- fixed `noexcept(...)` sometimes being incorrectly derived on `for_each()`
- fixed `for_each()` compilation error on GCC &lt;= 7 (#197) (@sagi-ottopia)
#### Changes:

View File

@ -27,7 +27,7 @@
- C++17 (plus some C++20 features where available, e.g. experimental support for [char8_t] strings)
- Doesn't require RTTI
- Works with or without exceptions
- Tested on Clang (6+), GCC (7+) and MSVC (VS2019)
- Tested on Clang (8+), GCC (8+) and MSVC (VS2019)
- Tested on x64, x86 and ARM
<br>

View File

@ -15,7 +15,7 @@
- C++17 (plus some C++20 features where available, e.g. experimental support for char8_t strings)
- Doesn't require RTTI
- Works with or without exceptions
- Tested on Clang (6+), GCC (7+) and MSVC (VS2019)
- Tested on Clang (8+), GCC (8+) and MSVC (VS2019)
- Tested on x64, x86 and ARM
<!-- --------------------------------------------------------------------------------------------------------------- -->

View File

@ -11,6 +11,26 @@
#include "make_node.hpp"
#include "header_start.hpp"
#ifndef TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN
#if TOML_GCC && TOML_GCC <= 7
#define TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN 1
#else
#define TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN 0
#endif
#endif
#if TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN && !defined(TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN_ACKNOWLEDGED)
#define TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN_MESSAGE \
"If you're seeing this error it's because you're using one of toml++'s for_each() functions on a compiler with " \
"known bugs in that area (e.g. GCC 7). On these compilers returning a bool (or bool-convertible) value from the " \
"for_each() callable causes spurious compilation failures, while returning nothing (void) works fine. " \
"If you believe this message is incorrect for your compiler, you can try your luck by #defining " \
"TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN as 0 and recompiling - if it works, great! Let me know at " \
"https://github.com/marzer/tomlplusplus/issues. Alternatively, if you don't have any need for early-exiting from " \
"for_each(), you can suppress this error by #defining TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN_ACKNOWLEDGED " \
"and moving on with your life."
#endif
/// \cond
TOML_IMPL_NAMESPACE_START
{
@ -834,51 +854,56 @@ TOML_NAMESPACE_START
using for_each_elem_ref = impl::copy_cvref<impl::wrap_node<impl::remove_cvref<impl::unwrap_node<T>>>, Array>;
template <typename Func, typename Array, typename T>
static constexpr bool can_for_each = std::is_invocable_v<Func, for_each_elem_ref<T, Array>, size_t> //
|| std::is_invocable_v<Func, size_t, for_each_elem_ref<T, Array>> //
|| std::is_invocable_v<Func, for_each_elem_ref<T, Array>>;
using can_for_each = std::disjunction<std::is_invocable<Func, for_each_elem_ref<T, Array>, size_t>,
std::is_invocable<Func, size_t, for_each_elem_ref<T, Array>>,
std::is_invocable<Func, for_each_elem_ref<T, Array>>>;
template <typename Func, typename Array, typename T>
static constexpr bool can_for_each_nothrow =
std::is_nothrow_invocable_v<Func, for_each_elem_ref<T, Array>, size_t> //
|| std::is_nothrow_invocable_v<Func, size_t, for_each_elem_ref<T, Array>> //
|| std::is_nothrow_invocable_v<Func, for_each_elem_ref<T, Array>>;
using can_for_each_nothrow = std::conditional_t<
// first form
std::is_invocable_v<Func, for_each_elem_ref<T, Array>, size_t>,
std::is_nothrow_invocable<Func, for_each_elem_ref<T, Array>, size_t>,
std::conditional_t<
// second form
std::is_invocable_v<Func, size_t, for_each_elem_ref<T, Array>>,
std::is_nothrow_invocable<Func, size_t, for_each_elem_ref<T, Array>>,
std::conditional_t<
// third form
std::is_invocable_v<Func, for_each_elem_ref<T, Array>>,
std::is_nothrow_invocable<Func, for_each_elem_ref<T, Array>>,
std::false_type>>>;
template <typename Func, typename Array>
static constexpr bool can_for_each_any = can_for_each<Func, Array, table> //
|| can_for_each<Func, Array, array> //
|| can_for_each<Func, Array, std::string> //
|| can_for_each<Func, Array, int64_t> //
|| can_for_each<Func, Array, double> //
|| can_for_each<Func, Array, bool> //
|| can_for_each<Func, Array, date> //
|| can_for_each<Func, Array, time> //
|| can_for_each<Func, Array, date_time>;
using can_for_each_any = std::disjunction<can_for_each<Func, Array, table>,
can_for_each<Func, Array, array>,
can_for_each<Func, Array, std::string>,
can_for_each<Func, Array, int64_t>,
can_for_each<Func, Array, double>,
can_for_each<Func, Array, bool>,
can_for_each<Func, Array, date>,
can_for_each<Func, Array, time>,
can_for_each<Func, Array, date_time>>;
template <typename Func, typename Array, typename T>
static constexpr bool for_each_is_nothrow_one = !can_for_each<Func, Array, T> //
|| can_for_each_nothrow<Func, Array, T>;
// clang-format off
using for_each_is_nothrow_one = std::disjunction<std::negation<can_for_each<Func, Array, T>>, //
can_for_each_nothrow<Func, Array, T>>;
template <typename Func, typename Array>
static constexpr bool for_each_is_nothrow = for_each_is_nothrow_one<Func, Array, table> //
&& for_each_is_nothrow_one<Func, Array, array> //
&& for_each_is_nothrow_one<Func, Array, std::string> //
&& for_each_is_nothrow_one<Func, Array, int64_t> //
&& for_each_is_nothrow_one<Func, Array, double> //
&& for_each_is_nothrow_one<Func, Array, bool> //
&& for_each_is_nothrow_one<Func, Array, date> //
&& for_each_is_nothrow_one<Func, Array, time> //
&& for_each_is_nothrow_one<Func, Array, date_time>;
// clang-format on
using for_each_is_nothrow = std::conjunction<for_each_is_nothrow_one<Func, Array, table>,
for_each_is_nothrow_one<Func, Array, array>,
for_each_is_nothrow_one<Func, Array, std::string>,
for_each_is_nothrow_one<Func, Array, int64_t>,
for_each_is_nothrow_one<Func, Array, double>,
for_each_is_nothrow_one<Func, Array, bool>,
for_each_is_nothrow_one<Func, Array, date>,
for_each_is_nothrow_one<Func, Array, time>,
for_each_is_nothrow_one<Func, Array, date_time>>;
template <typename Func, typename Array>
static void do_for_each(Func&& visitor, Array&& arr) noexcept(for_each_is_nothrow<Func&&, Array&&>)
static void do_for_each(Func&& visitor, Array&& arr) //
noexcept(for_each_is_nothrow<Func&&, Array&&>::value)
{
static_assert(can_for_each_any<Func&&, Array&&>,
static_assert(can_for_each_any<Func&&, Array&&>::value,
"TOML array for_each visitors must be invocable for at least one of the toml::node "
"specializations:" TOML_SA_NODE_TYPE_LIST);
@ -887,13 +912,46 @@ TOML_NAMESPACE_START
using node_ref = impl::copy_cvref<toml::node, Array&&>;
static_assert(std::is_reference_v<node_ref>);
#if TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN
#ifndef TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN_ACKNOWLEDGED
static_assert(impl::always_false<Func, Array, node_ref>, //
TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN_MESSAGE);
#endif
static_cast<node_ref>(static_cast<Array&&>(arr)[i])
.visit(
[&]([[maybe_unused]] auto&& elem) //
noexcept(for_each_is_nothrow_one<Func&&, Array&&, decltype(elem)>::value)
{
using elem_ref = for_each_elem_ref<decltype(elem), Array&&>;
static_assert(std::is_reference_v<elem_ref>);
// func(elem, i)
if constexpr (std::is_invocable_v<Func&&, elem_ref, size_t>)
{
static_cast<Func&&>(visitor)(static_cast<elem_ref>(elem), i);
}
// func(i, elem)
else if constexpr (std::is_invocable_v<Func&&, size_t, elem_ref>)
{
static_cast<Func&&>(visitor)(i, static_cast<elem_ref>(elem));
}
// func(elem)
else if constexpr (std::is_invocable_v<Func&&, elem_ref>)
{
static_cast<Func&&>(visitor)(static_cast<elem_ref>(elem));
}
});
#else
const auto keep_going =
static_cast<node_ref>(static_cast<Array&&>(arr)[i])
.visit(
[&](auto&& elem)
#if !TOML_MSVC // MSVC thinks this is invalid syntax O_o
noexcept(for_each_is_nothrow_one<Func&&, Array&&, decltype(elem)>)
#endif
[&]([[maybe_unused]] auto&& elem) //
noexcept(for_each_is_nothrow_one<Func&&, Array&&, decltype(elem)>::value)
{
using elem_ref = for_each_elem_ref<decltype(elem), Array&&>;
static_assert(std::is_reference_v<elem_ref>);
@ -959,6 +1017,7 @@ TOML_NAMESPACE_START
if (!keep_going)
return;
#endif
}
}
@ -1026,7 +1085,8 @@ TOML_NAMESPACE_START
///
/// \see node::visit()
template <typename Func>
array& for_each(Func&& visitor) & noexcept(for_each_is_nothrow<Func&&, array&>)
array& for_each(Func&& visitor) & //
noexcept(for_each_is_nothrow<Func&&, array&>::value)
{
do_for_each(static_cast<Func&&>(visitor), *this);
return *this;
@ -1034,7 +1094,8 @@ TOML_NAMESPACE_START
/// \brief Invokes a visitor on each element in the array (rvalue overload).
template <typename Func>
array&& for_each(Func&& visitor) && noexcept(for_each_is_nothrow<Func&&, array&&>)
array&& for_each(Func&& visitor) && //
noexcept(for_each_is_nothrow<Func&&, array&&>::value)
{
do_for_each(static_cast<Func&&>(visitor), static_cast<array&&>(*this));
return static_cast<array&&>(*this);
@ -1042,7 +1103,8 @@ TOML_NAMESPACE_START
/// \brief Invokes a visitor on each element in the array (const lvalue overload).
template <typename Func>
const array& for_each(Func&& visitor) const& noexcept(for_each_is_nothrow<Func&&, const array&>)
const array& for_each(Func&& visitor) const& //
noexcept(for_each_is_nothrow<Func&&, const array&>::value)
{
do_for_each(static_cast<Func&&>(visitor), *this);
return *this;
@ -1050,7 +1112,8 @@ TOML_NAMESPACE_START
/// \brief Invokes a visitor on each element in the array (const rvalue overload).
template <typename Func>
const array&& for_each(Func&& visitor) const&& noexcept(for_each_is_nothrow<Func&&, const array&&>)
const array&& for_each(Func&& visitor) const&& //
noexcept(for_each_is_nothrow<Func&&, const array&&>::value)
{
do_for_each(static_cast<Func&&>(visitor), static_cast<const array&&>(*this));
return static_cast<const array&&>(*this);

View File

@ -465,8 +465,8 @@ TOML_IMPL_NAMESPACE_START
using copy_cvref =
copy_ref<copy_ref<copy_cv<std::remove_reference_t<Dest>, std::remove_reference_t<Src>>, Dest>, Src>;
template <typename T>
inline constexpr bool dependent_false = false;
template <typename...>
inline constexpr bool always_false = false;
template <typename T, typename... U>
inline constexpr bool first_is_same = false;

View File

@ -49,14 +49,14 @@ TOML_IMPL_NAMESPACE_START
if constexpr (!is_losslessly_convertible_to_native<unwrapped_type>)
{
if constexpr (std::is_same_v<native_type, int64_t>)
static_assert(dependent_false<T>,
static_assert(always_false<T>,
"Integral value initializers must be losslessly convertible to int64_t");
else if constexpr (std::is_same_v<native_type, double>)
static_assert(dependent_false<T>,
static_assert(always_false<T>,
"Floating-point value initializers must be losslessly convertible to double");
else
static_assert(
dependent_false<T>,
always_false<T>,
"Value initializers must be losslessly convertible to one of the TOML value types");
}
@ -65,7 +65,7 @@ TOML_IMPL_NAMESPACE_START
#if TOML_ENABLE_WINDOWS_COMPAT
out = new value_type{ narrow(static_cast<T&&>(val)) };
#else
static_assert(dependent_false<T>, "Evaluated unreachable branch!");
static_assert(always_false<T>, "Evaluated unreachable branch!");
#endif
}
else

View File

@ -501,7 +501,7 @@ TOML_NAMESPACE_START
#else
static_assert(impl::dependent_false<T>, "Evaluated unreachable branch!");
static_assert(impl::always_false<T>, "Evaluated unreachable branch!");
#endif
}
@ -656,7 +656,7 @@ TOML_NAMESPACE_START
#if TOML_ENABLE_WINDOWS_COMPAT
return lhs == impl::narrow(rhs);
#else
static_assert(impl::dependent_false<T>, "Evaluated unreachable branch!");
static_assert(impl::always_false<T>, "Evaluated unreachable branch!");
#endif
}
else

View File

@ -474,7 +474,7 @@ TOML_NAMESPACE_START
return err_ ? node_view<const node>{} : table()[key];
}
#endif // TOML_ENABLE_WINDOWS_COMPAT
#endif // TOML_ENABLE_WINDOWS_COMPAT
/// @}

View File

@ -379,7 +379,7 @@ TOML_NAMESPACE_START
return parse(std::u8string_view{ str, len });
}
#endif // TOML_HAS_CHAR8
#endif // TOML_HAS_CHAR8
TOML_ABI_NAMESPACE_END; // TOML_EXCEPTIONS
}

View File

@ -792,7 +792,7 @@ TOML_ANON_NAMESPACE_START
else
{
static_assert(
impl::dependent_false<T>,
impl::always_false<T>,
"concatenate() inputs are limited to std::string_views, integers, floats, and escaped_codepoint");
}
}
@ -2122,7 +2122,7 @@ TOML_IMPL_NAMESPACE_START
return (fragments[0].value + fragments[1].value) * pow(2.0, fragments[2].value * exponent_sign) * sign;
#else // !TOML_LANG_UNRELEASED
#else // !TOML_LANG_UNRELEASED
set_error_and_return_default("hexadecimal floating-point values are not supported "
"in TOML 1.0.0 and earlier"sv);
@ -3906,7 +3906,7 @@ TOML_NAMESPACE_START
return TOML_ANON_NAMESPACE::do_parse(TOML_ANON_NAMESPACE::utf8_reader{ doc, impl::narrow(source_path) });
}
#endif // TOML_HAS_CHAR8 && TOML_ENABLE_WINDOWS_COMPAT
#endif // TOML_HAS_CHAR8 && TOML_ENABLE_WINDOWS_COMPAT
TOML_ABI_NAMESPACE_END; // TOML_EXCEPTIONS
}

View File

@ -11,82 +11,86 @@
#ifndef __cplusplus
#error toml++ is a C++ library.
#endif
#ifndef TOML_CPP
#ifdef _MSVC_LANG
#if _MSVC_LANG > __cplusplus
#define TOML_CPP _MSVC_LANG
#else
#endif
#endif
#ifndef TOML_CPP
#define TOML_CPP __cplusplus
#endif
#if TOML_CPP >= 202002L
#if TOML_CPP >= 202900L
#undef TOML_CPP
#define TOML_CPP 29
#elif TOML_CPP >= 202600L
#undef TOML_CPP
#define TOML_CPP 26
#elif TOML_CPP >= 202302L
#undef TOML_CPP
#define TOML_CPP 23
#elif TOML_CPP >= 202002L
#undef TOML_CPP
#define TOML_CPP 20
#elif TOML_CPP >= 201703L
#undef TOML_CPP
#define TOML_CPP 17
#elif TOML_CPP >= 201402L
#undef TOML_CPP
#define TOML_CPP 14
#elif TOML_CPP >= 201103L
#undef TOML_CPP
#define TOML_CPP 11
#else
#if TOML_CPP < 201103L
#undef TOML_CPP
#define TOML_CPP 0
#endif
#endif
#if !TOML_CPP
#error toml++ requires C++17 or higher. For a pre-C++11 TOML library see https://github.com/ToruNiina/Boost.toml
#elif TOML_CPP < 201703L
#elif TOML_CPP < 17
#error toml++ requires C++17 or higher. For a C++11 TOML library see https://github.com/ToruNiina/toml11
#endif
#endif
//#=====================================================================================================================
//# COMPILER / OS
//# COMPILER
//#=====================================================================================================================
#ifndef TOML_MAKE_VERSION
#define TOML_MAKE_VERSION(major, minor, patch) (((major)*10000) + ((minor)*100) + ((patch)))
#endif
#ifdef __clang__
#define TOML_CLANG __clang_major__
#else
#define TOML_CLANG 0
#endif
#ifdef __INTEL_COMPILER
#define TOML_ICC __INTEL_COMPILER
#ifdef __ICL
#define TOML_ICC_CL TOML_ICC
#else
#define TOML_ICC_CL 0
#endif
#else
#define TOML_ICC 0
#define TOML_ICC_CL 0
#endif
#if defined(_MSC_VER) && !TOML_CLANG && !TOML_ICC
#define TOML_MSVC _MSC_VER
#else
#define TOML_MSVC 0
#endif
#if defined(__GNUC__) && !TOML_CLANG && !TOML_ICC
#define TOML_GCC __GNUC__
#else
#define TOML_GCC 0
#endif
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__CYGWIN__)
#define TOML_WINDOWS 1
#else
#define TOML_WINDOWS 0
#endif
#if defined(DOXYGEN) || defined(__DOXYGEN__) || defined(__POXY__) || defined(__poxy__)
#define TOML_DOXYGEN 1
#else
#define TOML_DOXYGEN 0
#endif
#ifndef TOML_INTELLISENSE
#ifdef __INTELLISENSE__
#define TOML_INTELLISENSE 1
#else
#define TOML_INTELLISENSE 0
#endif
#if defined(__CUDACC__) || defined(__CUDA_ARCH__) || defined(__CUDA_LIBDEVICE__)
#define TOML_CUDA 1
#endif
#ifndef TOML_DOXYGEN
#if defined(DOXYGEN) || defined(__DOXYGEN) || defined(__DOXYGEN__) || defined(__doxygen__) || defined(__POXY__) \
|| defined(__poxy__)
#define TOML_DOXYGEN 1
#else
#define TOML_CUDA 0
#define TOML_DOXYGEN 0
#endif
#endif
#ifndef TOML_CLANG
#ifdef __clang__
#define TOML_CLANG __clang_major__
#else
#define TOML_CLANG 0
#endif
// special handling for apple clang; see:
// - https://github.com/marzer/tomlplusplus/issues/189
// - https://en.wikipedia.org/wiki/Xcode
// - https://stackoverflow.com/questions/19387043/how-can-i-reliably-detect-the-version-of-clang-at-preprocessing-time
// -
// https://stackoverflow.com/questions/19387043/how-can-i-reliably-detect-the-version-of-clang-at-preprocessing-time
#if TOML_CLANG && defined(__apple_build_version__)
#undef TOML_CLANG
#define TOML_CLANG_VERSION TOML_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
@ -115,112 +119,229 @@
#endif
#undef TOML_CLANG_VERSION
#endif
#endif
#ifndef TOML_ICC
#ifdef __INTEL_COMPILER
#define TOML_ICC __INTEL_COMPILER
#ifdef __ICL
#define TOML_ICC_CL TOML_ICC
#else
#define TOML_ICC_CL 0
#endif
#else
#define TOML_ICC 0
#define TOML_ICC_CL 0
#endif
#endif
#ifndef TOML_MSVC_LIKE
#ifdef _MSC_VER
#define TOML_MSVC_LIKE _MSC_VER
#else
#define TOML_MSVC_LIKE 0
#endif
#endif
#ifndef TOML_MSVC
#if TOML_MSVC_LIKE && !TOML_CLANG && !TOML_ICC
#define TOML_MSVC TOML_MSVC_LIKE
#else
#define TOML_MSVC 0
#endif
#endif
#ifndef TOML_GCC_LIKE
#ifdef __GNUC__
#define TOML_GCC_LIKE __GNUC__
#else
#define TOML_GCC_LIKE 0
#endif
#endif
#ifndef TOML_GCC
#if TOML_GCC_LIKE && !TOML_CLANG && !TOML_ICC
#define TOML_GCC TOML_GCC_LIKE
#else
#define TOML_GCC 0
#endif
#endif
#ifndef TOML_CUDA
#if defined(__CUDACC__) || defined(__CUDA_ARCH__) || defined(__CUDA_LIBDEVICE__)
#define TOML_CUDA 1
#else
#define TOML_CUDA 0
#endif
#endif
//#=====================================================================================================================
//# ARCHITECTURE
//#=====================================================================================================================
// IA64
#ifndef TOML_ARCH_ITANIUM
#if defined(__ia64__) || defined(__ia64) || defined(_IA64) || defined(__IA64__) || defined(_M_IA64)
#define TOML_ARCH_ITANIUM 1
#define TOML_ARCH_BITNESS 64
#else
#define TOML_ARCH_ITANIUM 0
#endif
#endif
// AMD64
#ifndef TOML_ARCH_AMD64
#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_AMD64)
#define TOML_ARCH_AMD64 1
#define TOML_ARCH_AMD64 1
#define TOML_ARCH_BITNESS 64
#else
#define TOML_ARCH_AMD64 0
#endif
#endif
// 32-bit x86
#ifndef TOML_ARCH_X86
#if defined(__i386__) || defined(_M_IX86)
#define TOML_ARCH_X86 1
#define TOML_ARCH_X86 1
#define TOML_ARCH_BITNESS 32
#else
#define TOML_ARCH_X86 0
#endif
#endif
// ARM
#ifndef TOML_ARCH_ARM
#if defined(__aarch64__) || defined(__ARM_ARCH_ISA_A64) || defined(_M_ARM64) || defined(__ARM_64BIT_STATE) \
|| defined(_M_ARM64EC)
#define TOML_ARCH_ARM32 0
#define TOML_ARCH_ARM64 1
#define TOML_ARCH_ARM 1
#define TOML_ARCH_ARM32 0
#define TOML_ARCH_ARM64 1
#define TOML_ARCH_ARM 1
#define TOML_ARCH_BITNESS 64
#elif defined(__arm__) || defined(_M_ARM) || defined(__ARM_32BIT_STATE)
#define TOML_ARCH_ARM32 1
#define TOML_ARCH_ARM64 0
#define TOML_ARCH_ARM 1
#define TOML_ARCH_ARM32 1
#define TOML_ARCH_ARM64 0
#define TOML_ARCH_ARM 1
#define TOML_ARCH_BITNESS 32
#else
#define TOML_ARCH_ARM32 0
#define TOML_ARCH_ARM64 0
#define TOML_ARCH_ARM 0
#endif
#endif
#ifndef TOML_ARCH_BITNESS
#define TOML_ARCH_BITNESS 0
#endif
#ifndef TOML_ARCH_X64
#if TOML_ARCH_BITNESS == 64
#define TOML_ARCH_X64 1
#else
#define TOML_ARCH_X64 0
#endif
#endif
//#=====================================================================================================================
//# OS
//#=====================================================================================================================
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__CYGWIN__)
#define TOML_WINDOWS 1
#else
#define TOML_WINDOWS 0
#endif
#ifdef __unix__
#define TOML_UNIX 1
#else
#define TOML_UNIX 0
#endif
#ifdef __linux__
#define TOML_LINUX 1
#else
#define TOML_LINUX 0
#endif
//#=====================================================================================================================
//# ATTRIBUTES / FEATURE DETECTION / UTILITY MACROS
//#=====================================================================================================================
// TOML_HAS_INCLUDE
#ifndef TOML_HAS_INCLUDE
#ifdef __has_include
#define TOML_HAS_INCLUDE(header) __has_include(header)
#define TOML_HAS_INCLUDE(header) __has_include(header)
#else
#define TOML_HAS_INCLUDE(header) 0
#endif
#endif
// TOML_HAS_BUILTIN
#ifndef TOML_HAS_BUILTIN
#ifdef __has_builtin
#define TOML_HAS_BUILTIN(name) __has_builtin(name)
#else
#define TOML_HAS_BUILTIN(name) 0
#endif
#endif
// TOML_HAS_FEATURE
#ifndef TOML_HAS_FEATURE
#ifdef __has_feature
#define TOML_HAS_FEATURE(name) __has_feature(name)
#else
#define TOML_HAS_FEATURE(name) 0
#endif
#endif
// TOML_HAS_ATTR
#ifndef TOML_HAS_ATTR
#ifdef __has_attribute
#define TOML_HAS_ATTR(attr) __has_attribute(attr)
#else
#define TOML_HAS_ATTR(attr) 0
#endif
#endif
// TOML_HAS_CPP_ATTR
#ifndef TOML_HAS_CPP_ATTR
#ifdef __has_cpp_attribute
#define TOML_HAS_CPP_ATTR(attr) __has_cpp_attribute(attr)
#else
#define TOML_HAS_CPP_ATTR(attr) 0
#endif
#endif
// TOML_ATTR (gnu attributes)
#ifndef TOML_ATTR
#if TOML_CLANG || TOML_GCC_LIKE
#define TOML_ATTR(...) __attribute__((__VA_ARGS__))
#else
#define TOML_ATTR(...)
#endif
#endif
// TOML_DECLSPEC (msvc attributes)
#ifndef TOML_DECLSPEC
#if TOML_MSVC_LIKE
#define TOML_DECLSPEC(...) __declspec(__VA_ARGS__)
#else
#define TOML_DECLSPEC(...)
#endif
#endif
// TOML_COMPILER_HAS_EXCEPTIONS
#ifndef TOML_COMPILER_HAS_EXCEPTIONS
#if defined(__EXCEPTIONS) || defined(_CPPUNWIND) || defined(__cpp_exceptions)
#define TOML_COMPILER_HAS_EXCEPTIONS 1
#else
#define TOML_COMPILER_HAS_EXCEPTIONS 0
#endif
#endif
// TOML_COMPILER_HAS_RTTI
#ifndef TOML_COMPILER_HAS_RTTI
#if defined(_CPPRTTI) || defined(__GXX_RTTI) || TOML_HAS_FEATURE(cxx_rtti)
#define TOML_COMPILER_HAS_RTTI 1
#else
#define TOML_COMPILER_HAS_RTTI 0
#endif
// TOML_ATTR (gnu attributes)
#if TOML_CLANG || TOML_GCC || defined(__GNUC__)
#define TOML_ATTR(...) __attribute__((__VA_ARGS__))
#else
#define TOML_ATTR(...)
#endif
// TOML_DECLSPEC (msvc attributes)
#ifdef _MSC_VER
#define TOML_DECLSPEC(...) __declspec(__VA_ARGS__)
#else
#define TOML_DECLSPEC(...)
#endif
// TOML_CONCAT
@ -237,6 +358,11 @@
#else
#define TOML_PRAGMA_CLANG(decl)
#endif
#if TOML_CLANG >= 8
#define TOML_PRAGMA_CLANG_GE_8(decl) TOML_PRAGMA_CLANG(decl)
#else
#define TOML_PRAGMA_CLANG_GE_8(decl)
#endif
#if TOML_CLANG >= 9
#define TOML_PRAGMA_CLANG_GE_9(decl) TOML_PRAGMA_CLANG(decl)
#else
@ -321,23 +447,51 @@
#endif
// pure + const
// clang-format off
#ifndef TOML_PURE
#ifdef NDEBUG
#define TOML_PURE TOML_DECLSPEC(noalias) TOML_ATTR(__pure__)
#define TOML_CONST TOML_DECLSPEC(noalias) TOML_ATTR(__const__)
#define TOML_PURE_GETTER TOML_NODISCARD TOML_PURE
#define TOML_CONST_GETTER TOML_NODISCARD TOML_CONST
#define TOML_PURE_INLINE_GETTER TOML_NODISCARD TOML_ALWAYS_INLINE TOML_PURE
#define TOML_CONST_INLINE_GETTER TOML_NODISCARD TOML_ALWAYS_INLINE TOML_CONST
#define TOML_PURE \
TOML_DECLSPEC(noalias) \
TOML_ATTR(pure)
#else
#define TOML_PURE
#define TOML_CONST
#define TOML_PURE_GETTER TOML_NODISCARD
#define TOML_CONST_GETTER TOML_NODISCARD
#define TOML_PURE_INLINE_GETTER TOML_NODISCARD TOML_ALWAYS_INLINE
#define TOML_CONST_INLINE_GETTER TOML_NODISCARD TOML_ALWAYS_INLINE
#define TOML_PURE
#endif
#endif
#ifndef TOML_CONST
#ifdef NDEBUG
#define TOML_CONST \
TOML_DECLSPEC(noalias) \
TOML_ATTR(const)
#else
#define TOML_CONST
#endif
#endif
#ifndef TOML_INLINE_GETTER
#define TOML_INLINE_GETTER \
TOML_NODISCARD \
TOML_ALWAYS_INLINE
#endif
#ifndef TOML_PURE_GETTER
#define TOML_PURE_GETTER \
TOML_NODISCARD \
TOML_PURE
#endif
#ifndef TOML_PURE_INLINE_GETTER
#define TOML_PURE_INLINE_GETTER \
TOML_NODISCARD \
TOML_ALWAYS_INLINE \
TOML_PURE
#endif
#ifndef TOML_CONST_GETTER
#define TOML_CONST_GETTER \
TOML_NODISCARD \
TOML_CONST
#endif
#ifndef TOML_CONST_INLINE_GETTER
#define TOML_CONST_INLINE_GETTER \
TOML_NODISCARD \
TOML_ALWAYS_INLINE \
TOML_CONST
#endif
// clang-format on
// TOML_ASSUME
#ifdef _MSC_VER
@ -495,6 +649,7 @@
static_assert(true)
#define TOML_DISABLE_ARITHMETIC_WARNINGS \
TOML_PRAGMA_CLANG_GE_10(diagnostic ignored "-Wimplicit-int-float-conversion") \
TOML_PRAGMA_CLANG(diagnostic ignored "-Wfloat-equal") \
TOML_PRAGMA_CLANG(diagnostic ignored "-Wdouble-promotion") \
TOML_PRAGMA_CLANG(diagnostic ignored "-Wchar-subscripts") \
@ -502,6 +657,7 @@
static_assert(true)
#define TOML_DISABLE_SPAM_WARNINGS \
TOML_PRAGMA_CLANG_GE_8(diagnostic ignored "-Wdefaulted-function-deleted") \
TOML_PRAGMA_CLANG_GE_9(diagnostic ignored "-Wctad-maybe-unsupported") \
TOML_PRAGMA_CLANG_GE_10(diagnostic ignored "-Wzero-as-null-pointer-constant") \
TOML_PRAGMA_CLANG_GE_11(diagnostic ignored "-Wsuggest-destructor-override") \

View File

@ -841,49 +841,51 @@ TOML_NAMESPACE_START
using for_each_value_ref = impl::copy_cvref<impl::wrap_node<impl::remove_cvref<impl::unwrap_node<T>>>, Table>;
template <typename Func, typename Table, typename T>
static constexpr bool can_for_each = std::is_invocable_v<Func, const key&, for_each_value_ref<T, Table>> //
|| std::is_invocable_v<Func, for_each_value_ref<T, Table>>;
using can_for_each = std::disjunction<std::is_invocable<Func, const key&, for_each_value_ref<T, Table>>, //
std::is_invocable<Func, for_each_value_ref<T, Table>>>;
template <typename Func, typename Table, typename T>
static constexpr bool can_for_each_nothrow =
std::is_nothrow_invocable_v<Func, const key&, for_each_value_ref<T, Table>> //
|| std::is_nothrow_invocable_v<Func, for_each_value_ref<T, Table>>;
using can_for_each_nothrow = std::conditional_t<
// first form
std::is_invocable_v<Func, const key&, for_each_value_ref<T, Table>>,
std::is_nothrow_invocable<Func, const key&, for_each_value_ref<T, Table>>,
std::conditional_t<
// second form
std::is_invocable_v<Func, for_each_value_ref<T, Table>>,
std::is_nothrow_invocable<Func, for_each_value_ref<T, Table>>,
std::false_type>>;
template <typename Func, typename Table>
static constexpr bool can_for_each_any = can_for_each<Func, Table, table> //
|| can_for_each<Func, Table, array> //
|| can_for_each<Func, Table, std::string> //
|| can_for_each<Func, Table, int64_t> //
|| can_for_each<Func, Table, double> //
|| can_for_each<Func, Table, bool> //
|| can_for_each<Func, Table, date> //
|| can_for_each<Func, Table, time> //
|| can_for_each<Func, Table, date_time>;
using can_for_each_any = std::disjunction<can_for_each<Func, Table, table>,
can_for_each<Func, Table, array>,
can_for_each<Func, Table, std::string>,
can_for_each<Func, Table, int64_t>,
can_for_each<Func, Table, double>,
can_for_each<Func, Table, bool>,
can_for_each<Func, Table, date>,
can_for_each<Func, Table, time>,
can_for_each<Func, Table, date_time>>;
template <typename Func, typename Table, typename T>
static constexpr bool for_each_is_nothrow_one = !can_for_each<Func, Table, T> //
|| can_for_each_nothrow<Func, Table, T>;
// clang-format off
template <typename Func, typename Table>
static constexpr bool for_each_is_nothrow = for_each_is_nothrow_one<Func, Table, table> //
&& for_each_is_nothrow_one<Func, Table, array> //
&& for_each_is_nothrow_one<Func, Table, std::string> //
&& for_each_is_nothrow_one<Func, Table, int64_t> //
&& for_each_is_nothrow_one<Func, Table, double> //
&& for_each_is_nothrow_one<Func, Table, bool> //
&& for_each_is_nothrow_one<Func, Table, date> //
&& for_each_is_nothrow_one<Func, Table, time> //
&& for_each_is_nothrow_one<Func, Table, date_time>;
// clang-format on
using for_each_is_nothrow_one = std::disjunction<std::negation<can_for_each<Func, Table, T>>, //
can_for_each_nothrow<Func, Table, T>>;
template <typename Func, typename Table>
static void do_for_each(Func&& visitor, Table&& tbl) noexcept(for_each_is_nothrow<Func&&, Table&&>)
using for_each_is_nothrow = std::conjunction<for_each_is_nothrow_one<Func, Table, table>,
for_each_is_nothrow_one<Func, Table, array>,
for_each_is_nothrow_one<Func, Table, std::string>,
for_each_is_nothrow_one<Func, Table, int64_t>,
for_each_is_nothrow_one<Func, Table, double>,
for_each_is_nothrow_one<Func, Table, bool>,
for_each_is_nothrow_one<Func, Table, date>,
for_each_is_nothrow_one<Func, Table, time>,
for_each_is_nothrow_one<Func, Table, date_time>>;
template <typename Func, typename Table>
static void do_for_each(Func&& visitor, Table&& tbl) //
noexcept(for_each_is_nothrow<Func&&, Table&&>::value)
{
static_assert(can_for_each_any<Func&&, Table&&>,
static_assert(can_for_each_any<Func&&, Table&&>::value,
"TOML table for_each visitors must be invocable for at least one of the toml::node "
"specializations:" TOML_SA_NODE_TYPE_LIST);
@ -894,13 +896,41 @@ TOML_NAMESPACE_START
using node_ref = impl::copy_cvref<toml::node, Table&&>;
static_assert(std::is_reference_v<node_ref>);
#if TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN
#ifndef TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN_ACKNOWLEDGED
static_assert(impl::always_false<Func, Table, kvp_type, node_ref>, //
TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN_MESSAGE);
#endif
static_cast<node_ref>(*kvp.second)
.visit(
[&]([[maybe_unused]] auto&& v) //
noexcept(for_each_is_nothrow_one<Func&&, Table&&, decltype(v)>::value)
{
using value_ref = for_each_value_ref<decltype(v), Table&&>;
static_assert(std::is_reference_v<value_ref>);
// func(key, val)
if constexpr (std::is_invocable_v<Func&&, const key&, value_ref>)
{
static_cast<Func&&>(visitor)(static_cast<const key&>(kvp.first),
static_cast<value_ref>(v));
}
// func(val)
else if constexpr (std::is_invocable_v<Func&&, value_ref>)
{
static_cast<Func&&>(visitor)(static_cast<value_ref>(v));
}
});
#else
const auto keep_going =
static_cast<node_ref>(*kvp.second)
.visit(
[&](auto&& v)
#if !TOML_MSVC // MSVC thinks this is invalid syntax O_o
noexcept(for_each_is_nothrow_one<Func&&, Table&&, decltype(v)>)
#endif
[&]([[maybe_unused]] auto&& v) //
noexcept(for_each_is_nothrow_one<Func&&, Table&&, decltype(v)>::value)
{
using value_ref = for_each_value_ref<decltype(v), Table&&>;
static_assert(std::is_reference_v<value_ref>);
@ -949,6 +979,7 @@ TOML_NAMESPACE_START
if (!keep_going)
return;
#endif
}
}
@ -1037,7 +1068,8 @@ TOML_NAMESPACE_START
///
/// \see node::visit()
template <typename Func>
table& for_each(Func&& visitor) & noexcept(for_each_is_nothrow<Func&&, table&>)
table& for_each(Func&& visitor) & //
noexcept(for_each_is_nothrow<Func&&, table&>::value)
{
do_for_each(static_cast<Func&&>(visitor), *this);
return *this;
@ -1045,7 +1077,8 @@ TOML_NAMESPACE_START
/// \brief Invokes a visitor on each key-value pair in the table (rvalue overload).
template <typename Func>
table&& for_each(Func&& visitor) && noexcept(for_each_is_nothrow<Func&&, table&&>)
table&& for_each(Func&& visitor) && //
noexcept(for_each_is_nothrow<Func&&, table&&>::value)
{
do_for_each(static_cast<Func&&>(visitor), static_cast<table&&>(*this));
return static_cast<table&&>(*this);
@ -1053,7 +1086,8 @@ TOML_NAMESPACE_START
/// \brief Invokes a visitor on each key-value pair in the table (const lvalue overload).
template <typename Func>
const table& for_each(Func&& visitor) const& noexcept(for_each_is_nothrow<Func&&, const table&>)
const table& for_each(Func&& visitor) const& //
noexcept(for_each_is_nothrow<Func&&, const table&>::value)
{
do_for_each(static_cast<Func&&>(visitor), *this);
return *this;
@ -1061,7 +1095,8 @@ TOML_NAMESPACE_START
/// \brief Invokes a visitor on each key-value pair in the table (const rvalue overload).
template <typename Func>
const table&& for_each(Func&& visitor) const&& noexcept(for_each_is_nothrow<Func&&, const table&&>)
const table&& for_each(Func&& visitor) const&& //
noexcept(for_each_is_nothrow<Func&&, const table&&>::value)
{
do_for_each(static_cast<Func&&>(visitor), static_cast<const table&&>(*this));
return static_cast<const table&&>(*this);
@ -1216,7 +1251,7 @@ TOML_NAMESPACE_START
return contains(impl::narrow(key));
}
#endif // TOML_ENABLE_WINDOWS_COMPAT
#endif // TOML_ENABLE_WINDOWS_COMPAT
/// @}
@ -1448,7 +1483,7 @@ TOML_NAMESPACE_START
impl::narrow(static_cast<KeyType&&>(key)),
static_cast<ValueArgs&&>(args)...);
#else
static_assert(impl::dependent_false<KeyType>, "Evaluated unreachable branch!");
static_assert(impl::always_false<KeyType>, "Evaluated unreachable branch!");
#endif
}
else
@ -1567,7 +1602,7 @@ TOML_NAMESPACE_START
#if TOML_ENABLE_WINDOWS_COMPAT
return insert(impl::narrow(static_cast<KeyType&&>(key)), static_cast<ValueType&&>(val), flags);
#else
static_assert(impl::dependent_false<KeyType>, "Evaluated unreachable branch!");
static_assert(impl::always_false<KeyType>, "Evaluated unreachable branch!");
#endif
}
else
@ -1714,7 +1749,7 @@ TOML_NAMESPACE_START
static_cast<ValueType&&>(val),
flags);
#else
static_assert(impl::dependent_false<KeyType>, "Evaluated unreachable branch!");
static_assert(impl::always_false<KeyType>, "Evaluated unreachable branch!");
#endif
}
else
@ -1793,7 +1828,7 @@ TOML_NAMESPACE_START
return emplace<value_type>(impl::narrow(static_cast<KeyType&&>(key)),
static_cast<ValueArgs&&>(args)...);
#else
static_assert(impl::dependent_false<KeyType>, "Evaluated unreachable branch!");
static_assert(impl::always_false<KeyType>, "Evaluated unreachable branch!");
#endif
}
else
@ -1900,7 +1935,7 @@ TOML_NAMESPACE_START
return node_view<const node>{ get(key) };
}
#endif // TOML_ENABLE_WINDOWS_COMPAT
#endif // TOML_ENABLE_WINDOWS_COMPAT
/// @}

View File

@ -168,7 +168,7 @@ TOML_IMPL_NAMESPACE_START
const auto type = state_table[byte];
codepoint = static_cast<char32_t>(has_code_point() ? (uint_least32_t{ 255u } >> type) & byte
: (byte& uint_least32_t{ 63u })
: (byte & uint_least32_t{ 63u })
| (static_cast<uint_least32_t>(codepoint) << 6));
state = state_table[state + uint_least32_t{ 256u } + type];

View File

@ -1011,7 +1011,7 @@ TOML_NAMESPACE_START
#if TOML_ENABLE_WINDOWS_COMPAT
return widen(str);
#else
static_assert(dependent_false<T>, "Evaluated unreachable branch!");
static_assert(always_false<T>, "Evaluated unreachable branch!");
#endif
}
@ -1023,7 +1023,7 @@ TOML_NAMESPACE_START
else if constexpr (std::is_same_v<T, const char8_t*>)
return reinterpret_cast<const char8_t*>(str.c_str());
else
static_assert(dependent_false<T>, "Evaluated unreachable branch!");
static_assert(always_false<T>, "Evaluated unreachable branch!");
#endif
}
@ -1191,7 +1191,7 @@ TOML_NAMESPACE_START
#else
static_assert(dependent_false<T>, "Evaluated unreachable branch!");
static_assert(always_false<T>, "Evaluated unreachable branch!");
#endif
}

View File

@ -92,7 +92,9 @@ TOML_POP_WARNINGS;
#undef TOML_ARCH_ARM
#undef TOML_ARCH_ARM32
#undef TOML_ARCH_ARM64
#undef TOML_ARCH_BITNESS
#undef TOML_ARCH_ITANIUM
#undef TOML_ARCH_X64
#undef TOML_ARCH_X86
#undef TOML_ASSERT
#undef TOML_ASSERT_ASSUME
@ -138,6 +140,7 @@ TOML_POP_WARNINGS;
#undef TOML_FLOAT16_MIN_10_EXP
#undef TOML_FLOAT16_MIN_EXP
#undef TOML_GCC
#undef TOML_GCC_LIKE
#undef TOML_HAS_ATTR
#undef TOML_HAS_BUILTIN
#undef TOML_HAS_CHAR8
@ -154,6 +157,7 @@ TOML_POP_WARNINGS;
#undef TOML_IMPL_NAMESPACE_START
#undef TOML_IMPLEMENTATION
#undef TOML_INCLUDE_WINDOWS_H
#undef TOML_INLINE_GETTER
#undef TOML_INT_CHARCONV
#undef TOML_INT128
#undef TOML_INTELLISENSE
@ -166,6 +170,7 @@ TOML_POP_WARNINGS;
#undef TOML_LIFETIME_HOOKS
#undef TOML_LIKELY
#undef TOML_LIKELY_CASE
#undef TOML_LINUX
#undef TOML_MAKE_FLAGS
#undef TOML_MAKE_FLAGS_
#undef TOML_MAKE_FLAGS_1
@ -174,6 +179,7 @@ TOML_POP_WARNINGS;
#undef TOML_MAKE_STRING_1
#undef TOML_MAKE_VERSION
#undef TOML_MSVC
#undef TOML_MSVC_LIKE
#undef TOML_NAMESPACE
#undef TOML_NEVER_INLINE
#undef TOML_NODISCARD
@ -185,6 +191,7 @@ TOML_POP_WARNINGS;
#undef TOML_PRAGMA_CLANG
#undef TOML_PRAGMA_CLANG_GE_10
#undef TOML_PRAGMA_CLANG_GE_11
#undef TOML_PRAGMA_CLANG_GE_8
#undef TOML_PRAGMA_CLANG_GE_9
#undef TOML_PRAGMA_GCC
#undef TOML_PRAGMA_ICC
@ -194,6 +201,8 @@ TOML_POP_WARNINGS;
#undef TOML_PURE_INLINE_GETTER
#undef TOML_PUSH_WARNINGS
#undef TOML_REQUIRES
#undef TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN
#undef TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN_MESSAGE
#undef TOML_SA_LIST_BEG
#undef TOML_SA_LIST_END
#undef TOML_SA_LIST_NEW
@ -211,6 +220,7 @@ TOML_POP_WARNINGS;
#undef TOML_SIMPLE_STATIC_ASSERT_MESSAGES
#undef TOML_TRIVIAL_ABI
#undef TOML_UINT128
#undef TOML_UNIX
#undef TOML_UNLIKELY
#undef TOML_UNLIKELY_CASE
#undef TOML_UNREACHABLE

View File

@ -507,16 +507,16 @@ zyx = 42)"sv;
zyx = 42)"sv;
static constexpr auto table_quoted_no_close = R"(["where will it end]
name = value)"sv;
static constexpr auto table_redefine = R"(# Define b as int, and try to use it as a table: error
static constexpr auto table_redefine = R"(# Define b as int, and try to use it as a table: error
[a]
b = 1
[a.b]
c = 2)"sv;
static constexpr auto table_rrbrace = R"([[table] ])"sv;
static constexpr auto table_text_after_table = R"([error] this shouldn't be here)"sv;
static constexpr auto table_whitespace = R"([invalid key])"sv;
static constexpr auto table_with_pound = R"([key#group]
static constexpr auto table_rrbrace = R"([[table] ])"sv;
static constexpr auto table_text_after_table = R"([error] this shouldn't be here)"sv;
static constexpr auto table_whitespace = R"([invalid key])"sv;
static constexpr auto table_with_pound = R"([key#group]
answer = 42)"sv;
}

View File

@ -194,6 +194,8 @@ TEST_CASE("array::for_each")
CHECK(arr2 == toml::array{ 0, 1, 2, 6 });
}
#if !TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN
// check that early-stopping works
{
toml::array arr2;
@ -210,6 +212,8 @@ TEST_CASE("array::for_each")
});
CHECK(arr2 == toml::array{ 0, 1, 2, 3.0 });
}
#endif
}
TEST_CASE("table::for_each")
@ -356,6 +360,8 @@ TEST_CASE("table::for_each")
{ "six", 6 } });
}
#if !TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN
// check that early-stopping works
{
toml::table tbl2;
@ -369,4 +375,6 @@ TEST_CASE("table::for_each")
});
CHECK(tbl2.size() == 3u);
}
#endif
}

View File

@ -587,6 +587,8 @@ TEST_CASE("arrays - for_each")
CHECK(bools == 1);
}
#if !TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN
SECTION("early-exit (elem, index)")
{
int count = 0;
@ -622,4 +624,6 @@ TEST_CASE("arrays - for_each")
});
CHECK(count == 4);
}
#endif
}

View File

@ -652,6 +652,8 @@ TEST_CASE("tables - for_each")
CHECK(bools == 1);
}
#if !TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN
SECTION("early-exit (key, val)")
{
int count = 0;
@ -665,4 +667,6 @@ TEST_CASE("tables - for_each")
tbl.for_each([&](const auto& /*v*/) noexcept -> bool { return ++count < 3; });
CHECK(count == 3);
}
#endif
}

View File

@ -59,7 +59,7 @@ TEST_CASE("values - construction")
#endif
else
{
static_assert(impl::dependent_false<init_char_type>, "evaluated unreachable branch");
static_assert(impl::always_false<init_char_type>, "evaluated unreachable branch");
}
}
else if constexpr (impl::is_one_of<native_type, int64_t, double, bool>)

View File

@ -16,7 +16,7 @@
#define USE_SINGLE_HEADER 0
#endif
#if defined(LEAK_TESTS) && LEAK_TESTS
#define TOML_CONFIG_HEADER "leakproof.h"
#define TOML_CONFIG_HEADER "leakproof.hpp"
#else
#undef LEAK_TESTS
#define LEAK_TESTS 0

View File

@ -129,7 +129,7 @@ TEST_CASE("user feedback")
});
}
SECTION("tomlplusplus/issues/69") // https://github.com/marzer/tomlplusplus/issues/69
SECTION("tomlplusplus/issues/69") // https://github.com/marzer/tomlplusplus/issues/69
{
using namespace toml::literals; // should compile without namespace ambiguity
auto table = "[table]\nkey=\"value\""_toml;

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -37,7 +37,7 @@
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Sync</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -6,6 +6,7 @@
],
"settings": {
"files.associations": {
"*.in": "plaintext",
"type_traits": "cpp",
"concepts": "cpp",
"cstddef": "cpp",
@ -15,7 +16,84 @@
"xstddef": "cpp",
"xtr1common": "cpp",
"version": "cpp",
"xstring": "cpp"
"xstring": "cpp",
"algorithm": "cpp",
"cmath": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"condition_variable": "cpp",
"cstdio": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"deque": "cpp",
"exception": "cpp",
"coroutine": "cpp",
"forward_list": "cpp",
"list": "cpp",
"map": "cpp",
"resumable": "cpp",
"set": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"filesystem": "cpp",
"format": "cpp",
"fstream": "cpp",
"functional": "cpp",
"future": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"locale": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"numeric": "cpp",
"optional": "cpp",
"ostream": "cpp",
"random": "cpp",
"ranges": "cpp",
"ratio": "cpp",
"regex": "cpp",
"span": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"typeinfo": "cpp",
"utility": "cpp",
"valarray": "cpp",
"variant": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xtree": "cpp",
"xutility": "cpp"
},
"explorer.sortOrder": "type",
"C_Cpp.default.compileCommands": "builddir\\compile_commands.json"

642
toml.hpp

File diff suppressed because it is too large Load Diff

View File

@ -80,7 +80,7 @@ def main():
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>{exceptions}</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES={unreleased_features};%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>