Skip to content

Commit

Permalink
Merge branch 'feature/use_invoke_swap' of https://github.com/Lastique…
Browse files Browse the repository at this point in the history
…/ptr_container into feature/pr-38
  • Loading branch information
pdimov committed Nov 5, 2023
2 parents 8203262 + fcc4219 commit cf94735
Show file tree
Hide file tree
Showing 40 changed files with 1,234 additions and 1,234 deletions.
10 changes: 5 additions & 5 deletions include/boost/ptr_container/clone_allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
namespace boost
{
/////////////////////////////////////////////////////////////////////////
// Clonable concept
// Clonable concept
/////////////////////////////////////////////////////////////////////////

template< class T >
inline T* new_clone( const T& r )
{
Expand All @@ -38,7 +38,7 @@ namespace boost
}



template< class T >
inline void delete_clone( const T* r )
{
Expand All @@ -48,7 +48,7 @@ namespace boost
/////////////////////////////////////////////////////////////////////////
// CloneAllocator concept
/////////////////////////////////////////////////////////////////////////

struct heap_clone_allocator
{
template< class U >
Expand All @@ -66,7 +66,7 @@ namespace boost
};



struct view_clone_allocator
{
template< class U >
Expand Down
62 changes: 31 additions & 31 deletions include/boost/ptr_container/detail/associative_ptr_container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace ptr_container_detail
const Allocator& a )
: base_type( comp, a, container_type() )
{ }

template< class Hash, class Pred, class Allocator >
associative_ptr_container( const Hash& hash,
const Pred& pred,
Expand All @@ -100,15 +100,15 @@ namespace ptr_container_detail
const Allocator& a )
: base_type( first, last, comp, a, container_type() )
{ }

template< class InputIterator, class Hash, class Pred, class Allocator >
associative_ptr_container( InputIterator first, InputIterator last,
const Hash& hash,
const Pred& pred,
const Allocator& a )
: base_type( first, last, hash, pred, a )
{ }

#ifndef BOOST_NO_AUTO_PTR
template< class PtrContainer >
explicit associative_ptr_container( std::auto_ptr<PtrContainer> r )
Expand All @@ -125,12 +125,12 @@ namespace ptr_container_detail
associative_ptr_container( const associative_ptr_container& r )
: base_type( r.begin(), r.end(), container_type() )
{ }

template< class C, class V >
associative_ptr_container( const associative_ptr_container<C,V>& r )
: base_type( r.begin(), r.end(), container_type() )
{ }

#ifndef BOOST_NO_AUTO_PTR
template< class PtrContainer >
associative_ptr_container& operator=( std::auto_ptr<PtrContainer> r ) // nothrow
Expand All @@ -147,11 +147,11 @@ namespace ptr_container_detail
return *this;
}
#endif

associative_ptr_container& operator=( associative_ptr_container r ) // strong
{
this->swap( r );
return *this;
return *this;
}

public: // associative container interface
Expand Down Expand Up @@ -179,12 +179,12 @@ namespace ptr_container_detail

size_type erase( const key_type& x ) // nothrow
{
iterator i( this->base().find( x ) );
iterator i( this->base().find( x ) );
// nothrow
if( i == this->end() ) // nothrow
return 0u; // nothrow
this->remove( i ); // nothrow
return this->base().erase( x ); // nothrow
return this->base().erase( x ); // nothrow
}

iterator erase( iterator first,
Expand All @@ -200,9 +200,9 @@ namespace ptr_container_detail
}

#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
#else
#else
template< class Range >
BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_convertible<Range&,key_type&>,
BOOST_DEDUCED_TYPENAME boost::disable_if< boost::is_convertible<Range&,key_type&>,
iterator >::type
erase( const Range& r )
{
Expand Down Expand Up @@ -230,13 +230,13 @@ namespace ptr_container_detail
AssociatePtrCont& from ) // basic
{
BOOST_ASSERT( (void*)&from != (void*)this );

size_type res = 0;
for( ; first != last; )
{
BOOST_ASSERT( first != from.end() );
this->base().insert( *first.base() ); // strong
BOOST_DEDUCED_TYPENAME AssociatePtrCont::iterator
BOOST_DEDUCED_TYPENAME AssociatePtrCont::iterator
to_delete( first );
++first;
from.base().erase( to_delete.base() ); // nothrow
Expand Down Expand Up @@ -274,7 +274,7 @@ namespace ptr_container_detail
BOOST_ASSERT( first != from.end() );
std::pair<BOOST_DEDUCED_TYPENAME base_type::ptr_iterator,bool> p =
this->base().insert( *first.base() ); // strong
BOOST_DEDUCED_TYPENAME AssociatePtrCont::iterator
BOOST_DEDUCED_TYPENAME AssociatePtrCont::iterator
to_delete( first );
++first;
if( p.second )
Expand All @@ -285,12 +285,12 @@ namespace ptr_container_detail
}
return res;
}

reference front()
{
BOOST_ASSERT( !this->empty() );
BOOST_ASSERT( *this->begin().base() != 0 );
return *this->begin();
return *this->begin();
}

const_reference front() const
Expand All @@ -302,7 +302,7 @@ namespace ptr_container_detail
{
BOOST_ASSERT( !this->empty() );
BOOST_ASSERT( *(--this->end()).base() != 0 );
return *--this->end();
return *--this->end();
}

const_reference back() const
Expand All @@ -320,37 +320,37 @@ namespace ptr_container_detail
{
return this->base().key_eq();
}

size_type bucket_count() const
{
return this->base().bucket_count();
}

size_type max_bucket_count() const
{
return this->base().max_bucket_count();
}

size_type bucket_size( size_type n ) const
{
return this->base().bucket_size( n );
}

float load_factor() const
{
return this->base().load_factor();
}

float max_load_factor() const
{
return this->base().max_load_factor();
}

void max_load_factor( float factor )
{
return this->base().max_load_factor( factor );
}

void rehash( size_type n )
{
this->base().rehash( n );
Expand Down Expand Up @@ -399,36 +399,36 @@ namespace ptr_container_detail
{
return local_iterator( this->base().begin( n ) );
}

const_local_iterator begin( size_type n ) const
{
return const_local_iterator( this->base().begin( n ) );
}

local_iterator end( size_type n )
{
return local_iterator( this->base().end( n ) );
}

const_local_iterator end( size_type n ) const
{
return const_local_iterator( this->base().end( n ) );
}

const_local_iterator cbegin( size_type n ) const
{
return const_local_iterator( this->base().cbegin( n ) );
}

const_local_iterator cend( size_type n )
{
return const_local_iterator( this->base().cend( n ) );
}

}; // class 'associative_ptr_container'

} // namespace 'ptr_container_detail'

} // namespace 'boost'

#if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
Expand Down
12 changes: 6 additions & 6 deletions include/boost/ptr_container/detail/default_deleter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

// Contains the definition of move_ptrs::default_deleter, the default
// Deleter template argument to move_ptr. Uses a technique of Daniel
// Wallin to capture the type of a pointer at the time the deleter
// is constructed, so that move_ptrs can delete objects of incomplete
// Wallin to capture the type of a pointer at the time the deleter
// is constructed, so that move_ptrs can delete objects of incomplete
// type by default.

#ifndef BOOST_MOVE_PTR_DEFAULT_DELETER_HPP_INCLUDED
#define BOOST_MOVE_PTR_DEFAULT_DELETER_HPP_INCLUDED
#define BOOST_MOVE_PTR_DEFAULT_DELETER_HPP_INCLUDED

#include <boost/checked_delete.hpp>
#include <boost/mpl/if.hpp>
Expand All @@ -29,7 +29,7 @@ struct deleter_base {
};

template<class T>
typename deleter_base<T>::deleter
typename deleter_base<T>::deleter
deleter_base<T>::delete_;

template<typename T>
Expand All @@ -40,7 +40,7 @@ struct scalar_deleter : deleter_base<T> {
};

template<typename T>
struct array_deleter
struct array_deleter
: deleter_base<typename remove_bounds<T>::type>
{
typedef typename remove_bounds<T>::type element_type;
Expand All @@ -58,7 +58,7 @@ struct default_deleter
ptr_container_detail::array_deleter<T>,
ptr_container_detail::scalar_deleter<T>
>::type
{
{
default_deleter() { }
template<typename TT>
default_deleter(default_deleter<TT>) { }
Expand Down
22 changes: 11 additions & 11 deletions include/boost/ptr_container/detail/is_convertible.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

//
// Contains type traits machinery for incomplete arrays. MPL compatibility
// is included for completeness, but is not necessary for the current
// is included for completeness, but is not necessary for the current
// application.
//
//

#ifndef BOOST_MOVE_PTR_ARRAYS_HPP_INCLUDED
#define BOOST_MOVE_PTR_ARRAYS_HPP_INCLUDED
Expand All @@ -31,11 +31,11 @@ namespace boost { namespace ptr_container_detail { namespace move_ptrs {
// From Howard Hinnant.
template<typename T, typename U>
struct is_array_convertible {
typedef typename remove_bounds<T>::type t_element;
typedef typename remove_bounds<U>::type u_element;
typedef typename remove_cv<t_element>::type t_base;
typedef typename remove_cv<u_element>::type u_base;
typedef typename
typedef typename remove_bounds<T>::type t_element;
typedef typename remove_bounds<U>::type u_element;
typedef typename remove_cv<t_element>::type t_base;
typedef typename remove_cv<u_element>::type u_base;
typedef typename
mpl::and_<
is_array<T>,
is_array<U>,
Expand All @@ -47,18 +47,18 @@ struct is_array_convertible {
};

template<typename T, typename U>
struct is_smart_ptr_convertible
struct is_smart_ptr_convertible
: mpl::if_<
is_array<T>,
is_array_convertible<T, U>,
is_convertible<T*, U*>
is_convertible<T*, U*>
>::type
{ };

#ifndef BOOST_NO_SFINAE
template<typename Src, typename Tgt, typename T = void>
struct enable_if_convertible
: enable_if<
struct enable_if_convertible
: enable_if<
is_smart_ptr_convertible<Src, Tgt>,
T
>
Expand Down
Loading

0 comments on commit cf94735

Please sign in to comment.