15 #include <daw/daw_algorithm.h>
16 #include <daw/daw_character_traits.h>
17 #include <daw/daw_string_view.h>
23 namespace concepts::writeable_output_details {
25 constexpr T *copy_to_buffer( T *buff, daw::string_view source ) {
26 #if defined( DAW_IS_CONSTANT_EVALUATED )
27 if( DAW_IS_CONSTANT_EVALUATED( ) ) {
29 daw::algorithm::transform_n( source.data( ), buff, source.size( ),
32 return static_cast<T>( c );
34 #if defined( DAW_IS_CONSTANT_EVALUATED )
36 memcpy( buff, source.data( ), source.size( ) );
39 return buff + source.size( );
43 inline constexpr
bool is_byte_type_v =
44 std::is_same_v<T, std::byte> or std::is_same_v<T, unsigned char>;
47 inline constexpr
bool is_char_sized_character_v =
false;
50 inline constexpr
bool is_char_sized_character_v<char> =
true;
52 #if defined( __cpp_lib_char8_t )
53 #if __cpp_lib_char8_t >= 201907L
55 inline constexpr
bool is_char_sized_character_v<char8_t> =
true;
59 template<
typename T,
typename CharT>
60 using span_like_range_test =
61 decltype( (
void)( std::declval<T &>( ).subspan( 1 ) ),
62 (
void)( std::declval<std::size_t &>( ) =
63 std::declval<T &>( ).size( ) ),
64 (
void)( std::declval<bool &>( ) =
65 std::declval<T &>( ).empty( ) ),
66 (
void)( *std::declval<T &>( ).data( ) =
67 std::declval<CharT>( ) ) );
68 template<
typename T,
typename CharT>
69 inline constexpr
bool is_span_like_range_v =
70 daw::is_detected_v<span_like_range_test, T, CharT> and
71 ( writeable_output_details::is_char_sized_character_v<CharT> or
72 writeable_output_details::is_byte_type_v<CharT> );
74 template<
typename T,
typename CharT>
75 using resizable_contiguous_range_test =
76 decltype( (
void)( std::declval<T &>( ).resize( std::size_t{ 0 } ) ),
77 (
void)( std::declval<T &>( ).size( ) ),
78 (
void)( *std::declval<T &>( ).data( ) ),
79 (
void)( *std::declval<T &>( ).data( ) =
80 std::declval<CharT>( ) ),
81 (
void)( std::declval<T &>( ).push_back(
82 std::declval<CharT>( ) ) ),
83 (
void)(
static_cast<CharT
>(
'a' ) ) );
85 template<
typename Container,
typename CharT>
86 inline constexpr
bool is_resizable_contiguous_range_v =
87 daw::is_detected_v<resizable_contiguous_range_test, Container, CharT>;
89 template<
typename Container,
typename CharT>
90 inline constexpr
bool is_string_like_writable_output_v =
91 (writeable_output_details::is_char_sized_character_v<CharT> or
92 writeable_output_details::is_byte_type_v<
93 CharT>)and writeable_output_details::
94 is_resizable_contiguous_range_v<Container, CharT>;
97 using is_writable_output_iterator_test =
98 decltype( *std::declval<T &>( ) =
'c', ++std::declval<T &>( ) );
101 inline constexpr
bool is_writable_output_iterator_v =
102 not std::is_pointer_v<T> and
103 daw::is_detected_v<is_writable_output_iterator_test, T>;
#define DAW_JSON_CPP23_STATIC_CALL_OP
This is in addition to the parse policy. Always do a full name match instead of sometimes relying on ...
Customization point traits.
#define DAW_JSON_VER
The version string used in namespace definitions. Must be a valid namespace name.