added tests for visit()

Also some minor refactors.
This commit is contained in:
Mark Gillard 2022-04-23 17:28:25 +03:00
parent af637f7e89
commit db04ac8918
44 changed files with 244 additions and 15 deletions

View File

@ -36,6 +36,8 @@ template:
- Meson: Use system dependencies where available when building tests (@Tachi107)
<br><br>
## [v3.0.1](https://github.com/marzer/tomlplusplus/releases/tag/v3.0.1) - 2022-01-13
@ -47,6 +49,8 @@ this release holds nothing of value over v3.0.0.
- fixed erroneous use of `TOML_API` causing ODR issue (#136) (@Azarael)
<br><br>
## [v3.0.0](https://github.com/marzer/tomlplusplus/releases/tag/v3.0.0) - 2022-01-11
@ -137,6 +141,8 @@ Any changes that are likely to cause migration issues (API changes, build system
- used `override_dependency` where supported (#116) (@Tachi107)
<br><br>
## [v2.5.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.5.0) - 2021-07-11
@ -158,6 +164,8 @@ Any changes that are likely to cause migration issues (API changes, build system
- updated conformance tests
<br><br>
## [v2.4.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.4.0) - 2021-05-19
@ -186,6 +194,8 @@ Any changes that are likely to cause migration issues (API changes, build system
- removed explicit `#include <fstream>` requirement for `parse_file()`
<br><br>
## [v2.3.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.3.0) - 2020-12-29
@ -202,6 +212,8 @@ Any changes that are likely to cause migration issues (API changes, build system
- fixed some parser crashes when given pathologically-malformed UTF-8 (#65) (@sneves)
<br><br>
## [v2.2.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.2.0) - 2020-08-09
@ -230,6 +242,8 @@ Any changes that are likely to cause migration issues (API changes, build system
- bumped minimum meson version to 0.53
<br><br>
## [v2.1.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.1.0) - 2020-07-11
@ -257,6 +271,8 @@ Any changes that are likely to cause migration issues (API changes, build system
- general cleanup
<br><br>
## [v2.0.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.0.0) - 2020-07-20
@ -300,6 +316,8 @@ break (hence the version number bump). Changes that might block a migration are
- ⚠&#xFE0F; removed `TOML_CHAR_8_STRINGS` since it no longer makes sense
<br><br>
## [v1.3.3](https://github.com/marzer/tomlplusplus/releases/tag/v1.3.3) - 2020-06-29
@ -320,6 +338,8 @@ break (hence the version number bump). Changes that might block a migration are
- refactored the parser to reduce binary size
<br><br>
## [v1.3.2](https://github.com/marzer/tomlplusplus/releases/tag/v1.3.2) - 2020-06-19
@ -334,6 +354,8 @@ break (hence the version number bump). Changes that might block a migration are
- improved the performance of printing to streams for deepy-nested TOML data
<br><br>
## [v1.3.0](https://github.com/marzer/tomlplusplus/releases/tag/v1.3.0) - 2020-06-02
@ -353,6 +375,8 @@ break (hence the version number bump). Changes that might block a migration are
- renamed table iterator proxy pair members to `first` and `second` to match STL
<br><br>
## [v1.2.5](https://github.com/marzer/tomlplusplus/releases/tag/v1.2.5) - 2020-04-24
@ -372,6 +396,8 @@ break (hence the version number bump). Changes that might block a migration are
- improved unicode-related codegen
<br><br>
## [v1.2.3](https://github.com/marzer/tomlplusplus/releases/tag/v1.2.3) - 2020-04-11
@ -393,6 +419,8 @@ break (hence the version number bump). Changes that might block a migration are
- refactored and greatly simplified parser
<br><br>
## [v1.2.0](https://github.com/marzer/tomlplusplus/releases/tag/v1.2.0) - 2020-04-07
@ -410,6 +438,8 @@ break (hence the version number bump). Changes that might block a migration are
- added many new tests
<br><br>
## [v1.1.0](https://github.com/marzer/tomlplusplus/releases/tag/v1.1.0) - 2020-04-03
@ -427,6 +457,8 @@ break (hence the version number bump). Changes that might block a migration are
- added the array and table iterators to the `toml` namespace
<br><br>
## [v1.0.0](https://github.com/marzer/tomlplusplus/releases/tag/1.0.0) - 2020-03-28
@ -437,6 +469,8 @@ break (hence the version number bump). Changes that might block a migration are
- refactoring of ABI-based inline namespaces
<br><br>
## [v0.6.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.6.0) - 2020-03-24
@ -449,6 +483,8 @@ break (hence the version number bump). Changes that might block a migration are
- added Clang's `[[trivial_abi]]` attribute to `date`, `time`, `time_offset`
<br><br>
## [v0.5.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.5.0) - 2020-03-18
@ -467,6 +503,8 @@ break (hence the version number bump). Changes that might block a migration are
- added build configuration option for compiling examples
<br><br>
## [v0.4.3](https://github.com/marzer/tomlplusplus/releases/tag/v0.4.3) - 2020-03-10
@ -480,6 +518,8 @@ break (hence the version number bump). Changes that might block a migration are
- parsing performance improvements
<br><br>
## [v0.4.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.4.0) - 2020-03-05
@ -494,6 +534,8 @@ break (hence the version number bump). Changes that might block a migration are
- added `node::ref()` and `node_view::ref()`
<br><br>
## [v0.3.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.3.0) - 2020-03-01
@ -512,6 +554,8 @@ break (hence the version number bump). Changes that might block a migration are
- removed `<cmath>` dependency
<br><br>
## [v0.2.1](https://github.com/marzer/tomlplusplus/releases/tag/v0.2.1) - 2020-02-26
@ -526,6 +570,8 @@ break (hence the version number bump). Changes that might block a migration are
- improved quality of error messages for boolean and inf/nan parsing
<br><br>
## [v0.2.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.2.0) - 2020-02-23
@ -543,6 +589,8 @@ break (hence the version number bump). Changes that might block a migration are
- added hexfloat parsing support for all implementations (not just `<charconv>` ones)
<br><br>
## [v0.1.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.1.0) - 2020-02-20

View File

@ -64,6 +64,9 @@ cd build-gcc-debug && ninja && ninja test \
&& cd ..
```
> &#xFE0F; Note: To ensure parity between single-header and regular versions of the library, 50% of the tests
will be compiled using one, and 50% with the other. Ensure you've regenerated toml.hpp before running tests.
<br>
## Testing with the [toml-test] suite

View File

@ -4,7 +4,7 @@
[![C++20](docs/images/badge-C++20.svg)][cpp_compilers]
[![TOML](docs/images/badge-TOML.svg)][v1.0.0]
[![MIT license](docs/images/badge-license-MIT.svg)](./LICENSE)
[![ci](https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml/badge.svg)](https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml)
[![ci](https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml/badge.svg?branch=master)](https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml)
[![Mentioned in Awesome C++](docs/images/badge-awesome.svg)](https://github.com/fffaraz/awesome-cpp)
====

View File

@ -68,9 +68,9 @@ string_literals = [ '_toml' ]
'badge-TOML.svg',
'https://toml.io/en/v1.0.0'
]
'3. CircleCI' = [
'https://img.shields.io/circleci/build/github/marzer/tomlplusplus?label=circle%20ci&logo=circleci&logoColor=white&style=flat-square',
'https://circleci.com/gh/marzer/tomlplusplus'
'3. CI' = [
'https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml/badge.svg?branch=master',
'https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml'
]
'4. Mentioned in Awesome C++' = [
'badge-awesome.svg',

View File

@ -797,10 +797,6 @@ TOML_NAMESPACE_START
template <typename A, typename B>
using nonvoid = std::conditional_t<std::is_void_v<A>, B, A>;
//# these functions are static helpers to preserve const and ref categories
//# (otherwise I'd have to implement them thrice)
//# ((propagation in C++: a modern horror story))
template <typename N, typename Func>
static decltype(auto) do_visit(N&& n, Func&& visitor) noexcept(visit_is_nothrow<Func&&, N&&>)
{

View File

@ -72,9 +72,6 @@ TOML_NAMESPACE_START
mutable viewed_type* node_ = nullptr;
template <typename Func>
static constexpr bool visit_is_nothrow = noexcept(std::declval<viewed_type*>()->visit(std::declval<Func&&>()));
public:
/// \brief Constructs an empty node view.
TOML_NODISCARD_CTOR
@ -567,6 +564,13 @@ TOML_NAMESPACE_START
/// \name Visitation
/// @{
private:
/// \cond
template <typename Func>
static constexpr bool visit_is_nothrow = noexcept(std::declval<viewed_type*>()->visit(std::declval<Func&&>()));
/// \endcond
public:
/// \brief Invokes a visitor on the viewed node based on its concrete type.
///
/// \remarks Has no effect if the view does not reference a node.

View File

@ -323,6 +323,7 @@
_Pragma("GCC diagnostic ignored \"-Wsubobject-linkage\"") \
_Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") \
_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \
_Pragma("GCC diagnostic ignored \"-Wnoexcept\"") \
static_assert(true)
#define TOML_POP_WARNINGS \

View File

@ -85,7 +85,6 @@ if is_gcc
'-Wmissing-format-attribute',
'-Wmissing-include-dirs',
'-Wmissing-noreturn',
'-Wnoexcept',
'-Wold-style-cast',
'-Woverloaded-virtual',
'-Wpacked',

View File

@ -21,6 +21,7 @@ test_sources = [
'manipulating_arrays.cpp',
'manipulating_tables.cpp',
'manipulating_values.cpp',
'visit.cpp',
'user_feedback.cpp',
'using_iterators.cpp',
'windows_compat.cpp'

139
tests/visit.cpp Normal file
View File

@ -0,0 +1,139 @@
// This file is a part of toml++ and is subject to the the terms of the MIT license.
// Copyright (c) Mark Gillard <mark.gillard@outlook.com.au>
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
TOML_DISABLE_SPAM_WARNINGS;
TEST_CASE("node::visit")
{
value<int64_t> val{ 3 };
// check lvalue propagates correctly
static_cast<node&>(val).visit(
[](auto&& v) noexcept
{
using val_ref_type = decltype(v);
static_assert(std::is_lvalue_reference_v<val_ref_type>);
using val_type = std::remove_reference_t<val_ref_type>;
static_assert(!std::is_const_v<val_type>);
static_assert(!std::is_volatile_v<val_type>);
});
// check rvalue propagates correctly
static_cast<node&&>(val).visit(
[](auto&& v) noexcept
{
using val_ref_type = decltype(v);
static_assert(std::is_rvalue_reference_v<val_ref_type>);
using val_type = std::remove_reference_t<val_ref_type>;
static_assert(!std::is_const_v<val_type>);
static_assert(!std::is_volatile_v<val_type>);
});
// check const lvalue propagates correctly
static_cast<const node&>(val).visit(
[](auto&& v) noexcept
{
using val_ref_type = decltype(v);
static_assert(std::is_lvalue_reference_v<val_ref_type>);
using val_type = std::remove_reference_t<val_ref_type>;
static_assert(std::is_const_v<val_type>);
static_assert(!std::is_volatile_v<val_type>);
});
// check const rvalue propagates correctly
static_cast<const node&&>(val).visit(
[](auto&& v) noexcept
{
using val_ref_type = decltype(v);
static_assert(std::is_rvalue_reference_v<val_ref_type>);
using val_type = std::remove_reference_t<val_ref_type>;
static_assert(std::is_const_v<val_type>);
static_assert(!std::is_volatile_v<val_type>);
});
// check noexcept
static constexpr auto throwing_visitor = [](auto&&) noexcept(false) {};
static constexpr auto non_throwing_visitor = [](auto&&) noexcept(true) {};
static_assert(!noexcept(static_cast<node&>(val).visit(throwing_visitor)));
static_assert(!noexcept(static_cast<node&&>(val).visit(throwing_visitor)));
static_assert(!noexcept(static_cast<const node&>(val).visit(throwing_visitor)));
static_assert(!noexcept(static_cast<const node&&>(val).visit(throwing_visitor)));
static_assert(noexcept(static_cast<node&>(val).visit(non_throwing_visitor)));
static_assert(noexcept(static_cast<node&&>(val).visit(non_throwing_visitor)));
static_assert(noexcept(static_cast<const node&>(val).visit(non_throwing_visitor)));
static_assert(noexcept(static_cast<const node&&>(val).visit(non_throwing_visitor)));
// check return
static constexpr auto returns_boolean = [](auto& v) noexcept { return toml::is_integer<decltype(v)>; };
auto return_test = static_cast<node&>(val).visit(returns_boolean);
static_assert(std::is_same_v<decltype(return_test), bool>);
CHECK(return_test == true);
}
TEST_CASE("node_view::visit")
{
value<int64_t> val{ 3 };
auto view = node_view{ val };
auto cview = node_view{ std::as_const(val) };
static_assert(!std::is_same_v<decltype(view), decltype(cview)>);
// check mutable views propagate correctly
view.visit(
[](auto&& v) noexcept
{
using val_ref_type = decltype(v);
static_assert(std::is_lvalue_reference_v<val_ref_type>);
using val_type = std::remove_reference_t<val_ref_type>;
static_assert(!std::is_const_v<val_type>);
static_assert(!std::is_volatile_v<val_type>);
});
// check const views propagate correctly
cview.visit(
[](auto&& v) noexcept
{
using val_ref_type = decltype(v);
static_assert(std::is_lvalue_reference_v<val_ref_type>);
using val_type = std::remove_reference_t<val_ref_type>;
static_assert(std::is_const_v<val_type>);
static_assert(!std::is_volatile_v<val_type>);
});
// check noexcept
static constexpr auto throwing_visitor = [](auto&&) noexcept(false) {};
static constexpr auto non_throwing_visitor = [](auto&&) noexcept(true) {};
static_assert(!noexcept(view.visit(throwing_visitor)));
static_assert(!noexcept(cview.visit(throwing_visitor)));
static_assert(noexcept(view.visit(non_throwing_visitor)));
static_assert(noexcept(cview.visit(non_throwing_visitor)));
// check return
static constexpr auto returns_boolean = [](auto&& v) noexcept { return toml::is_integer<decltype(v)>; };
auto return_test = view.visit(returns_boolean);
static_assert(std::is_same_v<decltype(return_test), bool>);
CHECK(return_test == true);
// check that null views don't invoke the visitor
// clang-format off
auto null_view = decltype(view){};
auto null_cview = decltype(cview){};
unsigned count{};
unsigned mask{};
view.visit([&](auto&&) noexcept { count++; mask |= 0b0001u; });
cview.visit([&](auto&&) noexcept { count++; mask |= 0b0010u; });
null_view.visit([&](auto&&) noexcept { count++; mask |= 0b0100u; });
null_cview.visit([&](auto&&) noexcept { count++; mask |= 0b1000u; });
CHECK(count == 2u);
CHECK(mask == 0b0011u);
// clang-format on
}

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -104,6 +104,7 @@
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>

View File

@ -347,6 +347,7 @@
_Pragma("GCC diagnostic ignored \"-Wsubobject-linkage\"") \
_Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") \
_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \
_Pragma("GCC diagnostic ignored \"-Wnoexcept\"") \
static_assert(true)
#define TOML_POP_WARNINGS \
@ -3253,9 +3254,6 @@ TOML_NAMESPACE_START
mutable viewed_type* node_ = nullptr;
template <typename Func>
static constexpr bool visit_is_nothrow = noexcept(std::declval<viewed_type*>()->visit(std::declval<Func&&>()));
public:
TOML_NODISCARD_CTOR
@ -3529,6 +3527,13 @@ TOML_NAMESPACE_START
return node_->template ref<T>();
}
private:
template <typename Func>
static constexpr bool visit_is_nothrow = noexcept(std::declval<viewed_type*>()->visit(std::declval<Func&&>()));
public:
template <typename Func>
decltype(auto) visit(Func&& visitor) const noexcept(visit_is_nothrow<Func&&>)
{

View File

@ -147,6 +147,7 @@ def main():
</ClCompile>
<ClCompile Include="..\user_feedback.cpp" />
<ClCompile Include="..\using_iterators.cpp" />
<ClCompile Include="..\visit.cpp" />
<ClCompile Include="..\windows_compat.cpp" />
</ItemGroup>
<ItemGroup>