struct A {};
struct B
{
B (A* pA) {}
B& operator = (A* pA) { return *this; }
};
template<typename T>
struct Wrap
{
T *x;
operator T* () { return x; }
};
int main ()
{
Wrap<A> a;
B oB = a; // error: conversion from ‘Wrap<A>’ to non-scalar type ‘B’ requested
oB = a; // ok
}
Когда создается oB
, тогда почему B :: B (A *)
НЕ вызывается для Wrap
? [Примечание: B :: operator = (A *)
вызывается для Wrap
в следующем операторе]