20#ifndef UTILS_INCLUDE_UTILS_COMPACT_VECTOR_HPP
21#define UTILS_INCLUDE_UTILS_COMPACT_VECTOR_HPP
25#include <boost/container/vector.hpp>
26#include <boost/serialization/array_wrapper.hpp>
27#include <boost/serialization/split_member.hpp>
33using container_size_type = std::uint16_t;
34using container_options = boost::container::vector_options<
35 boost::container::stored_size<detail::container_size_type>>::type;
45 :
public boost::container::vector<T, boost::container::new_allocator<T>,
46 detail::container_options> {
48 using boost::container::vector<T, boost::container::new_allocator<T>,
49 detail::container_options>::vector;
51 template <
class Archive>
void save(Archive &oa,
unsigned int const)
const {
52 auto const size =
static_cast<detail::container_size_type
>(this->size());
53 oa << size << boost::serialization::make_array(this->data(), this->size());
56 template <
class Archive>
void load(Archive &ia,
unsigned int const) {
57 auto size =
static_cast<detail::container_size_type
>(0u);
60 ia >> boost::serialization::make_array(this->data(), size);
63 template <
class Archive>
64 void serialize(Archive &ar,
unsigned int const file_version) {
65 boost::serialization::split_member(ar, *
this, file_version);
#define UTILS_ARRAY_BOOST_MPI_T(Container, N)
Mark array types as MPI data types.
#define UTILS_ARRAY_BOOST_CLASS(Container, N, ImplementationLevel)
Redefinition of BOOST_CLASS_IMPLEMENTATION for array types.
#define UTILS_ARRAY_BOOST_TRACK(Container, N, TrackingLevel)
Redefinition of BOOST_CLASS_TRACKING for array types.
Custom vector container optimized for size.
void serialize(Archive &ar, unsigned int const file_version)
void load(Archive &ia, unsigned int const)
void save(Archive &oa, unsigned int const) const