'Declaring a variable type from std::type_info
Can I declare variable type just from std::type_info? I would like to do something like this:
void some_function(std::type_info type){
type variable;
}
Is it possible to give it as the parameter to the function and initialize it in it?
Solution 1:[1]
I'm sure this is incorrect C++ since the type in the function declaraition is a variable name, and the type in the function body is a type name. Those can not be interchanged.
(Note: I'm deducing this by pure logic and some knowledge of C++. Other users will most probably add some information about std::type_info itself.)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | iksemyonov |
