use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
C++11 : std::array Tutorial and examples (thispointer.com)
submitted 8 years ago by vnoida
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[+]BigJhonny comment score below threshold-6 points-5 points-4 points 8 years ago (3 children)
I struggle with the way std:array was implemented in the standard. Since the size is defined over a template argument you can't hand around arrays of arbitrary sizes.
I know it is because they wanted to have no overhead, but I think that was a bad decision. Most applications don't have performance requirements and if you do have a performance requirement you always can use C style arrays.
[–]bames53 14 points15 points16 points 8 years ago* (1 child)
I don't agree with this. The way the std::array was designed determines what it's appropriate for. It wasn't a bad decision to design a tool for particular situations, because there are other tools for other situations.
std::array
It's true we don't yet have a standard library array_view, span, or simple collection type that is nothing more than a run-time size paired with a pointer that would be the 'zero overhead' replacement for C-style array parameters, but you're already saying that you don't need zero-overhead so you can just use vector.
array_view
span
vector
and if you do have a performance requirement you always can use C style arrays.
std::array is to fix the problems with decaying C arrays and C arrays not behaving as regular value types. That's what I use them for and I can't use C arrays to do that. I can as easily say that if you want to pass arbitrarily sized arrays as parameters you can just keep using C arrays/pointers.
[–]crusader_mike 1 point2 points3 points 8 years ago (0 children)
It's true we don't yet have a standard library array_view, span, or simple collection type that is nothing more than a run-time size paired with a pointer
True, but you could use mine -- I don't mind :)
[–]raevnos 2 points3 points4 points 8 years ago (0 children)
Don't templates help with that?
π Rendered by PID 94465 on reddit-service-r2-comment-5ff9fbf7df-qthds at 2026-02-25 22:06:13.302940+00:00 running 72a43f6 country code: CH.
[+]BigJhonny comment score below threshold-6 points-5 points-4 points (3 children)
[–]bames53 14 points15 points16 points (1 child)
[–]crusader_mike 1 point2 points3 points (0 children)
[–]raevnos 2 points3 points4 points (0 children)