Browse Source

FIX: initializer-list contruct size error

master
parent
commit
d4493c2994
2 changed files with 6 additions and 1 deletions
  1. +1
    -1
      include/cont/deque.h
  2. +5
    -0
      test/tests/deque.cpp

+ 1
- 1
include/cont/deque.h View File

@@ -92,7 +92,7 @@ class deque {
template <typename ...It> template <typename ...It>
deque(It&& ...it) noexcept : deque(It&& ...it) noexcept :
data_{{std::forward<It>(it)...}}, data_{{std::forward<It>(it)...}},
f(data_.data(), sizeof...(It)),
f(data_.data(), N),
r(data_.data(), sizeof...(It)) { } r(data_.data(), sizeof...(It)) { }
deque(const deque&) = delete; //!< No copies deque(const deque&) = delete; //!< No copies


+ 5
- 0
test/tests/deque.cpp View File

@@ -39,9 +39,14 @@ namespace Tdeque {
TEST(Tdeque, contruct) { TEST(Tdeque, contruct) {
deque<int, 8> q1; deque<int, 8> q1;
deque<int, 8> q2{1, 2, 3, 4, 5, 6, 7, 8}; deque<int, 8> q2{1, 2, 3, 4, 5, 6, 7, 8};
deque<int, 8> q3{1, 2, 3, 4, 5};
EXPECT_EQ (8UL, q1.capacity()); EXPECT_EQ (8UL, q1.capacity());
EXPECT_EQ (0UL, q1.size());
EXPECT_EQ (8UL, q2.capacity()); EXPECT_EQ (8UL, q2.capacity());
EXPECT_EQ (8UL, q2.size());
EXPECT_EQ (8UL, q3.capacity());
EXPECT_EQ (5UL, q3.size());
} }
// simple push-pop functionality // simple push-pop functionality


Loading…
Cancel
Save