Marked some constructor as explicit and fixed trivial documentation issues

[SVN r85307]
This commit is contained in:
Ion Gaztañaga
2013-08-11 21:33:51 +00:00
parent fbba3159f0
commit b85b40e851
18 changed files with 85 additions and 69 deletions

View File

@@ -3368,10 +3368,10 @@ To analyze the thread safety, consider the following points:
[section:scary_iterators Scary Iterators]
The paper N2913, titled [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2913.pdf,
SCARY Iterator Assignment and Initialization], proposed a requirement that a standard containers
iterator types have no dependency on any type argument apart from the containers `value_type`,
SCARY Iterator Assignment and Initialization], proposed a requirement that a standard container's
iterator types have no dependency on any type argument apart from the container's `value_type`,
`difference_type`, `pointer type`, and `const_pointer` type. In particular, according to the proposal,
the types of a standard containers iterators should not depend on the containers `key_compare`,
the types of a standard container's iterators should not depend on the container's `key_compare`,
`hasher`, `key_equal`, or `allocator` types.
That paper demonstrated that SCARY operations were crucial to the performant implementation of common

View File

@@ -444,8 +444,8 @@ class avl_set
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
avl_set( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
explicit avl_set( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, v_traits)
{}
@@ -882,8 +882,8 @@ class avl_multiset
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
avl_multiset( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
explicit avl_multiset( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, v_traits)
{}

View File

@@ -30,7 +30,6 @@
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/clear_on_destructor_base.hpp>
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/avltree_algorithms.hpp>
@@ -497,8 +496,8 @@ class avltree
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));
avltree( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
explicit avltree( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, v_traits)
{}

View File

@@ -442,8 +442,8 @@ class bs_set
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
bs_set( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
explicit bs_set( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, v_traits)
{}
@@ -531,7 +531,7 @@ class bs_multiset_impl
public:
//! @copydoc ::boost::intrusive::bstree::bstree(const value_compare &,const value_traits &)
explicit bs_multiset_impl( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
, const value_traits &v_traits = value_traits())
: tree_type(cmp, v_traits)
{}
@@ -880,8 +880,8 @@ class bs_multiset
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
bs_multiset( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
explicit bs_multiset( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, v_traits)
{}

View File

@@ -476,9 +476,12 @@ template<class ValueTraits, class VoidKeyComp, class SizeType, bool ConstantTime
#endif
class bstree_impl
: public bstbase<ValueTraits, VoidKeyComp, ConstantTimeSize, SizeType, AlgoType>
, private detail::clear_on_destructor_base<bstree_impl<ValueTraits, VoidKeyComp, SizeType, ConstantTimeSize, AlgoType> >
, private detail::clear_on_destructor_base
< bstree_impl<ValueTraits, VoidKeyComp, SizeType, ConstantTimeSize, AlgoType>
, is_safe_autounlink<detail::get_real_value_traits<ValueTraits>::type::link_mode>::value
>
{
template<class C> friend class detail::clear_on_destructor_base;
template<class C, bool> friend class detail::clear_on_destructor_base;
public:
typedef ValueTraits value_traits;
/// @cond
@@ -592,6 +595,7 @@ class bstree_impl
bstree_impl& operator=(BOOST_RV_REF(bstree_impl) x)
{ this->swap(x); return *this; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! <b>Effects</b>: Detaches all elements from this. The objects in the set
//! are not deleted (i.e. no destructors are called), but the nodes according to
//! the value_traits template parameter are reinitialized and thus can be reused.
@@ -602,8 +606,6 @@ class bstree_impl
~bstree_impl()
{}
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the container.
//!
//! <b>Complexity</b>: Constant.

View File

@@ -17,7 +17,7 @@ namespace boost {
namespace intrusive {
namespace detail {
template<class Derived>
template<class Derived, bool DoClear = true>
class clear_on_destructor_base
{
protected:
@@ -27,6 +27,10 @@ class clear_on_destructor_base
}
};
template<class Derived>
class clear_on_destructor_base<Derived, false>
{};
} // namespace detail {
} // namespace intrusive {
} // namespace boost {

View File

@@ -1092,9 +1092,12 @@ class hashtable_impl
< SizeType
, BoolFlags & hashtable_data_bool_flags_mask
, VoidOrKeyHash, VoidOrKeyEqual, ValueTraits, BucketTraits>
, private detail::clear_on_destructor_base<hashtable_impl<ValueTraits, VoidOrKeyHash, VoidOrKeyEqual, SizeType, BucketTraits, BoolFlags> >
, private detail::clear_on_destructor_base
< hashtable_impl<ValueTraits, VoidOrKeyHash, VoidOrKeyEqual, SizeType, BucketTraits, BoolFlags>
, is_safe_autounlink<detail::get_real_value_traits<ValueTraits>::type::link_mode>::value
>
{
template<class C> friend class detail::clear_on_destructor_base;
template<class C, bool> friend class detail::clear_on_destructor_base;
public:
typedef ValueTraits value_traits;
@@ -1284,6 +1287,7 @@ class hashtable_impl
hashtable_impl& operator=(BOOST_RV_REF(hashtable_impl) x)
{ this->swap(x); return *this; }
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_set
//! are not deleted (i.e. no destructors are called).
//!
@@ -1293,6 +1297,7 @@ class hashtable_impl
//! <b>Throws</b>: Nothing.
~hashtable_impl()
{}
#endif
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the unordered_set.
//!
@@ -3114,7 +3119,7 @@ class hashtable
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));
hashtable ( const bucket_traits &b_traits
explicit hashtable ( const bucket_traits &b_traits
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
, const value_traits &v_traits = value_traits())

View File

@@ -63,9 +63,12 @@ template<class T, class ...Options>
template <class ValueTraits, class SizeType, bool ConstantTimeSize>
#endif
class list_impl
: private detail::clear_on_destructor_base< list_impl<ValueTraits, SizeType, ConstantTimeSize> >
: private detail::clear_on_destructor_base
< list_impl<ValueTraits, SizeType, ConstantTimeSize>
, is_safe_autounlink<detail::get_real_value_traits<ValueTraits>::type::link_mode>::value
>
{
template<class C> friend class detail::clear_on_destructor_base;
template<class C, bool> friend class detail::clear_on_destructor_base;
//Public typedefs
public:
typedef ValueTraits value_traits;
@@ -123,7 +126,7 @@ class list_impl
struct data_t : public value_traits
{
typedef typename list_impl::value_traits value_traits;
data_t(const value_traits &val_traits)
explicit data_t(const value_traits &val_traits)
: value_traits(val_traits)
{}
@@ -224,6 +227,7 @@ class list_impl
list_impl& operator=(BOOST_RV_REF(list_impl) x)
{ this->swap(x); return *this; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! <b>Effects</b>: If it's not a safe-mode or an auto-unlink value_type
//! the destructor does nothing
//! (ie. no code is generated). Otherwise it detaches all elements from this.
@@ -235,6 +239,7 @@ class list_impl
//! it's a safe-mode or auto-unlink value . Otherwise constant.
~list_impl()
{}
#endif
//! <b>Requires</b>: value must be an lvalue.
//!
@@ -1473,7 +1478,7 @@ class list
typedef typename Base::iterator iterator;
typedef typename Base::const_iterator const_iterator;
list(const value_traits &v_traits = value_traits())
explicit list(const value_traits &v_traits = value_traits())
: Base(v_traits)
{}

View File

@@ -27,7 +27,6 @@
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/clear_on_destructor_base.hpp>
#include <boost/intrusive/detail/function_detector.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/options.hpp>
@@ -493,8 +492,8 @@ class rbtree
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));
rbtree( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
explicit rbtree( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, v_traits)
{}

View File

@@ -443,8 +443,8 @@ class set
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
set( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
explicit set( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, v_traits)
{}

View File

@@ -455,8 +455,8 @@ class sg_set
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
sg_set( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
explicit sg_set( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, v_traits)
{}

View File

@@ -34,7 +34,6 @@
#include <boost/intrusive/detail/tree_node.hpp>
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/clear_on_destructor_base.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/options.hpp>
@@ -925,8 +924,8 @@ class sgtree
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));
sgtree( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
explicit sgtree( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, v_traits)
{}

View File

@@ -99,9 +99,12 @@ template<class T, class ...Options>
template<class ValueTraits, class SizeType, std::size_t BoolFlags>
#endif
class slist_impl
: private detail::clear_on_destructor_base<slist_impl<ValueTraits, SizeType, BoolFlags> >
: private detail::clear_on_destructor_base
< slist_impl<ValueTraits, SizeType, BoolFlags>
, is_safe_autounlink<detail::get_real_value_traits<ValueTraits>::type::link_mode>::value
>
{
template<class C> friend class detail::clear_on_destructor_base;
template<class C, bool> friend class detail::clear_on_destructor_base;
//Public typedefs
public:
typedef ValueTraits value_traits;
@@ -214,7 +217,7 @@ class slist_impl
: public slist_impl::value_traits
{
typedef typename slist_impl::value_traits value_traits;
data_t(const value_traits &val_traits)
explicit data_t(const value_traits &val_traits)
: value_traits(val_traits)
{}
@@ -349,6 +352,7 @@ class slist_impl
slist_impl& operator=(BOOST_RV_REF(slist_impl) x)
{ this->swap(x); return *this; }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! <b>Effects</b>: If it's a safe-mode
//! or auto-unlink value, the destructor does nothing
//! (ie. no code is generated). Otherwise it detaches all elements from this.
@@ -360,6 +364,7 @@ class slist_impl
//! it's a safe-mode or auto-unlink value. Otherwise constant.
~slist_impl()
{}
#endif
//! <b>Effects</b>: Erases all the elements of the container.
//!

View File

@@ -511,8 +511,8 @@ class splay_set
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
splay_set( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
explicit splay_set( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, v_traits)
{}
@@ -1018,8 +1018,8 @@ class splay_multiset
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
splay_multiset( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
explicit splay_multiset( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, v_traits)
{}

View File

@@ -27,7 +27,6 @@
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/clear_on_destructor_base.hpp>
#include <boost/intrusive/detail/function_detector.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/options.hpp>
@@ -117,7 +116,7 @@ class splaytree_impl
//! @copydoc ::boost::intrusive::bstree::bstree(const value_compare &,const value_traits &)
explicit splaytree_impl( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
, const value_traits &v_traits = value_traits())
: tree_type(cmp, v_traits)
{}
@@ -654,8 +653,8 @@ class splaytree
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));
splaytree( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
explicit splaytree( const value_compare &cmp = value_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, v_traits)
{}

View File

@@ -27,7 +27,6 @@
#include <boost/intrusive/detail/tree_node.hpp>
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/clear_on_destructor_base.hpp>
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/options.hpp>
@@ -1130,9 +1129,9 @@ class treap
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));
treap( const value_compare &cmp = value_compare()
, const priority_compare &pcmp = priority_compare()
, const value_traits &v_traits = value_traits())
explicit treap( const value_compare &cmp = value_compare()
, const priority_compare &pcmp = priority_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, pcmp, v_traits)
{}

View File

@@ -471,9 +471,9 @@ class treap_set
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
treap_set( const value_compare &cmp = value_compare()
, const priority_compare &pcmp = priority_compare()
, const value_traits &v_traits = value_traits())
explicit treap_set( const value_compare &cmp = value_compare()
, const priority_compare &pcmp = priority_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, pcmp, v_traits)
{}
@@ -937,9 +937,9 @@ class treap_multiset
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
treap_multiset( const value_compare &cmp = value_compare()
, const priority_compare &pcmp = priority_compare()
, const value_traits &v_traits = value_traits())
explicit treap_multiset( const value_compare &cmp = value_compare()
, const priority_compare &pcmp = priority_compare()
, const value_traits &v_traits = value_traits())
: Base(cmp, pcmp, v_traits)
{}

View File

@@ -161,6 +161,7 @@ class unordered_set_impl
unordered_set_impl& operator=(BOOST_RV_REF(unordered_set_impl) x)
{ return static_cast<unordered_set_impl&>(table_type::operator=(::boost::move(static_cast<table_type&>(x)))); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_set
//! are not deleted (i.e. no destructors are called).
//!
@@ -171,7 +172,6 @@ class unordered_set_impl
~unordered_set_impl()
{}
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the unordered_set.
//!
//! <b>Complexity</b>: Constant time if `cache_begin<>` is true. Amortized
@@ -1089,10 +1089,10 @@ class unordered_set
typedef typename Base::hasher hasher;
typedef typename Base::key_equal key_equal;
unordered_set ( const bucket_traits &b_traits
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
, const value_traits &v_traits = value_traits())
explicit unordered_set ( const bucket_traits &b_traits
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
, const value_traits &v_traits = value_traits())
: Base(b_traits, hash_func, equal_func, v_traits)
{}
@@ -1254,6 +1254,8 @@ class unordered_multiset_impl
unordered_multiset_impl& operator=(BOOST_RV_REF(unordered_multiset_impl) x)
{ return static_cast<unordered_multiset_impl&>(table_type::operator=(::boost::move(static_cast<table_type&>(x)))); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_multiset
//! are not deleted (i.e. no destructors are called).
//!
@@ -1264,8 +1266,6 @@ class unordered_multiset_impl
~unordered_multiset_impl()
{}
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! <b>Effects</b>: Returns an iterator pointing to the beginning of the unordered_multiset.
//!
//! <b>Complexity</b>: Constant time if `cache_begin<>` is true. Amortized
@@ -2125,10 +2125,10 @@ class unordered_multiset
typedef typename Base::hasher hasher;
typedef typename Base::key_equal key_equal;
unordered_multiset( const bucket_traits &b_traits
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
, const value_traits &v_traits = value_traits())
explicit unordered_multiset( const bucket_traits &b_traits
, const hasher & hash_func = hasher()
, const key_equal &equal_func = key_equal()
, const value_traits &v_traits = value_traits())
: Base(b_traits, hash_func, equal_func, v_traits)
{}