Boost logo

Boost Users :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2006-11-17 11:26:30


Mark Snelling wrote:
> Hi,
>
> I'm having trouble using the boost::ptr_container library. I seem to get
> this linker error with the code below under MSVC8.
>

> typedef boost::ptr_list< Test > MyList;
> typedef MyList::auto_type TestPtr;
>
> struct MyClass
> {
> MyList theList;
>
> void push( TestPtr& t )
> {

void push( Test* );

> theList.push_back ( t.release() );
> }
>
> TestPtr pop()

std::auto_ptr<Test> pop();

> {
> TestPtr t = theList.pop_front();
> return t;
> }
> };
return theList.pop_front().release();

> I'm not aware of the ptr_container library having an import library and
> am at a loss at why this error is occurring, although it seems to be
> with the MyClass::pop() method. Is it because it's returning the
> auto_type by value? If so what are the alternatives?

auto_type is not copyable, so yes, this is probably your error.

Try the interface modifications I suggest above

-Thorsten


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net