Skip to content

add specialization for zero-sized array - #227

Open
gberg617 wants to merge 2 commits into
mainfrom
feature/bergel1/camp-array-zero-size
Open

add specialization for zero-sized array#227
gberg617 wants to merge 2 commits into
mainfrom
feature/bergel1/camp-array-zero-size

Conversation

@gberg617

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread include/camp/array.hpp
}

template <class T>
CAMP_HOST_DEVICE inline constexpr bool operator<(const array<T, 0>&,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: C++20 replaces most of these comparison operators with the three-way comparison <=> operator

Comment thread test/array.cpp

CAMP_TEST_BEGIN(array, empty)
{
// Zero sized arrays are technically not allowed,

@adayton1 adayton1 Aug 31, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can add a check on the return value of empty() for a zero length array?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or if you already check it above, just remove this comment.

Comment thread test/array.cpp

CAMP_TEST_BEGIN(array, size)
{
// Zero sized arrays are technically not allowed,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a check for size on zero length array? Or if that's already checked above, just remove this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants