this post was submitted on 08 Jul 2023
16 points (100.0% liked)
C++
1781 readers
4 users here now
The center for all discussion and news regarding C++.
Rules
- Respect instance rules.
- Don't be a jerk.
- Please keep all posts related to C++.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
One thing to remember is that arrays are just pointers under the hood. Even if you don't use them directly, or are always using smart pointers like
std::shared_ptr<T>
, they're still there.For example, accessing the following array:
Realistically in modern C++ you could likely avoid raw pointers entirely. C++ references cover a ton of the pointer use cases. I'd say the main goal is to prevent data from being copied around needlessly, since that takes more time and memory bandwidth.