IceShard
1
A personal game engine project, with development focused on 2D/2.5D games.
Toggle main menu visibility
Loading...
Searching...
No Matches
collections
public
ice
string
resizable_operations.hxx
Go to the documentation of this file.
1
3
4
#pragma once
5
#include <
ice/string/editable_operations.hxx
>
6
7
namespace
ice::string
8
{
9
10
using
ice::concepts::ResizableStringType;
11
12
struct
ResizableOperations
:
ice::string::MutableOperations
13
{
14
// Capacity and Size Helpers
15
16
template
<ResizableStringType Self>
17
inline
void
shrink
(
this
Self& self)
noexcept
18
{
19
self.set_capacity(self.size() + 1);
20
}
21
22
template
<ResizableStringType Self>
23
inline
void
reserve
(
this
Self& self,
ice::ncount
min_capacity)
noexcept
24
{
25
if
(min_capacity > self.capacity())
26
{
27
self.set_capacity(min_capacity);
28
}
29
}
30
31
template
<ResizableStringType Self>
32
inline
void
grow
(
this
Self& self,
ice::ncount
min_capacity =
ncount_none
)
noexcept
33
{
34
ice::ncount
const
new_capacity =
ice::max
(self.capacity() * 2 + 8, min_capacity);
35
self.set_capacity(new_capacity);
36
}
37
};
38
39
}
// namespace ice::string
editable_operations.hxx
ice::math::max
constexpr auto max(arr_t< Size, T > left, arr_t< Size, U > right) noexcept -> arr_t< Size, T >
Definition
array_operations.hxx:49
ice::string
Definition
editable_operations.hxx:9
ice::ncount_none
static constexpr ice::ncount_invalid_t ncount_none
Definition
ncount.hxx:60
ice::ncount
Definition
ncount.hxx:14
ice::string::MutableOperations
Definition
editable_operations.hxx:14
ice::string::ResizableOperations
Definition
resizable_operations.hxx:13
ice::string::ResizableOperations::grow
void grow(this Self &self, ice::ncount min_capacity=ncount_none) noexcept
Definition
resizable_operations.hxx:32
ice::string::ResizableOperations::shrink
void shrink(this Self &self) noexcept
Definition
resizable_operations.hxx:17
ice::string::ResizableOperations::reserve
void reserve(this Self &self, ice::ncount min_capacity) noexcept
Definition
resizable_operations.hxx:23
Generated by
1.18.0