Questions tagged [c++11]

C++11 is the name of the C++ standard, approved in 2011. It replaces the previous C++03 standard, adding various core language changes and fixes, and an improved and expanded standard library.

176 questions
15
votes
2 answers

Who is to blame for this range based for over a reference to temporary?

The following code looks rather harmless on first sight. A user uses the function bar() to interact with some library functionality. (This may have even worked for a long time since bar() returned a reference to a non-temporary value or similar.)…
hllnll
  • 199
3
votes
2 answers

New C++11 analogous to python 2 ->3?

I'm a Python2 developer and I just ordered The C++ programming language, 4th edition, from Bjarne Stroustrup's, to learn C++11. But right after I ordered it, I started to wonder if I made a mistake. Are the changes made to C++ in C++11 analogous to…
c-o-d
  • 247
1
vote
2 answers

operator"" in modern C++

I took an example I found on-line whereby a constexpr of the form _binary could be evaluated at compile time as an unsigned long long and then I tried to generalize it for any base from 2 to 36. For instance, 17b1234_baseChange would be evaluated…
1
vote
2 answers

Is it bad form to break out of Range-based for

I have a range-based for that operates over a std::vector of objects (items), like so: for(auto item : itemCollection) { if(!item.some_check(...)) { // do 5% stuff break; } // do the 95% stuff } Most of the time (>95%) the…
Bhargav
  • 306
1
vote
1 answer

argument grouping with parenthesis are valid in C++?

On python I can group arguments into a tuple, something like def func((a, b, c, d), x): print a, b, c, d, x I was wondering if it is possible to group arguments in the same way on C++, something like: void func((int a, int b, int c, int d),…
shackra
  • 113
0
votes
2 answers

What is the minimum now() functionality required for std::chrono clocks

I would like to use std::chrono::time_point in some simulation software I am writing. I would like to take advantage of features like the time point arithmetic functions. However, I run into a snag. I need to define a clock to use with my time…
Cort Ammon
  • 10,962
0
votes
1 answer

Dynamically discovering field usages for validation

Thanks for reading my question. I have a class which reads a configuration and based on the configuration, populates a data structure by reading from a database, which is ultimately presented to a processing layer that makes use of the data for…
Sampath
  • 119