Skip to content

Commit 0372507

Browse files
arturbacArtur Bać
and
Artur Bać
authored
support for glaze 5.x - glaze_v5_0_0_generic_supported (#25)
* support for glaze 5.x - glaze_v5_0_0_generic_supported * v0.8.12 --------- Co-authored-by: Artur Bać <artur@ebasoft.com.pl>
1 parent 15f43b7 commit 0372507

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

ext_support/simple_enum/glaze_json_enum_name.hpp

+4-12
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ namespace detail
7171
constexpr auto glaze_tuple_pairs(std::index_sequence<ix...>)
7272
{
7373
return std::tuple_cat(
74-
std::make_tuple(
75-
enum_name_at_index<enumeration_type>(ix), enum_value_at_index<enumeration_type>(ix)
76-
)...
74+
std::make_tuple(enum_name_at_index<enumeration_type>(ix), enum_value_at_index<enumeration_type>(ix))...
7775
);
7876
}
7977

@@ -87,13 +85,6 @@ namespace detail
8785
} // namespace detail
8886
} // namespace simple_enum::inline v0_8
8987

90-
namespace simple_enum::inline v0_8::concepts
91-
{
92-
using glz::read_json_supported;
93-
using glz::write_json_supported;
94-
95-
} // namespace simple_enum::inline v0_8::concepts
96-
9788
namespace glz
9889
{
9990
template<simple_enum::bounded_enum enumeration_type>
@@ -131,8 +122,9 @@ struct from_json<enumeration_type>
131122
if(bool(ctx.error)) [[unlikely]]
132123
return;
133124

134-
simple_enum::expected<enumeration_type, simple_enum::enum_cast_error> res{simple_enum::enum_cast<enumeration_type>(value
135-
)};
125+
simple_enum::expected<enumeration_type, simple_enum::enum_cast_error> res{
126+
simple_enum::enum_cast<enumeration_type>(value)
127+
};
136128
if(!res.has_value()) [[unlikely]]
137129
{
138130
ctx.error = error_code::syntax_error;

include/simple_enum/core.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <concepts>
77
#include <type_traits>
88

9-
#define SIMPLE_ENUM_NAME_VERSION "0.8.11"
9+
#define SIMPLE_ENUM_NAME_VERSION "0.8.12"
1010

1111
namespace simple_enum::inline v0_8
1212
{

tests/glaze_enum_name_ut.cc

+7-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ consteval auto adl_enum_bounds(test_enum_e)
2828
using enum test_enum_e;
2929
return simple_enum::adl_info{foo, baz};
3030
}
31-
32-
static_assert(simple_enum::concepts::read_json_supported<test_enum_e>);
33-
static_assert(simple_enum::concepts::write_json_supported<test_enum_e>);
31+
#ifdef glaze_v5_0_0_generic_supported
32+
static_assert(glz::read_supported<glz::JSON, test_enum_e>);
33+
static_assert(glz::write_supported<glz::JSON, test_enum_e>);
34+
#else
35+
static_assert(glz::read_json_supported<test_enum_e>);
36+
static_assert(glz::write_json_supported<test_enum_e>);
37+
#endif
3438

3539
struct test_data_t
3640
{

0 commit comments

Comments
 (0)