
15 Apr
2008
15 Apr
'08
10:38 a.m.
Hi folks, In the example below, while (1) is compiling fine, (2) causes compiler error in linux gcc 4.1.3. I certainly don't want to copy the member variable of the object in copy constructor, and I need T2. How can I handle it? Thanks, emre #include <boost/noncopyable.hpp> struct A: boost::noncopyable { }; template <typename T> struct B { B() { } B(const B<T>& b) { } // (1) template <typename T2> B(const B<T2>& b) { } // (2) private: T a; }; int main() { B<A> b1; B<A> b2(b1); }