Skip to content

Commit 8698b5e

Browse files
committed
Use m_data==NULL as the condition in size()
1 parent cae71f6 commit 8698b5e

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/numpy_cpp.h

+1-7
Original file line numberDiff line numberDiff line change
@@ -539,13 +539,7 @@ class array_view : public detail::array_view_accessors<array_view, T, ND>
539539

540540
size_t size() const
541541
{
542-
bool empty = (ND == 0);
543-
for (size_t i = 0; i < ND; i++) {
544-
if (m_shape[i] == 0) {
545-
empty = true;
546-
}
547-
}
548-
if (empty) {
542+
if (m_data == NULL) {
549543
return 0;
550544
} else {
551545
return (size_t)dim(0);

0 commit comments

Comments
 (0)