MCPcopy Create free account
hub / github.com/KTH-RPL/dufomap / value_exact

Method value_exact

src/toml.hpp:5369–5389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5367
5368 template <typename T>
5369 TOML_NODISCARD
5370 inline optional<T> node::value_exact() const noexcept(impl::value_retrieval_is_nothrow<T>)
5371 {
5372 using namespace impl;
5373
5374 static_assert(!is_wide_string<T> || TOML_ENABLE_WINDOWS_COMPAT,
5375 "Retrieving values as wide-character strings with node::value_exact() is only "
5376 "supported on Windows with TOML_ENABLE_WINDOWS_COMPAT enabled.");
5377
5378 static_assert((is_native<T> || can_represent_native<T>)&&!is_cvref<T>,
5379 TOML_SA_VALUE_EXACT_FUNC_MESSAGE("return type of node::value_exact()"));
5380
5381 // prevent additional compiler error spam when the static_assert fails by gating behind if constexpr
5382 if constexpr ((is_native<T> || can_represent_native<T>)&&!is_cvref<T>)
5383 {
5384 if (type() == node_type_of<T>)
5385 return { this->get_value_exact<T>() };
5386 else
5387 return {};
5388 }
5389 }
5390
5391 template <typename T>
5392 TOML_NODISCARD

Callers

nothing calls this directly

Calls 1

typeFunction · 0.85

Tested by

no test coverage detected