DAW JSON Link
Loading...
Searching...
No Matches
daw_json_reflection_helpers.h
Go to the documentation of this file.
1// Copyright (c) Darrell Wright
2//
3// Distributed under the Boost Software License, Version 1.0. (See accompanying
4// file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
5//
6// Official repository: https://github.com/beached/daw_json_link
7//
8
9#pragma once
10
12
14
15#if defined( DAW_JSON_HAS_REFLECTION )
16
17#include <meta>
18
19namespace daw::json::inline DAW_JSON_VER::refl_details {
21 consteval std::vector<std::meta::info>
22 pub_nsdm_of( std::meta::info type_class ) {
23 return nonstatic_data_members_of(
24 type_class, std::meta::access_context::unprivileged( ) );
25 }
26
27 consteval std::vector<std::meta::info>
28 all_nsdm_of( std::meta::info type_class ) {
29 return nonstatic_data_members_of( type_class,
30 std::meta::access_context::unchecked( ) );
31 }
32
33 template<typename T>
34 concept PublicMembersOnly = all_nsdm_of( remove_cvref( ^^T ) ).size( ) ==
35 pub_nsdm_of( remove_cvref( ^^T ) ).size( );
36 // The type may not be reflectable but we can error later
37 template<typename T>
38 concept PotentiallyReflectable =
39 not std::is_empty_v<T> and std::is_class_v<T> and std::is_aggregate_v<T> and
40 PublicMembersOnly<T>;
41} // namespace daw::json::inline DAW_JSON_VER::refl_details
42#endif
#define DAW_JSON_VER
The version string used in namespace definitions. Must be a valid namespace name.
Definition version.h:20