Skip to content

how to make container like std::array in cpp2 with additional operations? since cpp2 doesn't support raw array ? #729

Answered by JohelEGP
jituderaps asked this question in Q&A
Discussion options

You must be logged in to vote

Assign to the std::array object like you do to arr in main.
elem = (ist.begin()[0], ist.begin()[1], ist.begin()[2]).
But N is unknown, and the only alternative to keep the std::copy is to first default-initialize elem with elem = ();.

You could also make it a @struct: https://cpp2.godbolt.org/z/449xEYr9e.

Replies: 3 comments 12 replies

Comment options

You must be logged in to vote
9 replies
@jituderaps
Comment options

@jituderaps
Comment options

@JohelEGP
Comment options

Answer selected by jituderaps
@jcanizales
Comment options

@jituderaps
Comment options

@msadeqhe
Comment options

@AbhinavK00
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@jituderaps
Comment options

@JohelEGP
Comment options

@gregmarr
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
8 participants