sandbox
Loading...
Searching...
No Matches
small_string.hpp
1
#ifndef LIBSBX_UTILITY_SMALL_STRING_HPP_
2
#define LIBSBX_UTILITY_SMALL_STRING_HPP_
3
4
#include <array>
5
#include <functional>
6
#include <iterator>
7
#include <ostream>
8
#include <string_view>
9
#include <type_traits>
10
#include <cstring>
11
12
#include <
libsbx/utility/hash.hpp
>
13
14
namespace
sbx::utility {
15
16
template
<
char
acter Char,
typename
Traits = std::
char
_traits<Char>>
17
class
small_string
{
18
19
using
traits_type = Traits;
20
21
public
:
22
23
using
char_type = Char;
24
using
size_type = std::size_t;
25
26
constexpr
small_string
() {
27
std::memset(_buffer.stack, 0,
sizeof
(buffer));
28
}
29
30
private
:
31
32
union
buffer {
33
struct
heap
{
34
char_type* data;
35
size_type size;
36
}
heap
;
37
char_type stack[
sizeof
(
heap
)];
38
} _buffer;
39
40
};
// class small_string
41
42
}
// namespace sbx::utility
43
44
#endif
// LIBSBX_UTILITY_SMALL_STRING_HPP_
sbx::utility::small_string
Definition:
small_string.hpp:17
hash.hpp
sbx::utility::small_string::buffer::heap
Definition:
small_string.hpp:33
libsbx-utility
libsbx
utility
small_string.hpp
Generated by
1.9.5