13 template<
typename CharT =
char>
requires ice::concepts::SupportedCharType<CharT>
43 template<typename Self>
44 inline auto
data(this Self& self) noexcept ->
ValueType* {
return self._data; }
56 template<typename CharT> requires
ice::
concepts::SupportedCharType<CharT>
65 template<
typename CharT>
requires ice::concepts::SupportedCharType<CharT>
75 template<
typename CharT>
requires ice::concepts::SupportedCharType<CharT>
78 ,
_size{ ice::exchange(other._size, 0) }
79 ,
_capacity{ ice::exchange(other._capacity, 0) }
80 ,
_data{ ice::exchange(other._data,
nullptr) }
84 template<
typename CharT>
requires ice::concepts::SupportedCharType<CharT>
107 template<
typename CharT>
requires ice::concepts::SupportedCharType<CharT>
116 if (
this != ice::addressof(other))
121 _size = ice::exchange(other._size, 0);
122 _capacity = ice::exchange(other._capacity, 0);
123 _data = ice::exchange(other._data,
nullptr);
128 template<
typename CharT>
requires ice::concepts::SupportedCharType<CharT>
131 if (
this != ice::addressof(other))
134 this->
reserve(other.capacity());
150 template<
typename CharT>
requires ice::concepts::SupportedCharType<CharT>
153 auto const*
const other_str_begin = str.begin();
154 bool const part_of_this = other_str_begin >= this->
begin()
155 && other_str_begin < this->
end();
166 _size = str.size().u32();
172 template<
typename CharT>
requires ice::concepts::SupportedCharType<CharT>
175 return ice::BasicString<CharT>{
_data,
_size };
178 template<
typename CharT>
requires ice::concepts::SupportedCharType<CharT>
181 if (new_size > 0 && new_size >=
capacity())
186 _size = new_size.u32();
187 if (
_data !=
nullptr)
196 ice::u32 const new_capacity_u32 = new_capacity.u32();
203 if (new_capacity_u32 > 0)
216 _capacity = new_capacity_u32;
219 if (new_capacity_u32 <=
_size)
224 if (
_data !=
nullptr)
235 .size =
size().bytes(),
245 ice::exchange(
_data,
nullptr),
258template<
typename CharType>
259struct fmt::formatter<
ice::HeapString<CharType>> :
public fmt::formatter<ice::BasicString<CharType>>
261 template<
typename FormatContext>
264 return fmt::formatter<ice::BasicString<CharType>>
::format({ value._data, value._size }, ctx);
#define ICE_ASSERT_CORE(expression)
Definition assert_core.hxx:43
Definition string_concepts.hxx:12
Definition container_concepts.hxx:12
constexpr auto min(arr_t< Size, T > left, arr_t< Size, U > right) noexcept -> arr_t< Size, T >
Definition array_operations.hxx:60
SPDX-License-Identifier: MIT.
Definition array.hxx:12
ice::BasicString< char > String
Definition string.hxx:82
std::uint64_t u64
Definition types.hxx:27
constexpr ice::ualign align_of
Definition mem_info.hxx:15
std::uint32_t u32
Definition types.hxx:26
constexpr ice::meminfo meminfo_of
Definition mem_info.hxx:18
ice::AllocatorBase< ice::build::is_debug||ice::build::is_develop > Allocator
Definition mem_types.hxx:25
constexpr auto hash(ice::HeapString<> const &value) noexcept -> ice::u64
Definition heap_string.hxx:251
auto memcpy(void *dest, void const *source, ice::usize size) noexcept -> void *
void * memory
Definition mem.hxx:45
Definition mem_data.hxx:17
Definition heap_string.hxx:15
auto size() const noexcept -> SizeType
Definition heap_string.hxx:46
auto data(this Self &self) noexcept -> ValueType *
Definition heap_string.hxx:44
void set_capacity(ice::ncount new_capacity) noexcept
Definition heap_string.hxx:194
ValueType * _data
Definition heap_string.hxx:28
auto extract_memory() noexcept -> ice::Memory
Definition heap_string.hxx:241
auto capacity() const noexcept -> SizeType
Definition heap_string.hxx:49
ice::ncount SizeType
Definition heap_string.hxx:22
auto operator=(HeapString &&other) noexcept -> HeapString &
CharType ValueType
Definition heap_string.hxx:17
~HeapString() noexcept
Definition heap_string.hxx:108
auto data_view() const noexcept -> ice::Data
Definition heap_string.hxx:231
void resize(ice::ncount new_size) noexcept
Definition heap_string.hxx:179
ice::u32 _size
Definition heap_string.hxx:27
ice::u32 _capacity
Definition heap_string.hxx:26
CharType * Iterator
Definition heap_string.hxx:18
std::reverse_iterator< CharType const * > ConstReverseIterator
Definition heap_string.hxx:21
CharType const * ConstIterator
Definition heap_string.hxx:20
ice::BasicString< CharType > StringType
Definition heap_string.hxx:23
CharT CharType
Definition heap_string.hxx:16
ice::Allocator * _allocator
Definition heap_string.hxx:25
HeapString(ice::Allocator &allocator) noexcept
Definition heap_string.hxx:57
std::reverse_iterator< CharType * > ReverseIterator
Definition heap_string.hxx:19
Definition mem_memory.hxx:13
constexpr auto memory_view(this Self &self) noexcept -> ice::Memory
Definition editable_operations.hxx:168
void clear(this Self &self) noexcept
Definition editable_operations.hxx:16
constexpr auto begin(this Self &self) noexcept -> typename Self::Iterator
Definition editable_operations.hxx:132
constexpr auto end(this Self &self) noexcept -> typename Self::Iterator
Definition editable_operations.hxx:138
Definition resizable_operations.hxx:13
void reserve(this Self &self, ice::ncount min_capacity) noexcept
Definition resizable_operations.hxx:23