MCPcopy Create free account
hub / github.com/boostorg/json / buffer

Class buffer

include/boost/json/detail/buffer.hpp:23–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21// A simple string-like temporary static buffer
22template<std::size_t N>
23class buffer
24{
25public:
26 using size_type = std::size_t;
27
28 buffer() = default;
29
30 bool
31 empty() const noexcept
32 {
33 return size_ == 0;
34 }
35
36 string_view
37 get() const noexcept
38 {
39 return {buf_, size_};
40 }
41
42 operator string_view() const noexcept
43 {
44 return get();
45 }
46
47 char const*
48 data() const noexcept
49 {
50 return buf_;
51 }
52
53 size_type
54 size() const noexcept
55 {
56 return size_;
57 }
58
59 size_type
60 capacity() const noexcept
61 {
62 return N - size_;
63 }
64
65 size_type
66 max_size() const noexcept
67 {
68 return N;
69 }
70
71 void
72 clear() noexcept
73 {
74 size_ = 0;
75 }
76
77 void
78 push_back(char ch) noexcept
79 {
80 BOOST_ASSERT(capacity() > 0);

Callers

nothing calls this directly

Calls 1

getFunction · 0.50

Tested by

no test coverage detected