Skip to content

Instantly share code, notes, and snippets.

@yumetodo
Last active November 26, 2017 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yumetodo/bc30c51346bb4f0cc7f3c601d0c3490a to your computer and use it in GitHub Desktop.
Save yumetodo/bc30c51346bb4f0cc7f3c601d0c3490a to your computer and use it in GitHub Desktop.
私は長い間nullptrの型はvoid*と思い込んで居たのですが、実は違います。
nullptrの型はstd::nullptr_tとおなじになります。
std::nullptr_tは、cstddefヘッダでtypedefされている型で、decltype(nullptr)の別名となっています。内部的な型名は決まっていません。
decltypeは(後日解説予定ですが)C++11で追加された重要機能で引数の「型」を返します。つまり、decltype(nullptr)はnullptrの「型」です。そのまんまですね。(笑)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment