add tuple_size to camp::array#194
Conversation
|
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 |
I would be fine with this. It doesn't look like it's used in RAJA, other than in my SubView PR. |
|
See #195 |
217244a to
34d0659
Compare
| #include <sstream> | ||
| #include <type_traits> | ||
|
|
||
| #include "camp/array.hpp" |
There was a problem hiding this comment.
This still seems backwards. tuple should be able to exist without knowing about array.
There was a problem hiding this comment.
If array needs tuple_size from tuple.hpp, then just have array.hpp include tuple.hpp. But tuple should be able to stand alone independent of array.
There was a problem hiding this comment.
Really the base declaration of tuple_size and tuple_element should be in a separate header that both tuple.hpp and array.hpp could include.
There was a problem hiding this comment.
Where is camp apply defined? That's what this is all about, is that in some higher level common header?
There was a problem hiding this comment.
Does it make more sense to change camp::apply to use std::tuple_size?
There was a problem hiding this comment.
What about two separate headers: one for traits common to both array and tuple (such as tuple_size), and another for common implementations (such as apply, invoke, etc..)?
There was a problem hiding this comment.
tuple_size isn't used in that many places, how about just using std::tuple_size as we should have been doing all along? We can make camp::tuple_size an alias for std::tuple_size.
There was a problem hiding this comment.
Sure, I think something like that can work. My previous point was about moving camp's tuple_size and apply(...) to a separate header so that traits/methods that are common to both camp tuples and arrays don't live in tuple.hpp, but are instead included in there as well as array.hpp. Hopefully this would address the concerns that @adayton1 mentions above.
Add tuple_size to camp::array. This is needed in order to use camp::apply on arrays.