mercredi 6 novembre 2019

User-defined Literal Operator on Macros

How does one use a user-defined literal operator on a macro that expands to some literal expression?

e.g.:

std::string operator""_str(const char* sz, std::size_t len)
{
    return std::string(sz);
}

Where implementation is something like:

#define expr "expression"
auto str = expr _str;

Aucun commentaire:

Enregistrer un commentaire