C++ typeinfo class

Hello everyone,
Could anyone explain the below please?
I know that typeid class has private assignment operator so you cannot assign anything to it. But I see with the below code it is possible to have a const reference to it via assignment operator.

1
2
3
4
5
6
7
8
9
#include <iostream>
#include <typeinfo>
using namespace std;

int main (){
    //type_info t=typeid(int); // does not works
    const type_info &t= typeid(int); // works
    cout<<t.name();
}
While line 7 may look like an assignment operator, it's not. It's a reference, which is simply another name for typeid(int).
Thanks
So do you mean that whenever we have a reference in right hand side equal symbol is not an assignment operator ?
Topic archived. No new replies allowed.