Use is_void<T> instead of is_same<T, void>

The original code incorrectly accepts cv-qualified void types for
success.
This commit is contained in:
Ken Matsui
2025-01-18 22:20:46 -05:00
parent c87bdaaeea
commit 2485f8fe03

View File

@@ -32,7 +32,7 @@ struct bad_result_access final : public ::toml::exception
template<typename T>
struct success
{
static_assert( ! std::is_same<T, void>::value, "");
static_assert( ! std::is_void<T>::value, "");
using value_type = T;
@@ -66,7 +66,7 @@ struct success
template<typename T>
struct success<std::reference_wrapper<T>>
{
static_assert( ! std::is_same<T, void>::value, "");
static_assert( ! std::is_void<T>::value, "");
using value_type = T;