10 #ifndef BOOST_BEAST_DETAIL_STATIC_STRING_HPP 11 #define BOOST_BEAST_DETAIL_STATIC_STRING_HPP 14 #include <boost/assert.hpp> 16 #include <type_traits> 25 std::integral_constant<bool,
26 ! std::is_integral<T>::value>;
28 template<
class CharT,
class Traits>
31 CharT
const* s1, std::size_t n1,
32 CharT
const* s2, std::size_t n2)
35 return Traits::compare(
36 s1, s2, n1) <= 0 ? -1 : 1;
38 return Traits::compare(
39 s1, s2, n2) >= 0 ? 1 : -1;
40 return Traits::compare(s1, s2, n1);
43 template<
class CharT,
class Traits>
48 CharT
const* s2, std::size_t n2)
50 return lexicographical_compare<CharT, Traits>(
51 s1.data(), s1.size(), s2, n2);
54 template<
class CharT,
class Traits>
61 return lexicographical_compare<CharT, Traits>(
62 s1.data(), s1.size(), s2.data(), s2.size());
73 return static_cast<std::size_t
>(
74 bytes * 2.41) + 1 + 1;
77 template<
class CharT,
class Integer,
class Traits>
80 CharT* buf, Integer x, std::true_type)
84 Traits::assign(*--buf,
'0');
91 Traits::assign(*--buf ,
92 "0123456789"[x % 10]);
93 Traits::assign(*--buf,
'-');
97 Traits::assign(*--buf ,
98 "0123456789"[x % 10]);
102 template<
class CharT,
class Integer,
class Traits>
105 CharT* buf, Integer x, std::false_type)
113 Traits::assign(*--buf ,
114 "0123456789"[x % 10]);
121 class Traits = std::char_traits<CharT>>
125 boost::ignore_unused(size);
126 BOOST_ASSERT(size >=
max_digits(
sizeof(Integer)));
127 return raw_to_string<CharT, Integer, Traits>(
128 last, i, std::is_signed<Integer>{});
Definition: async_result.hpp:20
std::integral_constant< bool,!std::is_integral< T >::value > is_input_iterator
Definition: static_string.hpp:26
CharT * raw_to_string(CharT *buf, Integer x, std::true_type)
Definition: static_string.hpp:79
int lexicographical_compare(CharT const *s1, std::size_t n1, CharT const *s2, std::size_t n2)
Definition: static_string.hpp:30
std::size_t constexpr max_digits(std::size_t bytes)
Definition: static_string.hpp:71
boost::basic_string_ref< CharT, Traits > basic_string_view
The type of basic string view used by the library.
Definition: string.hpp:41