mercredi 30 mars 2016

Get type of implicit conversion

How can I get the return type of an implicit conversion of an object?

struct Bar {
  operator int() const {
    return 0;
  }
};

// std::result_of<Bar>::type value; ???
// std::result_of<Bar::operator ??? >::type value;

I could use:

std::is_convertible<Bar, int>::value

but is_convertible is also true for float, unsigned int etc.... I would like to have the exact type.

Aucun commentaire:

Enregistrer un commentaire