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).
Related
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.
This question already has answers here:
What is consteval?
(1 answer)
What is `constinit` in C++20?
(2 answers)
Closed 2 years ago.
The usage of constexpr is quite straightforward which is to make sure the code can be evaluated at the compile time itself.
But the latest features of C++ 20 which provides constinit and consteval are little bit confusing. Can someone provide the practical use case of constinit and consteval?
This question already has answers here:
Function prototype with ellipsis [duplicate]
(1 answer)
Variable number of arguments in C++?
(17 answers)
Closed 5 years ago.
I think this question already exists. But I can't search for the keyword "...". How to declare and use function with "...". Hope someone can help me solve this problem. Thank you.
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 11 years ago.
Possible Duplicate:
C++'s “placement new”
Can we create an instance of class type at the specified location in memory?if yes then how and where we should use such programming techniques?
Yes, we can. Use new(area) operator.
Another discussion at SO.