template <typename T, size_t MaxCount>

class BufferArrayFromFile

Defined at line 257 of file ../../src/lib/elfldltl/include/lib/elfldltl/memory.h

This is an implementation of the Allocator API for File::ReadArrayFromFile

that uses a fixed-capacity cpp26::inplace_vector inside the allocator object

itself. Each call takes the next unused elements of that storage, so no two

results share memory. Each result is a std::span pointing into the

allocator object, so returning results by value is cheap no matter how large

MaxCount is. The results are valid only as long as the allocator object.

So the allocator object must be used as an lvalue that outlives the results:

it cannot be copied, and calling it as an rvalue (e.g. on a temporary) is a

compile-time error. It simply fails if more than MaxCount elements in total

would be needed.

Public Methods

void BufferArrayFromFile<T, MaxCount> ()

Defined at line 259 of file ../../src/lib/elfldltl/include/lib/elfldltl/memory.h

void BufferArrayFromFile<T, MaxCount> (const BufferArrayFromFile<T, MaxCount> & )

The results point into this object, so it can't be copied or moved.

Defined at line 262 of file ../../src/lib/elfldltl/include/lib/elfldltl/memory.h

BufferArrayFromFile<T, MaxCount> & operator= (const BufferArrayFromFile<T, MaxCount> & )

Defined at line 263 of file ../../src/lib/elfldltl/include/lib/elfldltl/memory.h

std::optional<std::span<T>> operator() (size_t size)

Defined at line 265 of file ../../src/lib/elfldltl/include/lib/elfldltl/memory.h

std::optional<std::span<T>> operator() (size_t size)

The results would point into an object about to be destroyed.

Defined at line 275 of file ../../src/lib/elfldltl/include/lib/elfldltl/memory.h