How do i allocate array on free store using new? #740
-
https://cpp2.godbolt.org/z/s3vqrW6v1
|
Beta Was this translation helpful? Give feedback.
Answered by
hsutter
Oct 20, 2023
Replies: 1 comment 1 reply
-
Thanks, good question! You could always do this:
Or this:
But both of those involve default-initializing all the array elements, and then deep-copying them all. I've now enabled this to work as expected (commit e6a1cc3)-- I thought this would already have worked because of P0960, but apparently not so I implemented the
Thanks! |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
hsutter
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, good question!
You could always do this:
Or this:
But both of those involve default-initializing all the array elements, and then deep-copying them all.
I've now enabled this to work as expected (commit e6a1cc3)-- I thought this would already have worked bec…