Skip to content

Commit

Permalink
Disallow const T in univector
Browse files Browse the repository at this point in the history
  • Loading branch information
dancazarin committed Feb 5, 2024
1 parent 792749a commit 5ed77d1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/kfr/base/univector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ struct alignas(platform<>::maximum_vector_alignment) univector
: std::array<T, Size>,
univector_base<T, univector<T, Size>, is_vec_element<T>>
{
static_assert(!std::is_const_v<T>, "Static vector doesn't allow T to be const");

using std::array<T, Size>::size;
using size_type = size_t;
#if !defined CMT_COMPILER_MSVC || defined CMT_COMPILER_CLANG
Expand Down Expand Up @@ -395,6 +397,8 @@ struct univector<T, tag_dynamic_vector>
: std::vector<T, data_allocator<T>>,
univector_base<T, univector<T, tag_dynamic_vector>, is_vec_element<T>>
{
static_assert(!std::is_const_v<T>, "Dynamic vector doesn't allow T to be const");

using std::vector<T, data_allocator<T>>::size;
using std::vector<T, data_allocator<T>>::vector;
using size_type = size_t;
Expand Down

0 comments on commit 5ed77d1

Please sign in to comment.