dimanche 19 mars 2017

Which conversion will be called?

For example

struct A
{
    A(B const& b) {}  // function 1
};

struct B
{
    operator A() const { return A(); } // function 2
};

And

B b;
A a(b); // function 1 is called.

Any way to make a to be constructed or converted by function 2?

Aucun commentaire:

Enregistrer un commentaire