how to make container like std::array in cpp2 with additional operations? since cpp2 doesn't support raw array ? #729
-
|
problem link: https://cpp2.godbolt.org/z/rvnqnszhd |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 12 replies
-
|
Why not use Here's the code in CE: https://cpp2.godbolt.org/z/T9Psq1dhc. That errors with:
That seems good to me. |
Beta Was this translation helpful? Give feedback.
-
You can (https://cpp2.godbolt.org/z/vrKjraPs6): |
Beta Was this translation helpful? Give feedback.
-
|
My intent was that we didn't need raw C-style arrays because Are there use cases where a |
Beta Was this translation helpful? Give feedback.
Assign to the
std::arrayobject like you do toarrinmain.elem = (ist.begin()[0], ist.begin()[1], ist.begin()[2]).But
Nis unknown, and the only alternative to keep thestd::copyis to first default-initializeelemwithelem = ();.You could also make it a
@struct: https://cpp2.godbolt.org/z/449xEYr9e.