Skip to content

Commit 85c5128

Browse files
committed
fix for_each() for older MSVC
1 parent bf13bbd commit 85c5128

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

include/toml++/impl/array.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,10 @@ TOML_NAMESPACE_START
887887
const auto keep_going =
888888
static_cast<node_ref>(static_cast<Array&&>(arr)[i])
889889
.visit(
890-
[&](auto&& elem) noexcept(for_each_is_nothrow_one<Func&&, Array&&, decltype(elem)>)
890+
[&](auto&& elem)
891+
#if !TOML_MSVC || TOML_MSVC >= 1932 // older MSVC thinks this is invalid syntax O_o
892+
noexcept(for_each_is_nothrow_one<Func&&, Array&&, decltype(elem)>)
893+
#endif
891894
{
892895
using elem_ref = for_each_elem_ref<decltype(elem), Array&&>;
893896
static_assert(std::is_reference_v<elem_ref>);

include/toml++/impl/table.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,10 @@ TOML_NAMESPACE_START
899899
const auto keep_going =
900900
static_cast<node_ref>(*kvp.second)
901901
.visit(
902-
[&](auto&& v) noexcept(for_each_is_nothrow_one<Func&&, Table&&, decltype(v)>)
902+
[&](auto&& v)
903+
#if !TOML_MSVC || TOML_MSVC >= 1932 // older MSVC thinks this is invalid syntax O_o
904+
noexcept(for_each_is_nothrow_one<Func&&, Table&&, decltype(v)>)
905+
#endif
903906
{
904907
using value_ref = for_each_value_ref<decltype(v), Table&&>;
905908
static_assert(std::is_reference_v<value_ref>);

toml.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5625,7 +5625,10 @@ TOML_NAMESPACE_START
56255625
const auto keep_going =
56265626
static_cast<node_ref>(static_cast<Array&&>(arr)[i])
56275627
.visit(
5628-
[&](auto&& elem) noexcept(for_each_is_nothrow_one<Func&&, Array&&, decltype(elem)>)
5628+
[&](auto&& elem)
5629+
#if !TOML_MSVC || TOML_MSVC >= 1932 // older MSVC thinks this is invalid syntax O_o
5630+
noexcept(for_each_is_nothrow_one<Func&&, Array&&, decltype(elem)>)
5631+
#endif
56295632
{
56305633
using elem_ref = for_each_elem_ref<decltype(elem), Array&&>;
56315634
static_assert(std::is_reference_v<elem_ref>);
@@ -6931,7 +6934,10 @@ TOML_NAMESPACE_START
69316934
const auto keep_going =
69326935
static_cast<node_ref>(*kvp.second)
69336936
.visit(
6934-
[&](auto&& v) noexcept(for_each_is_nothrow_one<Func&&, Table&&, decltype(v)>)
6937+
[&](auto&& v)
6938+
#if !TOML_MSVC || TOML_MSVC >= 1932 // older MSVC thinks this is invalid syntax O_o
6939+
noexcept(for_each_is_nothrow_one<Func&&, Table&&, decltype(v)>)
6940+
#endif
69356941
{
69366942
using value_ref = for_each_value_ref<decltype(v), Table&&>;
69376943
static_assert(std::is_reference_v<value_ref>);

0 commit comments

Comments
 (0)