27 namespace json_details {
29 template<
typename T, std::
size_t Capacity>
30 struct basic_array_t {
31 static constexpr std::size_t capacity = Capacity;
34 std::size_t position{ };
35 daw::string_view array[capacity]{ };
38 basic_array_t( ) =
default;
40 DAW_ATTRIB_RET_NONNULL
41 constexpr T
const *data( )
const {
45 DAW_ATTRIB_RET_NONNULL
46 constexpr T *data( ) {
50 constexpr std::size_t size( )
const {
54 constexpr void push_back( T
const &v ) {
55 assert( position < capacity );
62 struct basic_array_t<T, 0> {
63 static constexpr std::size_t capacity = 0;
65 basic_array_t( ) =
default;
67 static DAW_CONSTEVAL T
const *data( ) {
71 static DAW_CONSTEVAL std::size_t size( ) {
89 template<
typename... JsonMembers,
typename OutputIterator,
91 typename Tuple,
typename Value>
93 OutputIterator, SerializationOptions>
96 Tuple
const &args, Value
const &value, std::index_sequence<Is...> ) {
102 daw::constant<
sizeof...( JsonMembers ) +
103 (
static_cast<std::size_t
>(
104 has_dependent_member_v<JsonMembers> ) +
109 constexpr bool track_visited =
110 visit_size::value !=
sizeof...( JsonMembers ) or
111 has_repeated_member_names<JsonMembers...>( );
112 auto visited_members = daw::conditional_t<
114 basic_array_t<daw::string_view, visit_size::value>,
115 no_visited_members_t>{ };
121 bool is_first =
true;
124 (void)visited_members;
127 using Names = daw::fwd_pack<JsonMembers...>;
128 daw::empty_t
const expander[]{
129 ( dependent_member_to_json_str<
131 daw::traits::nth_element<Is, JsonMembers...>,
132 Names>( is_first, it, args, value, visited_members ),
133 daw::empty_t{ } )...,
140 daw::empty_t
const expander[]{
141 ( to_json_str<Is, daw::traits::nth_element<Is, JsonMembers...>>(
142 is_first, it, args, value, visited_members ),
143 daw::empty_t{ } )...,
148 if constexpr(
sizeof...( Is ) > 0 ) {
150 options::OutputTrailingComma::Yes ) {
159 template<
typename... JsonMembers,
typename OutputIterator,
163 OutputIterator, SerializerOptions>
164 serialize_ordered_json_class(
166 Tuple
const &args, Value
const &value, std::index_sequence<Is...> ) {
171 std::size_t array_idx = 0;
175 daw::empty_t
const expander[]{
176 ( to_json_ordered_str<Is,
177 daw::traits::nth_element<Is, JsonMembers...>>(
178 array_idx,
sizeof...( Is ), it, args ),
179 daw::empty_t{ } )...,
184 if constexpr(
sizeof...( Is ) != 0 ) {
186 options::OutputTrailingComma::Yes ) {