jeudi 17 août 2017

Can I use a namespace::user-defined-literals directly in an expression

Is it possible to write a user defined literal without writing using namespace xxx;. Something like <literal value><namespace>::<UDL>; For instance

namespace tostr
{
    std::string operator "" _UP(const char *str, unsigned long long int)
    {  //transformation goes here
    }       
}

int main(int argc, char** argv) 
{
    //using namespace tostr;    
    //std::string upperCase = "hello world.\n"_UP; //OK : Works perfectly.
    //Something like this
    std::string upperCase = "hello world.\n"tostr::_UP;  //????
}

Aucun commentaire:

Enregistrer un commentaire