type_info as argument
1 2 3 4 5 6 7
|
void func(type_info ti) {
[...]
}
int main() {
func(typeid(Ball));
}
|
error: within this context
1>main.cpp(151): error: initializing argument 1 of 'void func(std::type_info)'
Why I receive this error message? typeid() returns a type_info class, so why I can't pass it to func as an argument?
type_info is not copyable. Pass by const reference instead.
Thanks, it works!!
1 2 3
|
void func(const type_info & ti) {
[...]
}
|
Topic archived. No new replies allowed.