diff --git a/immer/array.hpp b/immer/array.hpp index 43954bb8..d9e458e3 100644 --- a/immer/array.hpp +++ b/immer/array.hpp @@ -132,7 +132,7 @@ class array * Returns `true` if there are no elements in the container. It * does not allocate memory and its complexity is @f$ O(1) @f$. */ - IMMER_NODISCARD bool empty() const { return impl_.d->empty(); } + IMMER_NODISCARD bool empty() const { return impl_.size == 0; } /*! * Access the raw data. diff --git a/test/vector/generic.ipp b/test/vector/generic.ipp index ee6edde1..c1f94a66 100644 --- a/test/vector/generic.ipp +++ b/test/vector/generic.ipp @@ -55,12 +55,14 @@ TEST_CASE("instantiation") { auto v = VECTOR_T{}; CHECK(v.size() == 0u); + CHECK(v.empty()); } SECTION("initializer list") { auto v = VECTOR_T{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; CHECK_VECTOR_EQUALS(v, boost::irange(0u, 10u)); + CHECK(!v.empty()); } SECTION("big object")