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 }