relaxed cvref requirements of some functions

also:
- added additional conformance test (toml/issues/908)
- added gitter badge image to docs/images
This commit is contained in:
Mark Gillard 2022-05-30 21:57:15 +03:00
parent 07ada616d9
commit 6126437d6c
10 changed files with 136 additions and 124 deletions

View File

@ -21,6 +21,9 @@ template:
#### Additions:
- Added value type deduction to `emplace()` methods
#### Changes:
- Relaxed cvref requirements of `is_homogeneous()`, `emplace()`, `emplace_back()`, `emplace_hint()`
<br><br>
## [v3.1.0](https://github.com/marzer/tomlplusplus/releases/tag/v3.1.0) - 2022-04-22

View File

@ -1,12 +1,11 @@
[![banner](docs/images/banner_small.png)][homepage]
[![Releases](https://img.shields.io/github/v/release/marzer/tomlplusplus?style=flat-square)](https://github.com/marzer/tomlplusplus/releases)
[![C++17](docs/images/badge-C++17.svg)][cpp_compilers]
[![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?branch=master)](https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml)
[![Gitter](https://badges.gitter.im/marzer/tomlplusplus.svg)](https://gitter.im/marzer/tomlplusplus?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Mentioned in Awesome C++](docs/images/badge-awesome.svg)](https://github.com/fffaraz/awesome-cpp)
[![Gitter](docs/images/badge-gitter.svg)](https://gitter.im/marzer/tomlplusplus)
====
# toml++ homepage

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="90" height="20" role="img" aria-label="chat: on gitter"><title>chat: on gitter</title><g shape-rendering="crispEdges"><rect width="33" height="20" fill="#555"/><rect x="33" width="57" height="20" fill="#4c1"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text x="175" y="140" transform="scale(.1)" fill="#fff" textLength="230">chat</text><text x="605" y="140" transform="scale(.1)" fill="#fff" textLength="470">on gitter</text></g></svg>

After

Width:  |  Height:  |  Size: 626 B

View File

@ -16,7 +16,7 @@ extra_files = [
'images/banner_small.png',
'images/badge-awesome.svg',
'images/badge-TOML.svg',
'images/badge-C++20.svg'
'images/badge-gitter.svg'
]
@ -60,22 +60,22 @@ string_literals = [ '_toml' ]
[badges]
'1. C++20' = [
'badge-C++20.svg',
'https://en.cppreference.com/w/cpp/compiler_support'
]
'2. TOML v1.0.0' = [
'1. TOML v1.0.0' = [
'badge-TOML.svg',
'https://toml.io/en/v1.0.0'
]
'3. CI' = [
'2. 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++' = [
'3. Mentioned in Awesome C++' = [
'badge-awesome.svg',
'https://github.com/fffaraz/awesome-cpp'
]
'4. Gitter' = [
'badge-gitter.svg',
'https://gitter.im/marzer/tomlplusplus'
]

View File

@ -411,13 +411,12 @@ TOML_NAMESPACE_START
TOML_PURE_GETTER
bool is_homogeneous() const noexcept
{
using unwrapped_type = impl::unwrap_node<impl::remove_cvref<ElemType>>;
static_assert(std::is_void_v<unwrapped_type> //
|| (impl::is_native<unwrapped_type> || impl::is_one_of<unwrapped_type, table, array>),
using type = impl::remove_cvref<impl::unwrap_node<ElemType>>;
static_assert(std::is_void_v<type> || toml::is_value<type> || toml::is_container<type>,
"The template type argument of array::is_homogeneous() must be void or one "
"of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
return is_homogeneous(impl::node_type_of<unwrapped_type>);
return is_homogeneous(impl::node_type_of<type>);
}
/// \endcond
@ -1487,11 +1486,13 @@ TOML_NAMESPACE_START
template <typename ElemType = void, typename... Args>
iterator emplace(const_iterator pos, Args&&... args)
{
static_assert(!impl::is_cvref<ElemType>, "ElemType may not be const, volatile, or a reference.");
using elem_type = std::conditional_t<std::is_void_v<ElemType>, impl::emplaced_type_of<Args&&...>, ElemType>;
using raw_elem_type = impl::remove_cvref<ElemType>;
using elem_type = std::conditional_t<std::is_void_v<raw_elem_type>, //
impl::emplaced_type_of<Args&&...>,
raw_elem_type>;
using type = impl::unwrap_node<elem_type>;
static_assert((impl::is_native<type> || impl::is_one_of<type, table, array>)&&!impl::is_cvref<type>,
using type = impl::remove_cvref<impl::unwrap_node<elem_type>>;
static_assert(impl::is_native<type> || impl::is_one_of<type, table, array>,
"Emplacement type parameter must be one of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
return iterator{ insert_at(const_vector_iterator{ pos },
@ -1590,14 +1591,16 @@ TOML_NAMESPACE_START
template <typename ElemType = void, typename... Args>
decltype(auto) emplace_back(Args&&... args)
{
static_assert(!impl::is_cvref<ElemType>, "ElemType may not be const, volatile, or a reference.");
using elem_type = std::conditional_t<std::is_void_v<ElemType>, impl::emplaced_type_of<Args&&...>, ElemType>;
using raw_elem_type = impl::remove_cvref<ElemType>;
using elem_type = std::conditional_t<std::is_void_v<raw_elem_type>, //
impl::emplaced_type_of<Args&&...>,
raw_elem_type>;
static constexpr auto moving_node_ptr = std::is_same_v<elem_type, impl::node_ptr> //
&& sizeof...(Args) == 1u //
&& impl::first_is_same<impl::node_ptr&&, Args&&...>;
using unwrapped_type = impl::unwrap_node<elem_type>;
using unwrapped_type = impl::remove_cvref<impl::unwrap_node<elem_type>>;
static_assert(
moving_node_ptr //

View File

@ -236,13 +236,12 @@ TOML_NAMESPACE_START
TOML_PURE_GETTER
bool is_homogeneous() const noexcept
{
using unwrapped_type = impl::unwrap_node<impl::remove_cvref<ElemType>>;
static_assert(std::is_void_v<unwrapped_type> //
|| (toml::is_value<unwrapped_type> || toml::is_container<unwrapped_type>),
using type = impl::remove_cvref<impl::unwrap_node<ElemType>>;
static_assert(std::is_void_v<type> || toml::is_value<type> || toml::is_container<type>,
"The template type argument of node::is_homogeneous() must be void or one "
"of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
return is_homogeneous(impl::node_type_of<unwrapped_type>);
return is_homogeneous(impl::node_type_of<type>);
}
/// \brief Returns the node's type identifier.
@ -306,27 +305,27 @@ TOML_NAMESPACE_START
TOML_PURE_INLINE_GETTER
bool is() const noexcept
{
using unwrapped_type = impl::unwrap_node<impl::remove_cvref<T>>;
static_assert(toml::is_value<unwrapped_type> || toml::is_container<unwrapped_type>,
using type = impl::remove_cvref<impl::unwrap_node<T>>;
static_assert(toml::is_value<type> || toml::is_container<type>,
"The template type argument of node::is() must be one of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
if constexpr (std::is_same_v<unwrapped_type, table>)
if constexpr (std::is_same_v<type, table>)
return is_table();
else if constexpr (std::is_same_v<unwrapped_type, array>)
else if constexpr (std::is_same_v<type, array>)
return is_array();
else if constexpr (std::is_same_v<unwrapped_type, std::string>)
else if constexpr (std::is_same_v<type, std::string>)
return is_string();
else if constexpr (std::is_same_v<unwrapped_type, int64_t>)
else if constexpr (std::is_same_v<type, int64_t>)
return is_integer();
else if constexpr (std::is_same_v<unwrapped_type, double>)
else if constexpr (std::is_same_v<type, double>)
return is_floating_point();
else if constexpr (std::is_same_v<unwrapped_type, bool>)
else if constexpr (std::is_same_v<type, bool>)
return is_boolean();
else if constexpr (std::is_same_v<unwrapped_type, date>)
else if constexpr (std::is_same_v<type, date>)
return is_date();
else if constexpr (std::is_same_v<unwrapped_type, time>)
else if constexpr (std::is_same_v<type, time>)
return is_time();
else if constexpr (std::is_same_v<unwrapped_type, date_time>)
else if constexpr (std::is_same_v<type, date_time>)
return is_date_time();
}

View File

@ -310,13 +310,10 @@ TOML_NAMESPACE_START
TOML_PURE_GETTER
bool is_homogeneous() const noexcept
{
using type = impl::unwrap_node<ElemType>;
static_assert(
std::is_void_v<
type> || ((impl::is_native<type> || impl::is_one_of<type, table, array>)&&!impl::is_cvref<type>),
"The template type argument of table::is_homogeneous() must be void or one "
"of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
using type = impl::remove_cvref<impl::unwrap_node<ElemType>>;
static_assert(std::is_void_v<type> || toml::is_value<type> || toml::is_container<type>,
"The template type argument of table::is_homogeneous() must be void or one "
"of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
return is_homogeneous(impl::node_type_of<type>);
}
@ -1439,9 +1436,9 @@ TOML_NAMESPACE_START
"Emplacement using wide-character keys is only supported on Windows with "
"TOML_ENABLE_WINDOWS_COMPAT enabled.");
static_assert(!impl::is_cvref<ValueType>, "ValueType may not be const, volatile, or a reference.");
using value_type =
std::conditional_t<std::is_void_v<ValueType>, impl::emplaced_type_of<ValueArgs&&...>, ValueType>;
using raw_value_type = impl::remove_cvref<ValueType>;
using value_type = std::
conditional_t<std::is_void_v<raw_value_type>, impl::emplaced_type_of<ValueArgs&&...>, raw_value_type>;
if constexpr (impl::is_wide_string<KeyType>)
{
@ -1458,7 +1455,7 @@ TOML_NAMESPACE_START
static constexpr auto moving_node_ptr = std::is_same_v<value_type, impl::node_ptr> //
&& sizeof...(ValueArgs) == 1u //
&& impl::first_is_same<impl::node_ptr&&, ValueArgs&&...>;
using unwrapped_type = impl::unwrap_node<value_type>;
using unwrapped_type = impl::remove_cvref<impl::unwrap_node<value_type>>;
static_assert(moving_node_ptr //
|| impl::is_native<unwrapped_type> //
@ -1785,9 +1782,9 @@ TOML_NAMESPACE_START
"Emplacement using wide-character keys is only supported on Windows with "
"TOML_ENABLE_WINDOWS_COMPAT enabled.");
static_assert(!impl::is_cvref<ValueType>, "ValueType may not be const, volatile, or a reference.");
using value_type =
std::conditional_t<std::is_void_v<ValueType>, impl::emplaced_type_of<ValueArgs&&...>, ValueType>;
using raw_value_type = impl::remove_cvref<ValueType>;
using value_type = std::
conditional_t<std::is_void_v<raw_value_type>, impl::emplaced_type_of<ValueArgs&&...>, raw_value_type>;
if constexpr (impl::is_wide_string<KeyType>)
{
@ -1800,7 +1797,7 @@ TOML_NAMESPACE_START
}
else
{
using unwrapped_type = impl::unwrap_node<value_type>;
using unwrapped_type = impl::remove_cvref<impl::unwrap_node<value_type>>;
static_assert((impl::is_native<unwrapped_type> || impl::is_one_of<unwrapped_type, table, array>),
"ValueType argument of table::emplace() must be one "
"of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);

View File

@ -392,14 +392,11 @@ TOML_NAMESPACE_START
TOML_PURE_GETTER
bool is_homogeneous() const noexcept
{
using type = impl::unwrap_node<ElemType>;
static_assert(
std::is_void_v<
type> || ((impl::is_native<type> || impl::is_one_of<type, table, array>)&&!impl::is_cvref<type>),
"The template type argument of value::is_homogeneous() must be void or one "
"of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
using type = impl::remove_cvref<impl::unwrap_node<ElemType>>;
static_assert(std::is_void_v<type> || toml::is_value<type> || toml::is_container<type>,
"The template type argument of value::is_homogeneous() must be void or one "
"of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
using type = impl::unwrap_node<ElemType>;
if constexpr (std::is_void_v<type>)
return true;
else

View File

@ -9,7 +9,7 @@
TEST_CASE("user feedback")
{
SECTION("github/issues/49") // https://github.com/marzer/tomlplusplus/issues/49#issuecomment-664428571
SECTION("tomlplusplus/issues/49") // https://github.com/marzer/tomlplusplus/issues/49#issuecomment-664428571
{
toml::table t1;
t1.insert_or_assign("bar1", toml::array{ 1, 2, 3 });
@ -73,7 +73,7 @@ TEST_CASE("user feedback")
{ "foo3"sv, toml::array{ 1, 2, 3, 4 } } });
}
SECTION("github/issues/65") // https://github.com/marzer/tomlplusplus/issues/65
SECTION("tomlplusplus/issues/65") // https://github.com/marzer/tomlplusplus/issues/65
{
// these test a number of things
// - a comment at EOF
@ -98,7 +98,7 @@ TEST_CASE("user feedback")
R"(t =[ 9, 2, 1,"r", 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0 ])");
}
SECTION("github/issues/67") // https://github.com/marzer/tomlplusplus/issues/67
SECTION("tomlplusplus/issues/67") // https://github.com/marzer/tomlplusplus/issues/67
{
const auto data = R"(array=["v1", "v2", "v3"])"sv;
@ -116,7 +116,7 @@ TEST_CASE("user feedback")
});
}
SECTION("github/issues/68") // https://github.com/marzer/tomlplusplus/issues/68
SECTION("tomlplusplus/issues/68") // https://github.com/marzer/tomlplusplus/issues/68
{
const auto data = R"(array=["v1", "v2", "v3"])"sv;
parsing_should_succeed(FILE_LINE_ARGS,
@ -129,13 +129,13 @@ TEST_CASE("user feedback")
});
}
SECTION("github/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;
}
SECTION("github/pull/80") // https://github.com/marzer/tomlplusplus/pull/80
SECTION("tomlplusplus/pull/80") // https://github.com/marzer/tomlplusplus/pull/80
{
const auto data = R"(
a = { "key" = 1 } # inline table
@ -156,7 +156,7 @@ b = []
});
}
SECTION("github/issues/100") // https://github.com/marzer/tomlplusplus/issues/100
SECTION("tomlplusplus/issues/100") // https://github.com/marzer/tomlplusplus/issues/100
{
// this tests for two separate things that should fail gracefully, not crash:
// 1. pathologically-nested inputs
@ -170,7 +170,7 @@ b = []
parsing_should_fail(FILE_LINE_ARGS, std::string_view{ s });
}
SECTION("github/issues/112") // https://github.com/marzer/tomlplusplus/issues/112
SECTION("tomlplusplus/issues/112") // https://github.com/marzer/tomlplusplus/issues/112
{
parsing_should_fail(FILE_LINE_ARGS,
R"(
@ -193,7 +193,7 @@ b = []
4);
}
SECTION("github/issues/125") // https://github.com/marzer/tomlplusplus/issues/125
SECTION("tomlplusplus/issues/125") // https://github.com/marzer/tomlplusplus/issues/125
{
parse_expected_value(FILE_LINE_ARGS, R"("\u0800")"sv, "\xE0\xA0\x80"sv);
parse_expected_value(FILE_LINE_ARGS, R"("\u7840")"sv, "\xE7\xA1\x80"sv);
@ -210,7 +210,7 @@ b = []
parse_expected_value(FILE_LINE_ARGS, R"("\u2597")"sv, "\xE2\x96\x97"sv);
}
SECTION("github/issues/127") // https://github.com/marzer/tomlplusplus/issues/127
SECTION("tomlplusplus/issues/127") // https://github.com/marzer/tomlplusplus/issues/127
{
parse_expected_value(FILE_LINE_ARGS,
"12:34:56.11122233345678"sv,
@ -222,7 +222,7 @@ b = []
});
}
SECTION("github/issues/128") // https://github.com/marzer/tomlplusplus/issues/128
SECTION("tomlplusplus/issues/128") // https://github.com/marzer/tomlplusplus/issues/128
{
parsing_should_fail(FILE_LINE_ARGS, "\f"sv);
parsing_should_fail(FILE_LINE_ARGS, "\v"sv);
@ -231,7 +231,7 @@ b = []
parsing_should_succeed(FILE_LINE_ARGS, "\n"sv);
}
SECTION("github/issues/129") // https://github.com/marzer/tomlplusplus/issues/129
SECTION("tomlplusplus/issues/129") // https://github.com/marzer/tomlplusplus/issues/129
{
parsing_should_fail(FILE_LINE_ARGS, R"(
hex = 0x
@ -240,7 +240,7 @@ b = []
)"sv);
}
SECTION("github/issues/130") // https://github.com/marzer/tomlplusplus/issues/130
SECTION("tomlplusplus/issues/130") // https://github.com/marzer/tomlplusplus/issues/130
{
parse_expected_value(FILE_LINE_ARGS, "0400-01-01 00:00:00"sv, toml::date_time{ { 400, 1, 1 }, { 0, 0, 0 } });
parse_expected_value(FILE_LINE_ARGS, "0400-01-01 "sv, toml::date{ 400, 1, 1 });
@ -248,7 +248,7 @@ b = []
parse_expected_value(FILE_LINE_ARGS, "1000-01-01 00:00:00"sv, toml::date_time{ { 1000, 1, 1 }, { 0, 0, 0 } });
}
SECTION("github/issues/131") // https://github.com/marzer/tomlplusplus/issues/131
SECTION("tomlplusplus/issues/131") // https://github.com/marzer/tomlplusplus/issues/131
{
parsing_should_fail(FILE_LINE_ARGS, R"(
a={}
@ -256,12 +256,12 @@ b = []
)"sv);
}
SECTION("github/issues/132") // https://github.com/marzer/tomlplusplus/issues/132
SECTION("tomlplusplus/issues/132") // https://github.com/marzer/tomlplusplus/issues/132
{
parsing_should_fail(FILE_LINE_ARGS, "#\r"sv);
}
SECTION("github/issues/134") // https://github.com/marzer/tomlplusplus/issues/134
SECTION("tomlplusplus/issues/134") // https://github.com/marzer/tomlplusplus/issues/134
{
// binary
parsing_should_fail(
@ -303,7 +303,7 @@ b = []
parse_expected_value(FILE_LINE_ARGS, " 0x7FFFFFFFFFFFFFFF"sv, INT64_MAX);
}
SECTION("github/issues/135") // https://github.com/marzer/tomlplusplus/issues/135
SECTION("tomlplusplus/issues/135") // https://github.com/marzer/tomlplusplus/issues/135
{
parsing_should_succeed(FILE_LINE_ARGS, "0=0"sv);
parsing_should_succeed(FILE_LINE_ARGS, "1=1"sv);
@ -321,7 +321,7 @@ b = []
"2=2\n"sv);
}
SECTION("github/issues/152") // https://github.com/marzer/tomlplusplus/issues/152
SECTION("tomlplusplus/issues/152") // https://github.com/marzer/tomlplusplus/issues/152
{
// clang-format off
static constexpr auto data = R"([shaders.room_darker])" "\n"
@ -350,4 +350,21 @@ b = []
check_location("shaders.room_darker.args.ambientLightLevel"sv, 3, 45);
});
}
SECTION("toml/issues/908") // https://github.com/toml-lang/toml/issues/908
{
parsing_should_fail(FILE_LINE_ARGS, R"(
a = [{ b = 1 }]
[a.c]
foo = 1
)"sv);
parsing_should_succeed(FILE_LINE_ARGS, R"(
[[a]]
b = 1
[a.c]
foo = 1
)"sv);
}
}

View File

@ -2761,13 +2761,12 @@ TOML_NAMESPACE_START
TOML_PURE_GETTER
bool is_homogeneous() const noexcept
{
using unwrapped_type = impl::unwrap_node<impl::remove_cvref<ElemType>>;
static_assert(std::is_void_v<unwrapped_type> //
|| (toml::is_value<unwrapped_type> || toml::is_container<unwrapped_type>),
using type = impl::remove_cvref<impl::unwrap_node<ElemType>>;
static_assert(std::is_void_v<type> || toml::is_value<type> || toml::is_container<type>,
"The template type argument of node::is_homogeneous() must be void or one "
"of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
return is_homogeneous(impl::node_type_of<unwrapped_type>);
return is_homogeneous(impl::node_type_of<type>);
}
TOML_PURE_GETTER
@ -2813,27 +2812,27 @@ TOML_NAMESPACE_START
TOML_PURE_INLINE_GETTER
bool is() const noexcept
{
using unwrapped_type = impl::unwrap_node<impl::remove_cvref<T>>;
static_assert(toml::is_value<unwrapped_type> || toml::is_container<unwrapped_type>,
using type = impl::remove_cvref<impl::unwrap_node<T>>;
static_assert(toml::is_value<type> || toml::is_container<type>,
"The template type argument of node::is() must be one of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
if constexpr (std::is_same_v<unwrapped_type, table>)
if constexpr (std::is_same_v<type, table>)
return is_table();
else if constexpr (std::is_same_v<unwrapped_type, array>)
else if constexpr (std::is_same_v<type, array>)
return is_array();
else if constexpr (std::is_same_v<unwrapped_type, std::string>)
else if constexpr (std::is_same_v<type, std::string>)
return is_string();
else if constexpr (std::is_same_v<unwrapped_type, int64_t>)
else if constexpr (std::is_same_v<type, int64_t>)
return is_integer();
else if constexpr (std::is_same_v<unwrapped_type, double>)
else if constexpr (std::is_same_v<type, double>)
return is_floating_point();
else if constexpr (std::is_same_v<unwrapped_type, bool>)
else if constexpr (std::is_same_v<type, bool>)
return is_boolean();
else if constexpr (std::is_same_v<unwrapped_type, date>)
else if constexpr (std::is_same_v<type, date>)
return is_date();
else if constexpr (std::is_same_v<unwrapped_type, time>)
else if constexpr (std::is_same_v<type, time>)
return is_time();
else if constexpr (std::is_same_v<unwrapped_type, date_time>)
else if constexpr (std::is_same_v<type, date_time>)
return is_date_time();
}
@ -4071,14 +4070,11 @@ TOML_NAMESPACE_START
TOML_PURE_GETTER
bool is_homogeneous() const noexcept
{
using type = impl::unwrap_node<ElemType>;
static_assert(
std::is_void_v<
type> || ((impl::is_native<type> || impl::is_one_of<type, table, array>)&&!impl::is_cvref<type>),
"The template type argument of value::is_homogeneous() must be void or one "
"of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
using type = impl::remove_cvref<impl::unwrap_node<ElemType>>;
static_assert(std::is_void_v<type> || toml::is_value<type> || toml::is_container<type>,
"The template type argument of value::is_homogeneous() must be void or one "
"of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
using type = impl::unwrap_node<ElemType>;
if constexpr (std::is_void_v<type>)
return true;
else
@ -5286,13 +5282,12 @@ TOML_NAMESPACE_START
TOML_PURE_GETTER
bool is_homogeneous() const noexcept
{
using unwrapped_type = impl::unwrap_node<impl::remove_cvref<ElemType>>;
static_assert(std::is_void_v<unwrapped_type> //
|| (impl::is_native<unwrapped_type> || impl::is_one_of<unwrapped_type, table, array>),
using type = impl::remove_cvref<impl::unwrap_node<ElemType>>;
static_assert(std::is_void_v<type> || toml::is_value<type> || toml::is_container<type>,
"The template type argument of array::is_homogeneous() must be void or one "
"of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
return is_homogeneous(impl::node_type_of<unwrapped_type>);
return is_homogeneous(impl::node_type_of<type>);
}
TOML_CONST_INLINE_GETTER
bool is_table() const noexcept final
@ -5917,11 +5912,13 @@ TOML_NAMESPACE_START
template <typename ElemType = void, typename... Args>
iterator emplace(const_iterator pos, Args&&... args)
{
static_assert(!impl::is_cvref<ElemType>, "ElemType may not be const, volatile, or a reference.");
using elem_type = std::conditional_t<std::is_void_v<ElemType>, impl::emplaced_type_of<Args&&...>, ElemType>;
using raw_elem_type = impl::remove_cvref<ElemType>;
using elem_type = std::conditional_t<std::is_void_v<raw_elem_type>, //
impl::emplaced_type_of<Args&&...>,
raw_elem_type>;
using type = impl::unwrap_node<elem_type>;
static_assert((impl::is_native<type> || impl::is_one_of<type, table, array>)&&!impl::is_cvref<type>,
using type = impl::remove_cvref<impl::unwrap_node<elem_type>>;
static_assert(impl::is_native<type> || impl::is_one_of<type, table, array>,
"Emplacement type parameter must be one of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
return iterator{ insert_at(const_vector_iterator{ pos },
@ -5953,14 +5950,16 @@ TOML_NAMESPACE_START
template <typename ElemType = void, typename... Args>
decltype(auto) emplace_back(Args&&... args)
{
static_assert(!impl::is_cvref<ElemType>, "ElemType may not be const, volatile, or a reference.");
using elem_type = std::conditional_t<std::is_void_v<ElemType>, impl::emplaced_type_of<Args&&...>, ElemType>;
using raw_elem_type = impl::remove_cvref<ElemType>;
using elem_type = std::conditional_t<std::is_void_v<raw_elem_type>, //
impl::emplaced_type_of<Args&&...>,
raw_elem_type>;
static constexpr auto moving_node_ptr = std::is_same_v<elem_type, impl::node_ptr> //
&& sizeof...(Args) == 1u //
&& impl::first_is_same<impl::node_ptr&&, Args&&...>;
using unwrapped_type = impl::unwrap_node<elem_type>;
using unwrapped_type = impl::remove_cvref<impl::unwrap_node<elem_type>>;
static_assert(
moving_node_ptr //
@ -6569,13 +6568,10 @@ TOML_NAMESPACE_START
TOML_PURE_GETTER
bool is_homogeneous() const noexcept
{
using type = impl::unwrap_node<ElemType>;
static_assert(
std::is_void_v<
type> || ((impl::is_native<type> || impl::is_one_of<type, table, array>)&&!impl::is_cvref<type>),
"The template type argument of table::is_homogeneous() must be void or one "
"of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
using type = impl::remove_cvref<impl::unwrap_node<ElemType>>;
static_assert(std::is_void_v<type> || toml::is_value<type> || toml::is_container<type>,
"The template type argument of table::is_homogeneous() must be void or one "
"of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);
return is_homogeneous(impl::node_type_of<type>);
}
@ -7208,9 +7204,9 @@ TOML_NAMESPACE_START
"Emplacement using wide-character keys is only supported on Windows with "
"TOML_ENABLE_WINDOWS_COMPAT enabled.");
static_assert(!impl::is_cvref<ValueType>, "ValueType may not be const, volatile, or a reference.");
using value_type =
std::conditional_t<std::is_void_v<ValueType>, impl::emplaced_type_of<ValueArgs&&...>, ValueType>;
using raw_value_type = impl::remove_cvref<ValueType>;
using value_type = std::
conditional_t<std::is_void_v<raw_value_type>, impl::emplaced_type_of<ValueArgs&&...>, raw_value_type>;
if constexpr (impl::is_wide_string<KeyType>)
{
@ -7227,7 +7223,7 @@ TOML_NAMESPACE_START
static constexpr auto moving_node_ptr = std::is_same_v<value_type, impl::node_ptr> //
&& sizeof...(ValueArgs) == 1u //
&& impl::first_is_same<impl::node_ptr&&, ValueArgs&&...>;
using unwrapped_type = impl::unwrap_node<value_type>;
using unwrapped_type = impl::remove_cvref<impl::unwrap_node<value_type>>;
static_assert(moving_node_ptr //
|| impl::is_native<unwrapped_type> //
@ -7375,9 +7371,9 @@ TOML_NAMESPACE_START
"Emplacement using wide-character keys is only supported on Windows with "
"TOML_ENABLE_WINDOWS_COMPAT enabled.");
static_assert(!impl::is_cvref<ValueType>, "ValueType may not be const, volatile, or a reference.");
using value_type =
std::conditional_t<std::is_void_v<ValueType>, impl::emplaced_type_of<ValueArgs&&...>, ValueType>;
using raw_value_type = impl::remove_cvref<ValueType>;
using value_type = std::
conditional_t<std::is_void_v<raw_value_type>, impl::emplaced_type_of<ValueArgs&&...>, raw_value_type>;
if constexpr (impl::is_wide_string<KeyType>)
{
@ -7390,7 +7386,7 @@ TOML_NAMESPACE_START
}
else
{
using unwrapped_type = impl::unwrap_node<value_type>;
using unwrapped_type = impl::remove_cvref<impl::unwrap_node<value_type>>;
static_assert((impl::is_native<unwrapped_type> || impl::is_one_of<unwrapped_type, table, array>),
"ValueType argument of table::emplace() must be one "
"of:" TOML_SA_UNWRAPPED_NODE_TYPE_LIST);