Boost logo

Boost :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2004-01-20 09:28:16


On Tue, 20 Jan 2004 14:01:46 +0100, Bronek Kozicki wrote:

> On Mon, 19 Jan 2004 13:44:02 -0700, Jonathan Turkanis wrote:
> [...]
>
> #include "move_ptr.hpp" // file defined in your post
> using namespace boost;
>
> int main()
> {
> move_ptr<int> pi = move_ptr<int>(new int);
> }
>
> compiles fine under MSVC71 without "/Za" option (Disable Language
> Extensions). However with this option on, it throws rather nasty
> compilation error. Unfortunatelly, it's rather useful option - it makes

This problem goes away, if I add publicly accessible non-templated cctor
to your move_ptr implementation:

    move_ptr(const move_ptr& p)
        : d_(p.d_), v_(p.v_),
          t_(const_cast<move_ptr&>(p).release())
        { }

I think that source of this error was that compiler did not try to
instantiate templated cctor, as there was already default (non-template)
cctor defined. Unfortunatelly it was private. Now there is also suitable
public one.

B.


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