N
Noah Roberts
Considder:
struct ObjectA
{
ObjectA(ObjectA const&);
template < typename T >
ObjectA(T const&);
void fun() const;
};
struct ObjectB
{
operator ObjectA () const;
};
static_cast<ObjectA>(an_object_b).fun();
Which constructor does the standard specify will be called during the
static_cast: copy or template?
Behavior I am seeing is that the templated version is called and then
bases are called on the result of the cast operator.
Is there a way to explicitly call the cast operator or is that what I'm
supposedly doing?
struct ObjectA
{
ObjectA(ObjectA const&);
template < typename T >
ObjectA(T const&);
void fun() const;
};
struct ObjectB
{
operator ObjectA () const;
};
static_cast<ObjectA>(an_object_b).fun();
Which constructor does the standard specify will be called during the
static_cast: copy or template?
Behavior I am seeing is that the templated version is called and then
bases are called on the result of the cast operator.
Is there a way to explicitly call the cast operator or is that what I'm
supposedly doing?