Skip to content

Commit 609d195

Browse files
authored
Merge pull request #84 from arximboldi/fix-array-empty
Fix array empty
2 parents 2e421ee + dad135d commit 609d195

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cmake_policy(SET CMP0048 NEW) # enable project VERSION
44
cmake_policy(SET CMP0056 NEW) # honor link flags in try_compile()
55
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
66

7-
project(immer VERSION 0.6.1)
7+
project(immer VERSION 0.6.2)
88

99
if (NOT MSVC)
1010
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-extended-offsetof -Wno-c++17-extensions -Wno-c++1z-extensions -Wno-unknown-warning-option")

immer/array.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class array
132132
* Returns `true` if there are no elements in the container. It
133133
* does not allocate memory and its complexity is @f$ O(1) @f$.
134134
*/
135-
IMMER_NODISCARD bool empty() const { return impl_.d->empty(); }
135+
IMMER_NODISCARD bool empty() const { return impl_.size == 0; }
136136

137137
/*!
138138
* Access the raw data.

test/vector/generic.ipp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ TEST_CASE("instantiation")
5555
{
5656
auto v = VECTOR_T<int>{};
5757
CHECK(v.size() == 0u);
58+
CHECK(v.empty());
5859
}
5960

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

6668
SECTION("big object")

0 commit comments

Comments
 (0)