16 #include <daw/daw_traits.h>
20 #include <string_view>
21 #include <type_traits>
25 template<
typename Value,
typename JsonClass,
typename OutputIterator>
26 [[maybe_unused]] constexpr OutputIterator
to_json( Value
const &value,
27 OutputIterator out_it ) {
28 if constexpr( std::is_pointer<OutputIterator>::value ) {
36 template<
typename Result,
typename Value,
typename JsonClass>
37 [[maybe_unused, nodiscard]] constexpr Result
to_json( Value
const &value ) {
39 if constexpr( std::is_same_v<Result, std::string> ) {
40 result.reserve( 4096 );
43 template_arg<JsonClass>, std::back_inserter( result ), value );
44 if constexpr( std::is_same_v<Result, std::string> ) {
45 result.shrink_to_fit( );
50 template<
typename JsonElement,
typename Container,
typename OutputIterator>
51 [[maybe_unused]] constexpr OutputIterator
54 traits::is_container_like_v<daw::remove_cvref_t<Container>>,
55 "Supplied container must support begin( )/end( )" );
57 if constexpr( std::is_pointer<OutputIterator>::value ) {
66 using v_type = daw::remove_cvref_t<decltype( v )>;
67 constexpr
bool is_auto_detect_v =
68 std::is_same<JsonElement,
69 json_details::auto_detect_array_element>::value;
71 std::conditional_t<is_auto_detect_v,
72 json_details::json_deduced_type<v_type>,
76 not std::is_same_v<JsonMember,
78 "Unable to detect unnamed mapping" );
93 template<
typename Result,
typename JsonElement,
typename Container>
94 [[maybe_unused, nodiscard]] constexpr Result
97 traits::is_container_like_v<daw::remove_cvref_t<Container>>,
98 "Supplied container must support begin( )/end( )" );
101 auto out_it = json_details::basic_appender<Result>( result );
102 to_json_array<JsonElement>( c, out_it );
#define daw_json_assert(Bool,...)
Definition: daw_json_assert.h:178
constexpr OutputIterator member_to_string(template_param< JsonMember >, OutputIterator it, T const &value)
Definition: to_daw_json_string.h:1259
constexpr OutputIterator to_json(Value const &value, OutputIterator out_it)
Definition: daw_to_json.h:26
constexpr OutputIterator to_json_array(Container const &c, OutputIterator out_it)
Definition: daw_to_json.h:52
Definition: daw_from_json.h:22
Definition: daw_json_traits.h:117
#define DAW_JSON_VER
Definition: version.h:11