fork download
  1. #include <iostream>
  2. #include <memory>
  3. #include <typeinfo>
  4. using namespace std;
  5.  
  6. int main() {
  7. unique_ptr<int> hoge(new int);
  8. if(typeid(hoge)==typeid(int)) cout << "1" << endl;
  9. if(typeid(hoge)==typeid(int&)) cout << "2" << endl;
  10. if(typeid(hoge)==typeid(int*)) cout << "3" << endl;
  11. if(typeid(*hoge)==typeid(int)) cout << "4" << endl;
  12. if(typeid(*hoge)==typeid(int&)) cout << "5" << endl;
  13. if(typeid(*hoge)==typeid(int*)) cout << "6" << endl;
  14.  
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 4820KB
stdin
Standard input is empty
stdout
4
5