vendredi 24 janvier 2020

call basic_string function in constexpr funnction

i search didn't find much about constexpr function. C++ primer says the return type and the type of each parameter in a must be a literal type. And now return type i use bool and parameters type i use reference.but in the return i use two basic_string function to calculation results.clion is tell me can't use basic_string function in constexpr function

constexpr bool a (const string &z , const string &zz)
{
    return (z.size() > zz.size());
}

Thank you very much for answering my question!

Aucun commentaire:

Enregistrer un commentaire