Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-08-21 06:47:21


From: "Henrik Ravn" <web_at_[hidden]>

> > No, that declares a function also. Try this:
> >
> > struct foo {
> > private: foo(foo const&);
> > };
> >
> > foo x((foo()));
>
> I just did; using vc++7 I get a warning saying no appropriate default
> constructor available, which is just what I would expect.
> If I add a default constructor it says that it can't access the private
> copy constructor, which means that it tries to call the copy
> constructor. (This will be optimized away, but the copy constructor has
> to be available).

Didn't you just say this would work for *any* type?
You should be able to default-construct a type which has no accessible copy
constructor.

I'm not sure what problem you're trying to solve, but open problem is:

"Given a type T with an explicit conversion from U and an object of type U,
how do I [placement] new a T"?

-----------------------------------------------------------
           David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com


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