我尝试了nullptr的官方实现
我知道编译器支持nullptr和std :: nullptr_t,这个实现没有意义.我只是想学习C++.
一切工作深受GCC4.9.1我的电脑上,无论是-std = C++ 03和-std = C++ 11,即使是成功的在线@ ideone.com GCC4.3.2.
但是在VS2013中,第125行出现错误2440,转换失败
error C2440: "initialize": cannot convert "const <unnamed-type-my_nullptr>" to "int (__thiscall Test::* )(void) const" in line125
Run Code Online (Sandbox Code Playgroud)
>
#include <iostream>
#include <cassert>
// The Official proposal
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf
const // this is a const object...
class {
public:
template<class T> // convertible to any type
operator T*() const // of null non-member
{
return 0;
} // pointer...
template<class C, class T> // or any type of null …Run Code Online (Sandbox Code Playgroud)