jeudi 24 septembre 2015

Using #define for an if statement error

I'm trying to create a readable function that will contain a large amount of repeating if statement using a section of my code below.

#define if_identifier(finder, to_find) if((finder = msg.find(to_find)) != std::string npos)

std::string Utility::Decode(const char* buffer, int &playerID) {
    std::string msg(buffer);
    size_t identifier;

    if_identifier(identifier, "P_ID:[") {

    }
}

Why does this code cause a type name is not allowed error?

Aucun commentaire:

Enregistrer un commentaire