Skip to content

Commit

Permalink
Fix array::empty
Browse files Browse the repository at this point in the history
  • Loading branch information
arximboldi committed Jun 5, 2019
1 parent 2e421ee commit c1c7fc8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion immer/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions test/vector/generic.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ TEST_CASE("instantiation")
{
auto v = VECTOR_T<int>{};
CHECK(v.size() == 0u);
CHECK(v.empty());
}

SECTION("initializer list")
{
auto v = VECTOR_T<unsigned>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
CHECK_VECTOR_EQUALS(v, boost::irange(0u, 10u));
CHECK(!v.empty());
}

SECTION("big object")
Expand Down

0 comments on commit c1c7fc8

Please sign in to comment.