lundi 30 janvier 2017

Generic static method

Hello I am trying to create a static method for checking null pointers in Unreal Engine.

.h file

template<typename T>
    static bool checkForNull(T pointer);

.cpp file

bool MyClass::checkForNull(T pointer)
{
    {
        if (!pointer) {
            printlog(FString("Your pointer is null")); //Another static function for printing
            return false;
        }
        else {
            return true;
        }
    }
}

But I am also new to C++ and I think there is a syntax error in my code? How can I create a static generic method?

Aucun commentaire:

Enregistrer un commentaire