#include <x/vector.H> x::vector<char> vecref(x::vector<char>::create());
The
x::vector
template class defines a reference-counted
std::vector.
In this example, “*vecref” is type convertible to a
std::vector<char>, and may be used in any
context that requires it.
This template class provides a convenient way to define reference-counted
std::vector buffers.
Additionally, the class provides methods for reading or writing the
contents of a vector to a file (usable, of course, only with vectors of
Plain Old Data).
#include <x/vector.H> #include <x/load.H> auto fd=x::fd::base::open("filename.txt"); auto vecref=x::vector<char>::base::load(fd);
The base class defins a
load() that takes an opened
x::fd,
calls create(), then loads the vector from the
opened file.