I'm a newbie in c++11 and I'm aware of typeid().name() and nullptr. I was just having some fun with a code but i found out that sizeof(nullptr) is 4 and moreover typeid(str).name() is something complex set of characters NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
#include<iostream>
#include<string>
#include<typeinfo>
int main(){
std::string str;
std::cout<<sizeof(nullptr)<<std::endl;
std::cout<<typeid(str).name();
return 0;
}
I'm a bit confused about the output. Can someone kindly explain me ??
Aucun commentaire:
Enregistrer un commentaire