13 #include <daw/cpp_17.h>
14 #include <daw/daw_attributes.h>
15 #include <daw/daw_move.h>
20 #include <type_traits>
24 namespace json_details {
26 has_push_back_v, std::declval<T &>( ).push_back( std::declval<U>( ) ) );
28 template<
typename,
typename,
typename =
void>
29 inline constexpr
bool has_insert_end_v =
false;
31 template<
typename Container,
typename Value>
32 inline constexpr
bool has_insert_end_v<
34 std::void_t<decltype( std::declval<Container &>( ).insert(
35 std::end( std::declval<Container &>( ) ),
36 std::declval<Value>( ) ) )>> =
true;
43 template<
typename Container>
58 template<
typename Value>
59 DAW_ATTRIB_FLATINLINE
inline constexpr
void operator( )( Value &&value ) {
60 if constexpr( json_details::has_push_back_v<
61 Container, daw::remove_cvref_t<Value>> ) {
62 m_container->push_back( DAW_FWD( value ) );
63 }
else if constexpr( json_details::has_insert_end_v<
64 Container, daw::remove_cvref_t<Value>> ) {
65 m_container->insert( std::end( *m_container ), DAW_FWD( value ) );
68 json_details::has_push_back_v<Container,
69 daw::remove_cvref_t<Value>> or
70 json_details::has_insert_end_v<Container,
71 daw::remove_cvref_t<Value>>,
72 "basic_appender requires a Container that either has push_back "
74 "insert with the end iterator as first argument" );
83 operator=( Value &&v ) {
84 operator( )( DAW_FWD( v ) );
92 DAW_ATTRIB_INLINE constexpr basic_appender operator++(
int ) & {
96 DAW_ATTRIB_INLINE constexpr basic_appender &operator*( ) {
#define DAW_JSON_ENABLEIF(...)
Container const & container
Customization point traits.
DAW_JSON_REQUIRES(boost::describe::has_describe_members< T >::value and use_boost_describe_v< T >) struct json_data_contract< T >
typename Container::value_type value_type
std::output_iterator_tag iterator_category
std::ptrdiff_t difference_type
value_type const * pointer
#define DAW_JSON_VER
The version string used in namespace definitions. Must be a valid namespace name.