mardi 3 novembre 2020

Enum can be passed only by right reference

I would kindly ask someone to explain me a bit why an enum can only be passed by right reference and not as simple reference ?

 namespace n1
{
    enum e1
    {
        f = 1,
        f1
    };
}
void f(n1::e1&& e)
{
    std::cout<<static_cast<int>(e);

}
int main()
{
   f(n1::e1::f1);
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire