Boost logo

Boost Users :

From: Matthew Bray (mat_at_[hidden])
Date: 2007-03-21 08:25:33


Thorsten Ottosen wrote:
> Matthew Bray skrev:
>> <snip>
>
> I think the documentation is incorrect.
>
> Could you check if this has been fixed in 1.34?
>
> -Thorsten
>

The code below almost allows the transfer functions to work as shown in
the current documentation, unfortunately
'reversible_ptr_container::c_private()' is protected and stopping the
lines 'from.c_private(). ...' from compiling. If c_private is made
public then the transfer functions work correctly, possibly there's a
further work-around?

Mat.

> Here's the code for 1.34:
>
> template< class PtrSeqAdapter >
> void transfer( iterator before,
> BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator
> first,
> BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator
> last,
> PtrSeqAdapter& from ) // strong
> {
> BOOST_ASSERT( (void*)&from != (void*)this );
> if( from.empty() )
> return;
> this->c_private().
> insert( before.base(),
> first.base(), last.base() ); // strong
> from.c_private().erase( first.base(),
> last.base() ); // nothrow
> }
>
> template< class PtrSeqAdapter >
> void transfer( iterator before,
> BOOST_DEDUCED_TYPENAME PtrSeqAdapter::iterator
> object,
> PtrSeqAdapter& from ) // strong
> {
> BOOST_ASSERT( (void*)&from != (void*)this );
> if( from.empty() )
> return;
> this->c_private().
> insert( before.base(),
> *object.base() ); // strong
> from.c_private().erase( object.base() ); // nothrow
> }
>
> template< class PtrSeqAdapter >
> void transfer( iterator before, PtrSeqAdapter& from ) // strong
> {
> BOOST_ASSERT( (void*)&from != (void*)this );
> if( from.empty() )
> return;
> this->c_private().
> insert( before.base(),
> from.begin().base(), from.end().base() ); // strong
> from.c_private().clear(); //
> nothrow
> }


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