4#include "../Foundation/Internal/IGrowableBuffer.h"
5#include "../Memory/Segment.h"
15struct SegmentBuffer :
public SegmentTrivial<char>,
public SegmentSelfRelativePointer<char>
17 static constexpr bool IsArray =
false;
30 using Segment::Segment;
39 SmallBuffer(SegmentAllocator allocator = SegmentAllocator::Global) noexcept :
Buffer(N, allocator) {}
42 Buffer& operator=(
const Buffer& other)
noexcept {
return Buffer::operator=(other); }
43 Buffer& operator=(
Buffer&& other)
noexcept {
return Buffer::operator=(
move(other)); }
53 SmallBuffer(
int num, SegmentAllocator allocator) :
Buffer(N, allocator) { (void)num; }
60using BufferTL = detail::SegmentCustom<Buffer, Buffer, 0, SegmentAllocator::ThreadLocal>;
62using SmallBufferTL = detail::SegmentCustom<SmallBuffer<N>,
Buffer, N, SegmentAllocator::ThreadLocal>;
71struct GrowableBuffer<
Buffer> :
public IGrowableBuffer
74 GrowableBuffer(
Buffer& buffer) : buffer(buffer) {}
75 virtual DirectAccess getDirectAccess()
override final {
return {buffer.size(), buffer.capacity(), buffer.data()}; }
76 virtual bool tryGrowTo(
size_t newSize)
override final {
return buffer.resizeWithoutInitializing(newSize); }
71struct GrowableBuffer<
Buffer> :
public IGrowableBuffer {
…};
#define SC_COMPILER_EXPORT
Macro for symbol visibility in non-MSVC compilers.
Definition Compiler.h:78
constexpr T && move(T &value)
Converts an lvalue to an rvalue reference.
Definition Compiler.h:269
unsigned long long uint64_t
Platform independent (8) bytes unsigned int.
Definition PrimitiveTypes.h:42
An heap allocated byte buffer that can optionally use an inline buffer.
Definition Buffer.h:29
A slice of contiguous memory, prefixed by and header containing size and capacity.
Definition Segment.h:113
A SC::Buffer with a dedicated custom inline buffer to avoid heap allocation.
Definition Buffer.h:38