vendredi 31 mars 2017

Custom "nullptr", but how to understand the codes?

It's from Wikipedia, if our compiler don't support c++11 , we can implement one by ourselves , just like below:

const class nullptr_t
{
public:
    template<class T>
    inline operator T*() const
        { return 0; }

    template<class C, class T>
    inline operator T C::*() const
        { return 0; }

private:
    void operator&() const;
} nullptr = {};

I can't understand the above codes.

Aucun commentaire:

Enregistrer un commentaire