* Improved vector's insertion performance.

*  Changed again experimental multiallocation interface for better performance (still experimental).
*  Added no exception support for those willing to disable exceptions in their compilers.
*  Fixed GCC -Wshadow warnings.
*  Replaced deprecated BOOST_NO_XXXX with newer BOOST_NO_CXX11_XXX macros.


[SVN r81518]
This commit is contained in:
Ion Gaztañaga
2012-11-24 21:08:18 +00:00
parent a75d72d03c
commit bc5c91bb79
28 changed files with 2449 additions and 1892 deletions
+53 -53
View File
@@ -25,8 +25,8 @@
#include <boost/container/detail/flat_tree.hpp>
#include <boost/container/detail/mpl.hpp>
#include <boost/container/allocator_traits.hpp>
#include <boost/move/move.hpp>
#include <boost/move/move_helpers.hpp>
#include <boost/move/utility.hpp>
#include <boost/move/detail/move_helpers.hpp>
namespace boost {
namespace container {
@@ -197,7 +197,7 @@ class flat_set
//! was passed to the object's constructor.
//!
//! <b>Complexity</b>: Constant.
allocator_type get_allocator() const
allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.get_allocator(); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
@@ -207,7 +207,7 @@ class flat_set
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Non-standard extension.
stored_allocator_type &get_stored_allocator()
stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.get_stored_allocator(); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
@@ -217,7 +217,7 @@ class flat_set
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Non-standard extension.
const stored_allocator_type &get_stored_allocator() const
const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.get_stored_allocator(); }
//////////////////////////////////////////////
@@ -231,7 +231,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
iterator begin()
iterator begin() BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.begin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
@@ -239,7 +239,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator begin() const
const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.begin(); }
//! <b>Effects</b>: Returns an iterator to the end of the container.
@@ -247,7 +247,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
iterator end()
iterator end() BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.end(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
@@ -255,7 +255,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator end() const
const_iterator end() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.end(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
@@ -264,7 +264,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reverse_iterator rbegin()
reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
@@ -273,7 +273,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rbegin() const
const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.rbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
@@ -282,7 +282,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reverse_iterator rend()
reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
@@ -291,7 +291,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rend() const
const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.rend(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
@@ -299,7 +299,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator cbegin() const
const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.cbegin(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
@@ -307,7 +307,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator cend() const
const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.cend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
@@ -316,7 +316,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crbegin() const
const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.crbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
@@ -325,7 +325,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crend() const
const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.crend(); }
@@ -340,7 +340,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
bool empty() const
bool empty() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.empty(); }
//! <b>Effects</b>: Returns the number of the elements contained in the container.
@@ -348,7 +348,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
size_type size() const
size_type size() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.size(); }
//! <b>Effects</b>: Returns the largest possible size of the container.
@@ -356,7 +356,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
size_type max_size() const
size_type max_size() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.max_size(); }
//! <b>Effects</b>: Number of elements for which memory has been allocated.
@@ -365,7 +365,7 @@ class flat_set
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
size_type capacity() const
size_type capacity() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.capacity(); }
//! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
@@ -375,10 +375,10 @@ class flat_set
//!
//! <b>Throws</b>: If memory allocation allocation throws or Key's copy constructor throws.
//!
//! <b>Note</b>: If capacity() is less than "count", iterators and references to
//! <b>Note</b>: If capacity() is less than "cnt", iterators and references to
//! to values might be invalidated.
void reserve(size_type count_)
{ m_flat_tree.reserve(count_); }
void reserve(size_type cnt)
{ m_flat_tree.reserve(cnt); }
//! <b>Effects</b>: Tries to deallocate the excess of memory created
// with previous allocations. The size of the vector is unchanged
@@ -582,7 +582,7 @@ class flat_set
//! <b>Postcondition</b>: size() == 0.
//!
//! <b>Complexity</b>: linear in size().
void clear()
void clear() BOOST_CONTAINER_NOEXCEPT
{ m_flat_tree.clear(); }
//////////////////////////////////////////////
@@ -726,15 +726,15 @@ inline void swap(flat_set<Key,Compare,Allocator>& x, flat_set<Key,Compare,Alloca
/// @cond
} //namespace container {
/*
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class Key, class C, class Allocator>
struct has_trivial_destructor_after_move<boost::container::flat_set<Key, C, Allocator> >
{
static const bool value = has_trivial_destructor<Allocator>::value &&has_trivial_destructor<C>::value;
static const bool value = has_trivial_destructor_after_move<Allocator>::value &&has_trivial_destructor_after_move<C>::value;
};
*/
namespace container {
// Forward declaration of operators < and ==, needed for friend declaration.
@@ -884,7 +884,7 @@ class flat_multiset
//! was passed to the object's constructor.
//!
//! <b>Complexity</b>: Constant.
allocator_type get_allocator() const
allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.get_allocator(); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
@@ -894,7 +894,7 @@ class flat_multiset
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Non-standard extension.
stored_allocator_type &get_stored_allocator()
stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.get_stored_allocator(); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
@@ -904,7 +904,7 @@ class flat_multiset
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Non-standard extension.
const stored_allocator_type &get_stored_allocator() const
const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.get_stored_allocator(); }
//! <b>Effects</b>: Returns an iterator to the first element contained in the container.
@@ -912,7 +912,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
iterator begin()
iterator begin() BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.begin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
@@ -928,7 +928,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator cbegin() const
const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.cbegin(); }
//! <b>Effects</b>: Returns an iterator to the end of the container.
@@ -936,7 +936,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
iterator end()
iterator end() BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.end(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
@@ -944,7 +944,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator end() const
const_iterator end() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.end(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
@@ -952,7 +952,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator cend() const
const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.cend(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
@@ -961,7 +961,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reverse_iterator rbegin()
reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
@@ -970,7 +970,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rbegin() const
const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.rbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
@@ -979,7 +979,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crbegin() const
const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
@@ -988,7 +988,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reverse_iterator rend()
reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
@@ -997,7 +997,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rend() const
const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
@@ -1006,7 +1006,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crend() const
const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.crend(); }
//////////////////////////////////////////////
@@ -1020,7 +1020,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
bool empty() const
bool empty() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.empty(); }
//! <b>Effects</b>: Returns the number of the elements contained in the container.
@@ -1028,7 +1028,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
size_type size() const
size_type size() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.size(); }
//! <b>Effects</b>: Returns the largest possible size of the container.
@@ -1036,7 +1036,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
size_type max_size() const
size_type max_size() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.max_size(); }
//! <b>Effects</b>: Number of elements for which memory has been allocated.
@@ -1045,7 +1045,7 @@ class flat_multiset
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
size_type capacity() const
size_type capacity() const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.capacity(); }
//! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
@@ -1055,10 +1055,10 @@ class flat_multiset
//!
//! <b>Throws</b>: If memory allocation allocation throws or Key's copy constructor throws.
//!
//! <b>Note</b>: If capacity() is less than "count", iterators and references to
//! <b>Note</b>: If capacity() is less than "cnt", iterators and references to
//! to values might be invalidated.
void reserve(size_type count_)
{ m_flat_tree.reserve(count_); }
void reserve(size_type cnt)
{ m_flat_tree.reserve(cnt); }
//! <b>Effects</b>: Tries to deallocate the excess of memory created
// with previous allocations. The size of the vector is unchanged
@@ -1244,7 +1244,7 @@ class flat_multiset
//! <b>Postcondition</b>: size() == 0.
//!
//! <b>Complexity</b>: linear in size().
void clear()
void clear() BOOST_CONTAINER_NOEXCEPT
{ m_flat_tree.clear(); }
//////////////////////////////////////////////
@@ -1388,15 +1388,15 @@ inline void swap(flat_multiset<Key,Compare,Allocator>& x, flat_multiset<Key,Comp
/// @cond
} //namespace container {
/*
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class Key, class C, class Allocator>
struct has_trivial_destructor_after_move<boost::container::flat_multiset<Key, C, Allocator> >
{
static const bool value = has_trivial_destructor<Allocator>::value && has_trivial_destructor<C>::value;
static const bool value = has_trivial_destructor_after_move<Allocator>::value && has_trivial_destructor_after_move<C>::value;
};
*/
namespace container {
/// @endcond