This question already has answers here:
What's the difference between parentheses and braces in c++ when constructing objects
(1 answer)
what is aggregate initialization
(2 answers)
Closed 9 months ago.
From boost libraries, I found this example
I marked a line with a red arrow, indicating the notation that is confusing me.
Is this special to boost or is this some sort of anonymous function syntax? I wasn't aware that C++ or C had such notation. I only kind of recognize it from python and java experience.
Related
This question already has answers here:
Integer literal with single quotes? [duplicate]
(2 answers)
Is there a way to write a large number in C++ source code with spaces to make it more readable? [duplicate]
(6 answers)
Closed 2 years ago.
I recently came across the following C++ code snippet:
int Mod = 998'244'353;
I was intrigued by the use of single quotes in this number.
Could someone elaborate on what this gets interpreted as and why is it accepted?
Also has this formatting always been there in c++?
This question already has answers here:
Using :: (scope resolution operator) in C++
(5 answers)
When do I use a dot, arrow, or double colon to refer to members of a class in C++?
(4 answers)
Closed 2 years ago.
I've started learning Classes in C++ and have come across this :: operator. I have no idea what it means and how/when to use it. It was in every piece of C++ code I'd ever seen. The tutorial I watched didn't explain what it is. Could anyone explain?
This question already has answers here:
How does the Comma Operator work
(9 answers)
Closed 4 years ago.
I was practicing practicing some programming and by mistake wrote the following line of code :
int a,b;
cin>>a,b;
Can anybody explain what the comma does here and why doesn't the compiler show any error.
It means that the whole expression has the value b.
But because b is not initialised the behaviour of your code is undefined!
Modern compilers can warm you of this.
This question already has answers here:
C++ equivalent of java's instanceof
(5 answers)
Closed 9 years ago.
How can I check the class type in c++?
In Java I used instanceof.
I prefer not to use dynamic cast, but only classic c++.
Is there any way?
Clarification:
It isn't a duplicate of another question in StackOverflow, since I asked how can I find it without using of dynamic_cast. In the other question, the answer was to use it. Please don't mark it as a duplicated.
There is no way to check class type without RTTI or it's home brew substitution. If application compiled without RTTI information about type is not stored anywhere.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Is there any reason to use the ‘auto’ keyword in C / C++?
can anybody explain me purpose of auto keyword in c++? thanks
It's useless and is left for old code compatibility. Long ago you used it to say that a variable is automatic, this is no longer useful - all variables witout other qualifiers are treated as automatic (stack-allocated).