14#include <boost/serialization/access.hpp>
15#include <boost/serialization/base_object.hpp>
16#include <boost/serialization/vector.hpp>
27 template<
class T,
class Allocator = std::allocator<T>>
28 class Vector :
public std::vector<T, Allocator> {
33 template<
typename... Args>
53 template<
bool CheckBoundaries = false>
56 if constexpr (CheckBoundaries) {
58 std::stringstream msg;
59 msg <<
"kf::Vector::operator[]: accessing element with index out of boundaries (pos = " <<
pos
60 <<
", size = " << this->
size() <<
"). "
63 throw std::runtime_error(msg.str());
66 return BaseVector_t::operator[](
pos);
70 template<
bool CheckBoundaries = false>
71 const T&
at(std::size_t
pos)
const
73 if constexpr (CheckBoundaries) {
75 std::stringstream msg;
76 msg <<
"kf::Vector::operator[]: accessing element with index out of boundaries (pos = " <<
pos
77 <<
", size = " << this->
size() <<
"). "
80 throw std::runtime_error(msg.str());
83 return BaseVector_t::operator[](
pos);
89 template<
class Archive>
92 ar& boost::serialization::base_object<BaseVector_t>(*
this);
static constexpr size_t size()
A std::vector with additional debugging utility set.
Vector(const Vector &other)
Copy constructor.
const T & at(std::size_t pos) const
Constant access operator overload.
T & at(std::size_t pos)
Access operator overload.
std::vector< T, Allocator > BaseVector_t
Vector(Vector &&other)
Move constructor.
friend class boost::serialization::access
Serialization method.
Vector(Args... values)
Generic constructor from parameters.
Vector & operator=(Vector &&other)=default
Move assignment operator.
Vector & operator=(const Vector &other)=default
Copy assignment operator.
void serialize(Archive &ar, const unsigned int)