Skip to content

add tuple_size to camp::array#194

Closed
gberg617 wants to merge 1 commit intomainfrom
feature/bergel1/array-tuple-size
Closed

add tuple_size to camp::array#194
gberg617 wants to merge 1 commit intomainfrom
feature/bergel1/array-tuple-size

Conversation

@gberg617
Copy link
Collaborator

@gberg617 gberg617 commented Mar 4, 2026

Add tuple_size to camp::array. This is needed in order to use camp::apply on arrays.

@gberg617 gberg617 self-assigned this Mar 4, 2026
};

template <typename T, size_t N>
struct tuple_size<array<T, N>> : ::camp::num<N> {
Copy link
Member

Choose a reason for hiding this comment

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

There's already a tuple_size entity in array.hpp. Does that one not work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That one does not work for me because it's defined within the std namespace. camp::apply looks for camp::tuple_size, so we need to define one that specializes for camp::array.

Copy link
Member

Choose a reason for hiding this comment

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

Can you move this one to array.hpp, then?

@adayton1
Copy link
Member

adayton1 commented Mar 5, 2026

I'm actually wondering if we should remove camp::array since we should be able to use std::array in device code now that we require c++17 (almost everything in std::array is constexpr in c++17, and everything is constexpr in c++20). With nvcc you have to supply the --expt-relaxed-constexpr flag, which will make all constexpr function __host__ __device__, but with amdclang, constexpr automatically implies __host__ __device__.

@gberg617
Copy link
Collaborator Author

gberg617 commented Mar 5, 2026

I'm actually wondering if we should remove camp::array since we should be able to use std::array in device code now that we require c++17 (almost everything in std::array is constexpr in c++17, and everything is constexpr in c++20). With nvcc you have to supply the --expt-relaxed-constexpr flag, which will make all constexpr function __host__ __device__, but with amdclang, constexpr automatically implies __host__ __device__.

I would be fine with this. It doesn't look like it's used in RAJA, other than in my SubView PR.

@gberg617
Copy link
Collaborator Author

gberg617 commented Mar 5, 2026

See #195

@gberg617 gberg617 closed this Mar 5, 2026
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.

3 participants