The native type of string values. Instances of string store and manipulate sequences of `char` using the UTF-8 encoding. The elements of a string are stored contiguously. A pointer to any character in a string may be passed to functions that expect a pointer to the first element of a null-terminated `char` array. The type uses small buffer optimisation to avoid allocations for
| 55 | and {req_SequenceContainer}. |
| 56 | */ |
| 57 | class string |
| 58 | { |
| 59 | friend class value; |
| 60 | #ifndef BOOST_JSON_DOCS |
| 61 | // VFALCO doc toolchain shouldn't show this but does |
| 62 | friend struct detail::access; |
| 63 | #endif |
| 64 | |
| 65 | using string_impl = detail::string_impl; |
| 66 | |
| 67 | inline |
| 68 | string( |
| 69 | detail::key_t const&, |
| 70 | string_view s, |
| 71 | storage_ptr sp); |
| 72 | |
| 73 | inline |
| 74 | string( |
| 75 | detail::key_t const&, |
| 76 | string_view s1, |
| 77 | string_view s2, |
| 78 | storage_ptr sp); |
| 79 | |
| 80 | public: |
| 81 | /// Associated [Allocator](https://en.cppreference.com/w/cpp/named_req/Allocator) |
| 82 | using allocator_type = container::pmr::polymorphic_allocator<value>; |
| 83 | |
| 84 | /// The type of a character |
| 85 | using value_type = char; |
| 86 | |
| 87 | /// The type used to represent unsigned integers |
| 88 | using size_type = std::size_t; |
| 89 | |
| 90 | /// The type used to represent signed integers |
| 91 | using difference_type = std::ptrdiff_t; |
| 92 | |
| 93 | /// A pointer to an element |
| 94 | using pointer = char*; |
| 95 | |
| 96 | /// A const pointer to an element |
| 97 | using const_pointer = char const*; |
| 98 | |
| 99 | /// A reference to an element |
| 100 | using reference = char&; |
| 101 | |
| 102 | /// A const reference to an element |
| 103 | using const_reference = const char&; |
| 104 | |
| 105 | /// A random access iterator to an element |
| 106 | using iterator = char*; |
| 107 | |
| 108 | /// A random access const iterator to an element |
| 109 | using const_iterator = char const*; |
| 110 | |
| 111 | /// A reverse random access iterator to an element |
| 112 | using reverse_iterator = |
| 113 | std::reverse_iterator<iterator>; |
| 114 |