Skip to content

Commit

Permalink
fix for xvector allocation in NativeVector
Browse files Browse the repository at this point in the history
  • Loading branch information
pascoec committed Sep 29, 2023
1 parent 367e397 commit dd98fe5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/core/include/math/hal/intnat/mubintvecnat.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "math/hal/intnat/ubintnat.h"
#include "math/hal/vector.h"

#include "utils/blockAllocator/xvector.h"
#include "utils/exception.h"
#include "utils/inttypes.h"
#include "utils/serializable.h"
Expand Down Expand Up @@ -125,7 +126,7 @@ class NativeVectorT final : public lbcrypto::BigVectorInterface<NativeVectorT<In
#if BLOCK_VECTOR_ALLOCATION != 1
std::vector<IntegerType> m_data{};
#else
xvector<IntegerType> m_data;
xvector<IntegerType> m_data{};
#endif

// function to check if the index is a valid index.
Expand Down
7 changes: 6 additions & 1 deletion src/core/include/utils/blockAllocator/xvector.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
#include "stl_allocator.h"

template <class _Ty, class _Ax = stl_allocator<_Ty> >
class xvector : public std::vector<_Ty, _Ax> {};
class xvector : public std::vector<_Ty, _Ax> {
public:
constexpr xvector() noexcept : std::vector<_Ty, _Ax>() {}
explicit constexpr xvector(usint length) noexcept : std::vector<_Ty, _Ax>(length) {}
constexpr xvector(usint length, const _Ty& val) noexcept : std::vector<_Ty, _Ax>(length, val) {}
};

#endif

0 comments on commit dd98fe5

Please sign in to comment.