Boost logo

Boost :

From: Emre Turkay (emreturkay_at_[hidden])
Date: 2008-04-15 06:38:33


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);
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk