|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r79446 - trunk/boost/container
From: igaztanaga_at_[hidden]
Date: 2012-07-12 08:33:55
Author: igaztanaga
Date: 2012-07-12 08:33:54 EDT (Thu, 12 Jul 2012)
New Revision: 79446
URL: http://svn.boost.org/trac/boost/changeset/79446
Log:
Used force<> to cast references, force_copy<> to cast values.
Text files modified:
trunk/boost/container/flat_map.hpp | 138 +++++++++++++++++++++++----------------
1 files changed, 81 insertions(+), 57 deletions(-)
Modified: trunk/boost/container/flat_map.hpp
==============================================================================
--- trunk/boost/container/flat_map.hpp (original)
+++ trunk/boost/container/flat_map.hpp 2012-07-12 08:33:54 EDT (Thu, 12 Jul 2012)
@@ -264,21 +264,21 @@
//!
//! <b>Complexity</b>: Constant.
key_compare key_comp() const
- { return container_detail::force<key_compare>(m_flat_tree.key_comp()); }
+ { return container_detail::force_copy<key_compare>(m_flat_tree.key_comp()); }
//! <b>Effects</b>: Returns an object of value_compare constructed out
//! of the comparison object.
//!
//! <b>Complexity</b>: Constant.
value_compare value_comp() const
- { return value_compare(container_detail::force<key_compare>(m_flat_tree.key_comp())); }
+ { return value_compare(container_detail::force_copy<key_compare>(m_flat_tree.key_comp())); }
//! <b>Effects</b>: Returns a copy of the Allocator that
//! was passed to the object's constructor.
//!
//! <b>Complexity</b>: Constant.
allocator_type get_allocator() const
- { return container_detail::force<allocator_type>(m_flat_tree.get_allocator()); }
+ { return container_detail::force_copy<allocator_type>(m_flat_tree.get_allocator()); }
const stored_allocator_type &get_stored_allocator() const
{ return container_detail::force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
@@ -300,7 +300,7 @@
//!
//! <b>Complexity</b>: Constant.
const_iterator begin() const
- { return container_detail::force<const_iterator>(m_flat_tree.begin()); }
+ { return container_detail::force_copy<const_iterator>(m_flat_tree.begin()); }
//! <b>Effects</b>: Returns an iterator to the end of the container.
//!
@@ -316,7 +316,7 @@
//!
//! <b>Complexity</b>: Constant.
const_iterator end() const
- { return container_detail::force<const_iterator>(m_flat_tree.end()); }
+ { return container_detail::force_copy<const_iterator>(m_flat_tree.end()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
//! of the reversed container.
@@ -325,7 +325,7 @@
//!
//! <b>Complexity</b>: Constant.
reverse_iterator rbegin()
- { return container_detail::force<reverse_iterator>(m_flat_tree.rbegin()); }
+ { return container_detail::force_copy<reverse_iterator>(m_flat_tree.rbegin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed container.
@@ -334,7 +334,7 @@
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rbegin() const
- { return container_detail::force<const_reverse_iterator>(m_flat_tree.rbegin()); }
+ { return container_detail::force_copy<const_reverse_iterator>(m_flat_tree.rbegin()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed container.
@@ -343,7 +343,7 @@
//!
//! <b>Complexity</b>: Constant.
reverse_iterator rend()
- { return container_detail::force<reverse_iterator>(m_flat_tree.rend()); }
+ { return container_detail::force_copy<reverse_iterator>(m_flat_tree.rend()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed container.
@@ -352,7 +352,7 @@
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rend() const
- { return container_detail::force<const_reverse_iterator>(m_flat_tree.rend()); }
+ { return container_detail::force_copy<const_reverse_iterator>(m_flat_tree.rend()); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
//!
@@ -360,7 +360,7 @@
//!
//! <b>Complexity</b>: Constant.
const_iterator cbegin() const
- { return container_detail::force<const_iterator>(m_flat_tree.cbegin()); }
+ { return container_detail::force_copy<const_iterator>(m_flat_tree.cbegin()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
//!
@@ -368,7 +368,7 @@
//!
//! <b>Complexity</b>: Constant.
const_iterator cend() const
- { return container_detail::force<const_iterator>(m_flat_tree.cend()); }
+ { return container_detail::force_copy<const_iterator>(m_flat_tree.cend()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed container.
@@ -377,7 +377,7 @@
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crbegin() const
- { return container_detail::force<const_reverse_iterator>(m_flat_tree.crbegin()); }
+ { return container_detail::force_copy<const_reverse_iterator>(m_flat_tree.crbegin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed container.
@@ -386,7 +386,7 @@
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crend() const
- { return container_detail::force<const_reverse_iterator>(m_flat_tree.crend()); }
+ { return container_detail::force_copy<const_reverse_iterator>(m_flat_tree.crend()); }
//! <b>Effects</b>: Returns true if the container contains no elements.
//!
@@ -477,7 +477,7 @@
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
std::pair<iterator,bool> insert(const value_type& x)
- { return container_detail::force<std::pair<iterator,bool> >(
+ { return container_detail::force_copy<std::pair<iterator,bool> >(
m_flat_tree.insert_unique(container_detail::force<impl_value_type>(x))); }
//! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
@@ -492,7 +492,7 @@
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
- { return container_detail::force<std::pair<iterator,bool> >(
+ { return container_detail::force_copy<std::pair<iterator,bool> >(
m_flat_tree.insert_unique(boost::move(container_detail::force<impl_value_type>(x)))); }
//! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
@@ -508,7 +508,7 @@
//! <b>Note</b>: If an element is inserted it might invalidate elements.
std::pair<iterator,bool> insert(BOOST_RV_REF(movable_value_type) x)
{
- return container_detail::force<std::pair<iterator,bool> >
+ return container_detail::force_copy<std::pair<iterator,bool> >
(m_flat_tree.insert_unique(boost::move(x)));
}
@@ -524,8 +524,11 @@
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
iterator insert(const_iterator position, const value_type& x)
- { return container_detail::force_copy<iterator>(
- m_flat_tree.insert_unique(container_detail::force<impl_const_iterator>(position), container_detail::force<impl_value_type>(x))); }
+ {
+ return container_detail::force_copy<iterator>(
+ m_flat_tree.insert_unique( container_detail::force_copy<impl_const_iterator>(position)
+ , container_detail::force<impl_value_type>(x)));
+ }
//! <b>Effects</b>: Inserts an element move constructed from x in the container.
//! p is a hint pointing to where the insert should start to search.
@@ -539,7 +542,7 @@
iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
{
return container_detail::force_copy<iterator>
- (m_flat_tree.insert_unique( container_detail::force<impl_const_iterator>(position)
+ (m_flat_tree.insert_unique( container_detail::force_copy<impl_const_iterator>(position)
, boost::move(container_detail::force<impl_value_type>(x))));
}
@@ -555,7 +558,7 @@
iterator insert(const_iterator position, BOOST_RV_REF(movable_value_type) x)
{
return container_detail::force_copy<iterator>(
- m_flat_tree.insert_unique(container_detail::force<impl_const_iterator>(position), boost::move(x)));
+ m_flat_tree.insert_unique(container_detail::force_copy<impl_const_iterator>(position), boost::move(x)));
}
//! <b>Requires</b>: first, last are not iterators into *this.
@@ -620,8 +623,11 @@
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class... Args>
iterator emplace_hint(const_iterator hint, Args&&... args)
- { return container_detail::force_copy<iterator>
- (m_flat_tree.emplace_hint_unique(container_detail::force<impl_const_iterator>(hint), boost::forward<Args>(args)...)); }
+ {
+ return container_detail::force_copy<iterator>
+ (m_flat_tree.emplace_hint_unique( container_detail::force_copy<impl_const_iterator>(hint)
+ , boost::forward<Args>(args)...));
+ }
#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
@@ -635,7 +641,7 @@
iterator emplace_hint(const_iterator hint \
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ return container_detail::force_copy<iterator>(m_flat_tree.emplace_hint_unique \
- (container_detail::force<impl_const_iterator>(hint) \
+ (container_detail::force_copy<impl_const_iterator>(hint) \
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); } \
//!
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
@@ -654,7 +660,10 @@
//! <b>Note</b>: Invalidates elements with keys
//! not less than the erased element.
iterator erase(const_iterator position)
- { return container_detail::force_copy<iterator>(m_flat_tree.erase(container_detail::force<impl_const_iterator>(position))); }
+ {
+ return container_detail::force_copy<iterator>
+ (m_flat_tree.erase(container_detail::force_copy<impl_const_iterator>(position)));
+ }
//! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
//!
@@ -674,8 +683,11 @@
//! <b>Complexity</b>: Logarithmic search time plus erasure time
//! linear to the elements with bigger keys.
iterator erase(const_iterator first, const_iterator last)
- { return container_detail::force_copy<iterator>
- (m_flat_tree.erase(container_detail::force<impl_const_iterator>(first), container_detail::force<impl_const_iterator>(last))); }
+ {
+ return container_detail::force_copy<iterator>(
+ m_flat_tree.erase( container_detail::force_copy<impl_const_iterator>(first)
+ , container_detail::force_copy<impl_const_iterator>(last)));
+ }
//! <b>Effects</b>: erase(a.begin(),a.end()).
//!
@@ -706,7 +718,7 @@
//!
//! <b>Complexity</b>: Logarithmic.s
const_iterator find(const key_type& x) const
- { return container_detail::force<const_iterator>(m_flat_tree.find(x)); }
+ { return container_detail::force_copy<const_iterator>(m_flat_tree.find(x)); }
//! <b>Returns</b>: The number of elements with key equivalent to x.
//!
@@ -726,7 +738,7 @@
//!
//! <b>Complexity</b>: Logarithmic
const_iterator lower_bound(const key_type& x) const
- { return container_detail::force<const_iterator>(m_flat_tree.lower_bound(x)); }
+ { return container_detail::force_copy<const_iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than x, or end() if such an element is not found.
@@ -740,7 +752,7 @@
//!
//! <b>Complexity</b>: Logarithmic
const_iterator upper_bound(const key_type& x) const
- { return container_detail::force<const_iterator>(m_flat_tree.upper_bound(x)); }
+ { return container_detail::force_copy<const_iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
@@ -1050,21 +1062,21 @@
//!
//! <b>Complexity</b>: Constant.
key_compare key_comp() const
- { return container_detail::force<key_compare>(m_flat_tree.key_comp()); }
+ { return container_detail::force_copy<key_compare>(m_flat_tree.key_comp()); }
//! <b>Effects</b>: Returns an object of value_compare constructed out
//! of the comparison object.
//!
//! <b>Complexity</b>: Constant.
value_compare value_comp() const
- { return value_compare(container_detail::force<key_compare>(m_flat_tree.key_comp())); }
+ { return value_compare(container_detail::force_copy<key_compare>(m_flat_tree.key_comp())); }
//! <b>Effects</b>: Returns a copy of the Allocator that
//! was passed to the object's constructor.
//!
//! <b>Complexity</b>: Constant.
allocator_type get_allocator() const
- { return container_detail::force<allocator_type>(m_flat_tree.get_allocator()); }
+ { return container_detail::force_copy<allocator_type>(m_flat_tree.get_allocator()); }
const stored_allocator_type &get_stored_allocator() const
{ return container_detail::force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
@@ -1086,7 +1098,7 @@
//!
//! <b>Complexity</b>: Constant.
const_iterator begin() const
- { return container_detail::force<const_iterator>(m_flat_tree.begin()); }
+ { return container_detail::force_copy<const_iterator>(m_flat_tree.begin()); }
//! <b>Effects</b>: Returns an iterator to the end of the container.
//!
@@ -1102,7 +1114,7 @@
//!
//! <b>Complexity</b>: Constant.
const_iterator end() const
- { return container_detail::force<const_iterator>(m_flat_tree.end()); }
+ { return container_detail::force_copy<const_iterator>(m_flat_tree.end()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
//! of the reversed container.
@@ -1111,7 +1123,7 @@
//!
//! <b>Complexity</b>: Constant.
reverse_iterator rbegin()
- { return container_detail::force<reverse_iterator>(m_flat_tree.rbegin()); }
+ { return container_detail::force_copy<reverse_iterator>(m_flat_tree.rbegin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed container.
@@ -1120,7 +1132,7 @@
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rbegin() const
- { return container_detail::force<const_reverse_iterator>(m_flat_tree.rbegin()); }
+ { return container_detail::force_copy<const_reverse_iterator>(m_flat_tree.rbegin()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
//! of the reversed container.
@@ -1129,7 +1141,7 @@
//!
//! <b>Complexity</b>: Constant.
reverse_iterator rend()
- { return container_detail::force<reverse_iterator>(m_flat_tree.rend()); }
+ { return container_detail::force_copy<reverse_iterator>(m_flat_tree.rend()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed container.
@@ -1138,7 +1150,7 @@
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rend() const
- { return container_detail::force<const_reverse_iterator>(m_flat_tree.rend()); }
+ { return container_detail::force_copy<const_reverse_iterator>(m_flat_tree.rend()); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
//!
@@ -1146,7 +1158,7 @@
//!
//! <b>Complexity</b>: Constant.
const_iterator cbegin() const
- { return container_detail::force<const_iterator>(m_flat_tree.cbegin()); }
+ { return container_detail::force_copy<const_iterator>(m_flat_tree.cbegin()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
//!
@@ -1154,7 +1166,7 @@
//!
//! <b>Complexity</b>: Constant.
const_iterator cend() const
- { return container_detail::force<const_iterator>(m_flat_tree.cend()); }
+ { return container_detail::force_copy<const_iterator>(m_flat_tree.cend()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
//! of the reversed container.
@@ -1163,7 +1175,7 @@
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crbegin() const
- { return container_detail::force<const_reverse_iterator>(m_flat_tree.crbegin()); }
+ { return container_detail::force_copy<const_reverse_iterator>(m_flat_tree.crbegin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
//! of the reversed container.
@@ -1172,7 +1184,7 @@
//!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crend() const
- { return container_detail::force<const_reverse_iterator>(m_flat_tree.crend()); }
+ { return container_detail::force_copy<const_reverse_iterator>(m_flat_tree.crend()); }
//! <b>Effects</b>: Returns true if the container contains no elements.
//!
@@ -1214,7 +1226,10 @@
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
iterator insert(const value_type& x)
- { return container_detail::force_copy<iterator>(m_flat_tree.insert_equal(container_detail::force<impl_value_type>(x))); }
+ {
+ return container_detail::force_copy<iterator>(
+ m_flat_tree.insert_equal(container_detail::force<impl_value_type>(x)));
+ }
//! <b>Effects</b>: Inserts a new value move-constructed from x and returns
//! the iterator pointing to the newly inserted element.
@@ -1248,8 +1263,11 @@
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
iterator insert(const_iterator position, const value_type& x)
- { return container_detail::force_copy<iterator>
- (m_flat_tree.insert_equal(container_detail::force<impl_const_iterator>(position), container_detail::force<impl_value_type>(x))); }
+ {
+ return container_detail::force_copy<iterator>
+ (m_flat_tree.insert_equal( container_detail::force_copy<impl_const_iterator>(position)
+ , container_detail::force<impl_value_type>(x)));
+ }
//! <b>Effects</b>: Inserts a value move constructed from x in the container.
//! p is a hint pointing to where the insert should start to search.
@@ -1265,7 +1283,7 @@
iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
{
return container_detail::force_copy<iterator>
- (m_flat_tree.insert_equal(container_detail::force<impl_const_iterator>(position)
+ (m_flat_tree.insert_equal(container_detail::force_copy<impl_const_iterator>(position)
, boost::move(x)));
}
@@ -1283,7 +1301,7 @@
iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x)
{
return container_detail::force_copy<iterator>(
- m_flat_tree.insert_equal(container_detail::force<impl_const_iterator>(position), boost::move(x)));
+ m_flat_tree.insert_equal(container_detail::force_copy<impl_const_iterator>(position), boost::move(x)));
}
//! <b>Requires</b>: first, last are not iterators into *this.
@@ -1344,7 +1362,7 @@
iterator emplace_hint(const_iterator hint, Args&&... args)
{
return container_detail::force_copy<iterator>(m_flat_tree.emplace_hint_equal
- (container_detail::force<impl_const_iterator>(hint), boost::forward<Args>(args)...));
+ (container_detail::force_copy<impl_const_iterator>(hint), boost::forward<Args>(args)...));
}
#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
@@ -1359,7 +1377,7 @@
iterator emplace_hint(const_iterator hint \
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ return container_detail::force_copy<iterator>(m_flat_tree.emplace_hint_equal \
- (container_detail::force<impl_const_iterator>(hint) \
+ (container_detail::force_copy<impl_const_iterator>(hint) \
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); } \
//!
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
@@ -1378,7 +1396,10 @@
//! <b>Note</b>: Invalidates elements with keys
//! not less than the erased element.
iterator erase(const_iterator position)
- { return container_detail::force_copy<iterator>(m_flat_tree.erase(container_detail::force<impl_const_iterator>(position))); }
+ {
+ return container_detail::force_copy<iterator>(
+ m_flat_tree.erase(container_detail::force_copy<impl_const_iterator>(position)));
+ }
//! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
//!
@@ -1398,8 +1419,11 @@
//! <b>Complexity</b>: Logarithmic search time plus erasure time
//! linear to the elements with bigger keys.
iterator erase(const_iterator first, const_iterator last)
- { return container_detail::force_copy<iterator>
- (m_flat_tree.erase(container_detail::force<impl_const_iterator>(first), container_detail::force<impl_const_iterator>(last))); }
+ {
+ return container_detail::force_copy<iterator>
+ (m_flat_tree.erase( container_detail::force_copy<impl_const_iterator>(first)
+ , container_detail::force_copy<impl_const_iterator>(last)));
+ }
//! <b>Effects</b>: erase(a.begin(),a.end()).
//!
@@ -1430,7 +1454,7 @@
//!
//! <b>Complexity</b>: Logarithmic.
const_iterator find(const key_type& x) const
- { return container_detail::force<const_iterator>(m_flat_tree.find(x)); }
+ { return container_detail::force_copy<const_iterator>(m_flat_tree.find(x)); }
//! <b>Returns</b>: The number of elements with key equivalent to x.
//!
@@ -1450,7 +1474,7 @@
//!
//! <b>Complexity</b>: Logarithmic
const_iterator lower_bound(const key_type& x) const
- { return container_detail::force<const_iterator>(m_flat_tree.lower_bound(x)); }
+ { return container_detail::force_copy<const_iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than x, or end() if such an element is not found.
@@ -1464,20 +1488,20 @@
//!
//! <b>Complexity</b>: Logarithmic
const_iterator upper_bound(const key_type& x) const
- { return container_detail::force<const_iterator>(m_flat_tree.upper_bound(x)); }
+ { return container_detail::force_copy<const_iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
std::pair<iterator,iterator> equal_range(const key_type& x)
- { return container_detail::force<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
+ { return container_detail::force_copy<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
std::pair<const_iterator,const_iterator>
equal_range(const key_type& x) const
- { return container_detail::force<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
+ { return container_detail::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
//! <b>Effects</b>: Number of elements for which memory has been allocated.
//! capacity() is always greater than or equal to size().
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk