view release on metacpan or search on metacpan
include/boost/container/detail/flat_tree.hpp view on Meta::CPAN
{ x.swap(y); }
private:
template <class InputIterator>
void priv_range_insertion_construct( bool unique_insertion, InputIterator first, InputIterator last)
{
//Use cend() as hint to achieve linear time for
//ordered ranges as required by the standard
//for the constructor
//Call end() every iteration as reallocation might have invalidated iterators
if(unique_insertion){
this->insert_unique(first, last);
}
else{
this->insert_equal (first, last);
}
}
BOOST_CONTAINER_FORCEINLINE bool priv_in_range_or_end(const_iterator pos) const
{
include/boost/container/flat_map.hpp view on Meta::CPAN
//! A flat_map satisfies all of the requirements of a container, a reversible
//! container and an associative container. A flat_map also provides
//! most operations described for unique keys. For a
//! flat_map<Key,T> the key_type is Key and the value_type is std::pair<Key,T>
//! (unlike std::map<Key, T> which value_type is std::pair<<b>const</b> Key, T>).
//!
//! flat_map is similar to std::map but it's implemented by as an ordered sequence container.
//! The underlying sequence container is by default <i>vector</i> but it can also work
//! user-provided vector-like SequenceContainers (like <i>static_vector</i> or <i>small_vector</i>).
//!
//! Using vector-like sequence containers means that inserting a new element into a flat_map might invalidate
//! previous iterators and references (unless that sequence container is <i>stable_vector</i> or a similar
//! container that offers stable pointers and references). Similarly, erasing an element might invalidate
//! iterators and references pointing to elements that come after (their keys are bigger) the erased element.
//!
//! This container provides random-access iterators.
//!
//! \tparam Key is the key_type of the map
//! \tparam Value is the <code>mapped_type</code>
//! \tparam Compare is the ordering function for Keys (e.g. <i>std::less<Key></i>).
//! \tparam AllocatorOrContainer is either:
//! - The allocator to allocate <code>value_type</code>s (e.g. <i>allocator< std::pair<Key, T> > </i>).
//! (in this case <i>sequence_type</i> will be vector<value_type, AllocatorOrContainer>)
include/boost/container/flat_map.hpp view on Meta::CPAN
//! <b>Effects</b>: If n is less than or equal to capacity(), or the
//! underlying container has no `reserve` member, this call has no
//! effect. Otherwise, it is a request for allocation of additional memory.
//! If the request is successful, then capacity() is greater than or equal to
//! n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
//!
//! <b>Throws</b>: If memory allocation allocation throws or T's copy constructor throws.
//!
//! <b>Note</b>: If capacity() is less than "cnt", iterators and references to
//! to values might be invalidated.
BOOST_CONTAINER_FORCEINLINE 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
//!
//! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to size().
BOOST_CONTAINER_FORCEINLINE void shrink_to_fit()
include/boost/container/flat_map.hpp view on Meta::CPAN
BOOST_CONTAINER_FORCEINLINE mapped_type& operator[](const key_type &k) { return this->priv_subscript(k); }
BOOST_CONTAINER_FORCEINLINE mapped_type& operator[](BOOST_RV_REF(key_type) k) { return this->priv_subscript(::boost::move(k)); }
#else
BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, this->priv_subscript)
#endif
//! Effects: If a key equivalent to k already exists in the container, assigns forward<M>(obj)
//! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value
//! as if by insert, constructing it from value_type(k, forward<M>(obj)).
//!
//! No iterators or references are invalidated. If the insertion is successful, pointers and references
//! to the element obtained while it is held in the node handle are invalidated, and pointers and
//! references obtained to that element before it was extracted become valid.
//!
//! Returns: The bool component is true if the insertion took place and false if the assignment
//! took place. The iterator component is pointing at the element that was inserted or updated.
//!
//! Complexity: Logarithmic in the size of the container.
template <class M>
BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> insert_or_assign(const key_type& k, BOOST_FWD_REF(M) obj)
{
return dtl::force_copy< std::pair<iterator, bool> >
(this->m_flat_tree.insert_or_assign
( impl_const_iterator(), k, ::boost::forward<M>(obj))
);
}
//! Effects: If a key equivalent to k already exists in the container, assigns forward<M>(obj)
//! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value
//! as if by insert, constructing it from value_type(k, move(obj)).
//!
//! No iterators or references are invalidated. If the insertion is successful, pointers and references
//! to the element obtained while it is held in the node handle are invalidated, and pointers and
//! references obtained to that element before it was extracted become valid.
//!
//! Returns: The bool component is true if the insertion took place and false if the assignment
//! took place. The iterator component is pointing at the element that was inserted or updated.
//!
//! Complexity: Logarithmic in the size of the container.
template <class M>
BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> insert_or_assign(BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
{
return dtl::force_copy< std::pair<iterator, bool> >
(this->m_flat_tree.insert_or_assign
( impl_const_iterator(), ::boost::move(k), ::boost::forward<M>(obj))
);
}
//! Effects: If a key equivalent to k already exists in the container, assigns forward<M>(obj)
//! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value
//! as if by insert, constructing it from value_type(k, forward<M>(obj)) and the new element
//! to the container as close as possible to the position just before hint.
//!
//! No iterators or references are invalidated. If the insertion is successful, pointers and references
//! to the element obtained while it is held in the node handle are invalidated, and pointers and
//! references obtained to that element before it was extracted become valid.
//!
//! Returns: The bool component is true if the insertion took place and false if the assignment
//! took place. The iterator component is pointing at the element that was inserted or updated.
//!
//! Complexity: Logarithmic in the size of the container in general, but amortized constant if
//! the new element is inserted just before hint.
template <class M>
BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, const key_type& k, BOOST_FWD_REF(M) obj)
{
include/boost/container/flat_map.hpp view on Meta::CPAN
( dtl::force_copy<impl_const_iterator>(hint)
, k, ::boost::forward<M>(obj))
);
}
//! Effects: If a key equivalent to k already exists in the container, assigns forward<M>(obj)
//! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value
//! as if by insert, constructing it from value_type(k, move(obj)) and the new element
//! to the container as close as possible to the position just before hint.
//!
//! No iterators or references are invalidated. If the insertion is successful, pointers and references
//! to the element obtained while it is held in the node handle are invalidated, and pointers and
//! references obtained to that element before it was extracted become valid.
//!
//! Returns: The bool component is true if the insertion took place and false if the assignment
//! took place. The iterator component is pointing at the element that was inserted or updated.
//!
//! Complexity: Logarithmic in the size of the container in general, but amortized constant if
//! the new element is inserted just before hint.
template <class M>
BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
{
include/boost/container/flat_map.hpp view on Meta::CPAN
//! std::forward<Args>(args)... if and only if there is no element in the container
//! with key equivalent to the key of x.
//!
//! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class... Args>
BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_FWD_REF(Args)... args)
{ return dtl::force_copy< std::pair<iterator, bool> >(m_flat_tree.emplace_unique(boost::forward<Args>(args)...)); }
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... in the container if and only if there is
//! no element in the container with key equivalent to the key of x.
//! p is a hint pointing to where the insert should start to search.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent
//! to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class... Args>
BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
{
return dtl::force_copy<iterator>
(m_flat_tree.emplace_hint_unique( dtl::force_copy<impl_const_iterator>(hint)
, boost::forward<Args>(args)...));
}
//! <b>Requires</b>: value_type shall be EmplaceConstructible into map from piecewise_construct,
//! forward_as_tuple(k), forward_as_tuple(forward<Args>(args)...).
include/boost/container/flat_map.hpp view on Meta::CPAN
//! <b>Effects</b>: Inserts x if and only if there is no element in the container
//! with key equivalent to the key of x.
//!
//! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> insert(const value_type& x)
{ return dtl::force_copy<std::pair<iterator,bool> >(
m_flat_tree.insert_unique(dtl::force<const impl_value_type>(x))); }
//! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
//! only if there is no element in the container with key equivalent to the key of x.
//!
//! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
{ return dtl::force_copy<std::pair<iterator,bool> >(
m_flat_tree.insert_unique(boost::move(dtl::force<impl_value_type>(x)))); }
//! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
//! only if there is no element in the container with key equivalent to the key of x.
//!
//! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> insert(BOOST_RV_REF(movable_value_type) x)
{
return dtl::force_copy<std::pair<iterator,bool> >
(m_flat_tree.insert_unique(boost::move(x)));
}
//! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
//! no element in the container with key equivalent to the key of x.
//! p is a hint pointing to where the insert should start to search.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent
//! to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, const value_type& x)
{
return dtl::force_copy<iterator>(
m_flat_tree.insert_unique( dtl::force_copy<impl_const_iterator>(p)
, dtl::force<const 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.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
{
return dtl::force_copy<iterator>
(m_flat_tree.insert_unique( dtl::force_copy<impl_const_iterator>(p)
, boost::move(dtl::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.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x)
{
return dtl::force_copy<iterator>(
m_flat_tree.insert_unique(dtl::force_copy<impl_const_iterator>(p), boost::move(x)));
}
//! <b>Requires</b>: first, last are not iterators into *this.
//!
//! <b>Effects</b>: inserts each element from the range [first,last) if and only
//! if there is no element with key equivalent to the key of that element.
//!
//! <b>Complexity</b>: N log(size()+N).
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last)
{ m_flat_tree.insert_unique(first, last); }
//! <b>Requires</b>: first, last are not iterators into *this.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Effects</b>: inserts each element from the range [first,last) if and only
//! if there is no element with key equivalent to the key of that element. This
//! function is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Complexity</b>: Linear.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, InputIterator first, InputIterator last)
{ m_flat_tree.insert_unique(ordered_unique_range, first, last); }
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) if and only
//! if there is no element with key equivalent to the key of that element.
//!
//! <b>Complexity</b>: N log(N).
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il)
{
m_flat_tree.insert_unique( dtl::force<impl_initializer_list>(il).begin()
, dtl::force<impl_initializer_list>(il).end());
}
//! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) if and only
//! if there is no element with key equivalent to the key of that element. This
//! function is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Complexity</b>: Linear.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
//!
//! <b>Note</b>: Non-standard extension.
BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, std::initializer_list<value_type> il)
{
m_flat_tree.insert_unique(ordered_unique_range
, dtl::force<impl_initializer_list>(il).begin()
, dtl::force<impl_initializer_list>(il).end());
}
#endif
include/boost/container/flat_map.hpp view on Meta::CPAN
{ return this->merge(static_cast<flat_multimap<Key, T, C2, AllocatorOrContainer>&>(source)); }
//! <b>Effects</b>: Erases the element pointed to by p.
//!
//! <b>Returns</b>: Returns an iterator pointing to the element immediately
//! following q prior to the element being erased. If no such element exists,
//! returns end().
//!
//! <b>Complexity</b>: Linear to the elements with keys bigger than p
//!
//! <b>Note</b>: Invalidates elements with keys
//! not less than the erased element.
BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator p)
{
return dtl::force_copy<iterator>
(m_flat_tree.erase(dtl::force_copy<impl_const_iterator>(p)));
}
//! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
//!
//! <b>Returns</b>: Returns the number of erased elements.
include/boost/container/flat_map.hpp view on Meta::CPAN
//!
//! A flat_multimap satisfies all of the requirements of a container and of a reversible
//! container and of an associative container. For a
//! flat_multimap<Key,T> the key_type is Key and the value_type is std::pair<Key,T>
//! (unlike std::multimap<Key, T> which value_type is std::pair<<b>const</b> Key, T>).
//!
//! flat_multimap is similar to std::multimap but it's implemented by as an ordered sequence container.
//! The underlying sequence container is by default <i>vector</i> but it can also work
//! user-provided vector-like SequenceContainers (like <i>static_vector</i> or <i>small_vector</i>).
//!
//! Using vector-like sequence containers means that inserting a new element into a flat_multimap might invalidate
//! previous iterators and references (unless that sequence container is <i>stable_vector</i> or a similar
//! container that offers stable pointers and references). Similarly, erasing an element might invalidate
//! iterators and references pointing to elements that come after (their keys are bigger) the erased element.
//!
//! This container provides random-access iterators.
//!
//! \tparam Key is the key_type of the map
//! \tparam Value is the <code>mapped_type</code>
//! \tparam Compare is the ordering function for Keys (e.g. <i>std::less<Key></i>).
//! \tparam AllocatorOrContainer is either:
//! - The allocator to allocate <code>value_type</code>s (e.g. <i>allocator< std::pair<Key, T> > </i>).
//! (in this case <i>sequence_type</i> will be vector<value_type, AllocatorOrContainer>)
include/boost/container/flat_map.hpp view on Meta::CPAN
//! <b>Effects</b>: If n is less than or equal to capacity(), or the
//! underlying container has no `reserve` member, this call has no
//! effect. Otherwise, it is a request for allocation of additional memory.
//! If the request is successful, then capacity() is greater than or equal to
//! n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
//!
//! <b>Throws</b>: If memory allocation allocation throws or T's copy constructor throws.
//!
//! <b>Note</b>: If capacity() is less than "cnt", iterators and references to
//! to values might be invalidated.
BOOST_CONTAINER_FORCEINLINE
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
//!
//! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to size().
include/boost/container/flat_map.hpp view on Meta::CPAN
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... and returns the iterator pointing to the
//! newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class... Args>
BOOST_CONTAINER_FORCEINLINE
iterator emplace(BOOST_FWD_REF(Args)... args)
{ return dtl::force_copy<iterator>(m_flat_tree.emplace_equal(boost::forward<Args>(args)...)); }
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... in the container.
//! p is a hint pointing to where the insert should start to search.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent
//! to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time (constant time if the value
//! is to be inserted before p) plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class... Args>
BOOST_CONTAINER_FORCEINLINE
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
{
return dtl::force_copy<iterator>(m_flat_tree.emplace_hint_equal
(dtl::force_copy<impl_const_iterator>(hint), boost::forward<Args>(args)...));
}
#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
include/boost/container/flat_map.hpp view on Meta::CPAN
#undef BOOST_CONTAINER_FLAT_MULTIMAP_EMPLACE_CODE
#endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
//! <b>Effects</b>: Inserts x and returns the iterator pointing to the
//! newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE iterator insert(const value_type& x)
{
return dtl::force_copy<iterator>(
m_flat_tree.insert_equal(dtl::force<const 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.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE iterator insert(BOOST_RV_REF(value_type) x)
{ return dtl::force_copy<iterator>(m_flat_tree.insert_equal(boost::move(x))); }
//! <b>Effects</b>: Inserts a new value move-constructed from x and returns
//! the iterator pointing to the newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE iterator insert(BOOST_RV_REF(impl_value_type) x)
{ return dtl::force_copy<iterator>(m_flat_tree.insert_equal(boost::move(x))); }
//! <b>Effects</b>: Inserts a copy of x in the container.
//! p is a hint pointing to where the insert should start to search.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent
//! to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time (constant time if the value
//! is to be inserted before p) plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, const value_type& x)
{
return dtl::force_copy<iterator>
(m_flat_tree.insert_equal( dtl::force_copy<impl_const_iterator>(p)
, dtl::force<const 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.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent
//! to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time (constant time if the value
//! is to be inserted before p) plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
{
return dtl::force_copy<iterator>
(m_flat_tree.insert_equal(dtl::force_copy<impl_const_iterator>(p)
, boost::move(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.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent
//! to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time (constant time if the value
//! is to be inserted before p) plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(impl_value_type) x)
{
return dtl::force_copy<iterator>(
m_flat_tree.insert_equal(dtl::force_copy<impl_const_iterator>(p), boost::move(x)));
}
//! <b>Requires</b>: first, last are not iterators into *this.
//!
//! <b>Effects</b>: inserts each element from the range [first,last) .
//!
//! <b>Complexity</b>: N log(N).
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last)
{ m_flat_tree.insert_equal(first, last); }
//! <b>Requires</b>: first, last are not iterators into *this.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
//!
//! <b>Effects</b>: inserts each element from the range [first,last) if and only
//! if there is no element with key equivalent to the key of that element. This
//! function is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Complexity</b>: Linear.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
//!
//! <b>Note</b>: Non-standard extension.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, InputIterator first, InputIterator last)
{ m_flat_tree.insert_equal(ordered_range, first, last); }
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) .
//!
//! <b>Complexity</b>: N log(N).
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il)
{
m_flat_tree.insert_equal( dtl::force<impl_initializer_list>(il).begin()
, dtl::force<impl_initializer_list>(il).end());
}
//! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate.
//!
//! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) if and only
//! if there is no element with key equivalent to the key of that element. This
//! function is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Complexity</b>: Linear.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
//!
//! <b>Note</b>: Non-standard extension.
BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, std::initializer_list<value_type> il)
{
m_flat_tree.insert_equal( ordered_range
, dtl::force<impl_initializer_list>(il).begin()
, dtl::force<impl_initializer_list>(il).end());
}
#endif
include/boost/container/flat_map.hpp view on Meta::CPAN
{ return this->merge(static_cast<flat_map<Key, T, C2, AllocatorOrContainer>&>(source)); }
//! <b>Effects</b>: Erases the element pointed to by p.
//!
//! <b>Returns</b>: Returns an iterator pointing to the element immediately
//! following q prior to the element being erased. If no such element exists,
//! returns end().
//!
//! <b>Complexity</b>: Linear to the elements with keys bigger than p
//!
//! <b>Note</b>: Invalidates elements with keys
//! not less than the erased element.
BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator p)
{
return dtl::force_copy<iterator>(
m_flat_tree.erase(dtl::force_copy<impl_const_iterator>(p)));
}
//! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
//!
//! <b>Returns</b>: Returns the number of erased elements.
include/boost/container/flat_set.hpp view on Meta::CPAN
class flat_multiset;
#endif
//! flat_set is a Sorted Associative Container that stores objects of type Key.
//! It is also a Unique Associative Container, meaning that no two elements are the same.
//!
//! flat_set is similar to std::set but it's implemented by as an ordered sequence container.
//! The underlying sequence container is by default <i>vector</i> but it can also work
//! user-provided vector-like SequenceContainers (like <i>static_vector</i> or <i>small_vector</i>).
//!
//! Using vector-like sequence containers means that inserting a new element into a flat_set might invalidate
//! previous iterators and references (unless that sequence container is <i>stable_vector</i> or a similar
//! container that offers stable pointers and references). Similarly, erasing an element might invalidate
//! iterators and references pointing to elements that come after (their keys are bigger) the erased element.
//!
//! This container provides random-access iterators.
//!
//! \tparam Key is the type to be inserted in the set, which is also the key_type
//! \tparam Compare is the comparison functor used to order keys
//! \tparam AllocatorOrContainer is either:
//! - The allocator to allocate <code>value_type</code>s (e.g. <i>allocator< std::pair<Key, T> > </i>).
//! (in this case <i>sequence_type</i> will be vector<value_type, AllocatorOrContainer>)
//! - The SequenceContainer to be used as the underlying <i>sequence_type</i>. It must be a vector-like
include/boost/container/flat_set.hpp view on Meta::CPAN
//! <b>Effects</b>: If n is less than or equal to capacity(), or the
//! underlying container has no `reserve` member, this call has no
//! effect. Otherwise, it is a request for allocation of additional memory.
//! If the request is successful, then capacity() is greater than or equal to
//! n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
//!
//! <b>Throws</b>: If memory allocation allocation throws or T's copy constructor throws.
//!
//! <b>Note</b>: If capacity() is less than "cnt", iterators and references to
//! to values might be invalidated.
void reserve(size_type cnt);
//! <b>Effects</b>: Tries to deallocate the excess of memory created
// with previous allocations. The size of the vector is unchanged
//!
//! <b>Throws</b>: If memory allocation throws, or Key's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to size().
void shrink_to_fit();
include/boost/container/flat_set.hpp view on Meta::CPAN
//! std::forward<Args>(args)... if and only if there is no element in the container
//! with key equivalent to the key of x.
//!
//! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class... Args>
BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_FWD_REF(Args)... args)
{ return this->tree_t::emplace_unique(boost::forward<Args>(args)...); }
//! <b>Effects</b>: Inserts an object of type Key constructed with
//! std::forward<Args>(args)... in the container if and only if there is
//! no element in the container with key equivalent to the key of x.
//! p is a hint pointing to where the insert should start to search.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent
//! to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class... Args>
BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args)
{ return this->tree_t::emplace_hint_unique(p, boost::forward<Args>(args)...); }
#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE(N) \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_MOVE_UREF##N)\
{ return this->tree_t::emplace_unique(BOOST_MOVE_FWD##N); }\
include/boost/container/flat_set.hpp view on Meta::CPAN
//! <b>Effects</b>: Inserts x if and only if there is no element in the container
//! with key equivalent to the key of x.
//!
//! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
std::pair<iterator, bool> insert(const value_type &x);
//! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
//! only if there is no element in the container with key equivalent to the key of x.
//!
//! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
std::pair<iterator, bool> insert(value_type &&x);
#else
private:
typedef std::pair<iterator, bool> insert_return_pair;
public:
BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, insert_return_pair, this->priv_insert)
#endif
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
//! no element in the container with key equivalent to the key of x.
//! p is a hint pointing to where the insert should start to search.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent
//! to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
iterator insert(const_iterator p, const 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.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
iterator insert(const_iterator p, value_type &&x);
#else
BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator)
#endif
//! <b>Requires</b>: first, last are not iterators into *this.
//!
//! <b>Effects</b>: inserts each element from the range [first,last) if and only
//! if there is no element with key equivalent to the key of that element.
//!
//! <b>Complexity</b>: N log(N).
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last)
{ this->tree_t::insert_unique(first, last); }
//! <b>Requires</b>: first, last are not iterators into *this and
//! must be ordered according to the predicate and must be
//! unique values.
//!
//! <b>Effects</b>: inserts each element from the range [first,last) .This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Complexity</b>: Linear.
//!
//! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, InputIterator first, InputIterator last)
{ this->tree_t::insert_unique(ordered_unique_range, first, last); }
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) if and only
//! if there is no element with key equivalent to the key of that element.
//!
//! <b>Complexity</b>: N log(N).
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il)
{ this->tree_t::insert_unique(il.begin(), il.end()); }
//! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate
//! and must be unique values.
//!
//! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) .This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Complexity</b>: Linear.
//!
//! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, std::initializer_list<value_type> il)
{ this->tree_t::insert_unique(ordered_unique_range, il.begin(), il.end()); }
#endif
//! @copydoc ::boost::container::flat_map::merge(flat_map<Key, T, C2, AllocatorOrContainer>&)
template<class C2>
BOOST_CONTAINER_FORCEINLINE void merge(flat_set<Key, C2, AllocatorOrContainer>& source)
{ this->tree_t::merge_unique(source.tree()); }
//! @copydoc ::boost::container::flat_set::merge(flat_set<Key, C2, AllocatorOrContainer>&)
include/boost/container/flat_set.hpp view on Meta::CPAN
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Erases the element pointed to by p.
//!
//! <b>Returns</b>: Returns an iterator pointing to the element immediately
//! following q prior to the element being erased. If no such element exists,
//! returns end().
//!
//! <b>Complexity</b>: Linear to the elements with keys bigger than p
//!
//! <b>Note</b>: Invalidates elements with keys
//! not less than the erased element.
iterator erase(const_iterator p);
//! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
//!
//! <b>Returns</b>: Returns the number of erased elements.
//!
//! <b>Complexity</b>: Logarithmic search time plus erasure time
//! linear to the elements with bigger keys.
size_type erase(const key_type& x);
include/boost/container/flat_set.hpp view on Meta::CPAN
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! flat_multiset is a Sorted Associative Container that stores objects of type Key and
//! can store multiple copies of the same key value.
//!
//! flat_multiset is similar to std::multiset but it's implemented by as an ordered sequence container.
//! The underlying sequence container is by default <i>vector</i> but it can also work
//! user-provided vector-like SequenceContainers (like <i>static_vector</i> or <i>small_vector</i>).
//!
//! Using vector-like sequence containers means that inserting a new element into a flat_multiset might invalidate
//! previous iterators and references (unless that sequence container is <i>stable_vector</i> or a similar
//! container that offers stable pointers and references). Similarly, erasing an element might invalidate
//! iterators and references pointing to elements that come after (their keys are bigger) the erased element.
//!
//! This container provides random-access iterators.
//!
//! \tparam Key is the type to be inserted in the multiset, which is also the key_type
//! \tparam Compare is the comparison functor used to order keys
//! \tparam AllocatorOrContainer is either:
//! - The allocator to allocate <code>value_type</code>s (e.g. <i>allocator< std::pair<Key, T> > </i>).
//! (in this case <i>sequence_type</i> will be vector<value_type, AllocatorOrContainer>)
//! - The SequenceContainer to be used as the underlying <i>sequence_type</i>. It must be a vector-like
include/boost/container/flat_set.hpp view on Meta::CPAN
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object of type Key constructed with
//! std::forward<Args>(args)... and returns the iterator pointing to the
//! newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class... Args>
BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_FWD_REF(Args)... args)
{ return this->tree_t::emplace_equal(boost::forward<Args>(args)...); }
//! <b>Effects</b>: Inserts an object of type Key constructed with
//! std::forward<Args>(args)... in the container.
//! p is a hint pointing to where the insert should start to search.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent
//! to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class... Args>
BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args)
{ return this->tree_t::emplace_hint_equal(p, boost::forward<Args>(args)...); }
#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE(N) \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_MOVE_UREF##N)\
{ return this->tree_t::emplace_equal(BOOST_MOVE_FWD##N); }\
include/boost/container/flat_set.hpp view on Meta::CPAN
#endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts x and returns the iterator pointing to the
//! newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
iterator insert(const value_type &x);
//! <b>Effects</b>: Inserts a new value_type move constructed from x
//! and returns the iterator pointing to the newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
iterator insert(value_type &&x);
#else
BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, iterator, this->priv_insert)
#endif
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts a copy of x in the container.
//! p is a hint pointing to where the insert should start to search.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent
//! to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
iterator insert(const_iterator p, const value_type &x);
//! <b>Effects</b>: Inserts a new value move constructed from x in the container.
//! p is a hint pointing to where the insert should start to search.
//!
//! <b>Returns</b>: An iterator pointing to the element with key equivalent
//! to the key of x.
//!
//! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
iterator insert(const_iterator p, value_type &&x);
#else
BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator)
#endif
//! <b>Requires</b>: first, last are not iterators into *this.
//!
//! <b>Effects</b>: inserts each element from the range [first,last) .
//!
//! <b>Complexity</b>: N log(N).
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last)
{ this->tree_t::insert_equal(first, last); }
//! <b>Requires</b>: first, last are not iterators into *this and
//! must be ordered according to the predicate.
//!
//! <b>Effects</b>: inserts each element from the range [first,last) .This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Complexity</b>: Linear.
//!
//! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
template <class InputIterator>
BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, InputIterator first, InputIterator last)
{ this->tree_t::insert_equal(ordered_range, first, last); }
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()).
//!
//! <b>Complexity</b>: N log(N).
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il)
{ this->tree_t::insert_equal(il.begin(), il.end()); }
//! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate.
//!
//! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Complexity</b>: Linear.
//!
//! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, std::initializer_list<value_type> il)
{ this->tree_t::insert_equal(ordered_range, il.begin(), il.end()); }
#endif
//! @copydoc ::boost::container::flat_multimap::merge(flat_multimap<Key, T, C2, AllocatorOrContainer>&)
template<class C2>
BOOST_CONTAINER_FORCEINLINE void merge(flat_multiset<Key, C2, AllocatorOrContainer>& source)
{ this->tree_t::merge_equal(source.tree()); }
//! @copydoc ::boost::container::flat_multiset::merge(flat_multiset<Key, C2, AllocatorOrContainer>&)
include/boost/container/list.hpp view on Meta::CPAN
>::type container_type;
typedef container_type type ;
};
} //namespace dtl {
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! A list is a doubly linked list. That is, it is a Sequence that supports both
//! forward and backward traversal, and (amortized) constant time insertion and
//! removal of elements at the beginning or the end, or in the middle. Lists have
//! the important property that insertion and splicing do not invalidate iterators
//! to list elements, and that even removal invalidates only the iterators that point
//! to the elements that are removed. The ordering of iterators may be changed
//! (that is, list<T>::iterator might have a different predecessor or successor
//! after a list operation than it did before), but the iterators themselves will
//! not be invalidated or made to point to different elements unless that invalidation
//! or mutation is explicit.
//!
//! \tparam T The type of object that is stored in the list
//! \tparam Allocator The allocator used for all internal memory management
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Allocator = new_allocator<T> >
#else
template <class T, class Allocator>
#endif
class list
include/boost/container/list.hpp view on Meta::CPAN
//! by the list. x != *this. this' allocator and x's allocator shall compare equal
//!
//! <b>Effects</b>: Transfers all the elements of list x to this list, before the
//! the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of
//! this list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list& x) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT((priv_is_linked)(p));
BOOST_ASSERT(this != &x);
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
this->icont().splice(p.get(), x.icont());
}
//! <b>Requires</b>: p must point to an element contained
//! by the list. x != *this. this' allocator and x's allocator shall compare equal
//!
//! <b>Effects</b>: Transfers all the elements of list x to this list, before the
//! the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of
//! this list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, BOOST_RV_REF(list) x) BOOST_NOEXCEPT_OR_NOTHROW
{
//Checks done in splice
this->splice(p, static_cast<list&>(x));
}
//! <b>Requires</b>: p must point to an element contained
//! by this list. i must point to an element contained in list x.
//! this' allocator and x's allocator shall compare equal
//!
//! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//! If p == i or p == ++i, this function is a null operation.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list &x, const_iterator i) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT((priv_is_linked)(p));
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
this->icont().splice(p.get(), x.icont(), i.get());
}
//! <b>Requires</b>: p must point to an element contained
//! by this list. i must point to an element contained in list x.
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//! If p == i or p == ++i, this function is a null operation.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, BOOST_RV_REF(list) x, const_iterator i) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this != &x);
//Additional checks done in splice()
this->splice(p, static_cast<list&>(x), i);
}
//! <b>Requires</b>: p must point to an element contained
//! by this list. first and last must point to elements contained in list x.
//! this' allocator and x's allocator shall compare equal
//!
//! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear to the number of elements transferred.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list &x, const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT((priv_is_linked)(p));
BOOST_ASSERT(first == last || (first != x.cend() && x.priv_is_linked(first)));
BOOST_ASSERT(first == last || x.priv_is_linked(last));
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
this->icont().splice(p.get(), x.icont(), first.get(), last.get());
}
//! <b>Requires</b>: p must point to an element contained
include/boost/container/list.hpp view on Meta::CPAN
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear to the number of elements transferred.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, BOOST_RV_REF(list) x, const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this != &x);
//Additional checks done in splice()
this->splice(p, static_cast<list&>(x), first, last);
}
//! <b>Requires</b>: p must point to an element contained
//! by this list. first and last must point to elements contained in list x.
//! n == distance(first, last). this' allocator and x's allocator shall compare equal
//!
//! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
//!
//! <b>Note</b>: Non-standard extension
void splice(const_iterator p, list &x, const_iterator first, const_iterator last, size_type n) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
this->icont().splice(p.get(), x.icont(), first.get(), last.get(), n);
}
//! <b>Requires</b>: p must point to an element contained
//! by this list. first and last must point to elements contained in list x.
//! n == distance(first, last). this' allocator and x's allocator shall compare equal
//!
//! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
//!
//! <b>Note</b>: Non-standard extension
void splice(const_iterator p, BOOST_RV_REF(list) x, const_iterator first, const_iterator last, size_type n) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice(p, static_cast<list&>(x), first, last, n); }
//! <b>Effects</b>: Removes all the elements that compare equal to value.
//!
//! <b>Throws</b>: If comparison throws.
//!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
include/boost/container/list.hpp view on Meta::CPAN
//!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
//! in order into *this. The merge is stable; that is, if an element from *this is
//! equivalent to one from x, then the element from *this will precede the one from x.
//!
//! <b>Throws</b>: If comp throws.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references to *this are not invalidated.
template <class StrictWeakOrdering>
void merge(list &x, const StrictWeakOrdering &comp)
{
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
typedef value_to_node_compare<Node, StrictWeakOrdering> value_to_node_compare_type;
this->icont().merge(x.icont(), value_to_node_compare_type(comp));
}
//! <b>Requires</b>: p must be a comparison function that induces a strict weak
//! ordering and both *this and x must be sorted according to that ordering
include/boost/container/list.hpp view on Meta::CPAN
//!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
//! in order into *this. The merge is stable; that is, if an element from *this is
//! equivalent to one from x, then the element from *this will precede the one from x.
//!
//! <b>Throws</b>: If comp throws.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references to *this are not invalidated.
template <class StrictWeakOrdering>
void merge(BOOST_RV_REF(list) x, StrictWeakOrdering comp)
{ this->merge(static_cast<list&>(x), comp); }
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
//!
//! <b>Throws</b>: If comparison throws.
//!
//! <b>Notes</b>: Iterators and references are not invalidated.
//!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
void sort()
{ this->sort(value_less_t()); }
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
//!
//! <b>Throws</b>: If comp throws.
//!
//! <b>Notes</b>: Iterators and references are not invalidated.
//!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
template <class StrictWeakOrdering>
void sort(StrictWeakOrdering comp)
{
// nothing if the list has length 0 or 1.
if (this->size() < 2)
return;
typedef value_to_node_compare<Node, StrictWeakOrdering> value_to_node_compare_type;
this->icont().sort(value_to_node_compare_type(comp));
}
//! <b>Effects</b>: Reverses the order of elements in the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: This function is linear time.
//!
//! <b>Note</b>: Iterators and references are not invalidated
void reverse() BOOST_NOEXCEPT_OR_NOTHROW
{ this->icont().reverse(); }
//! <b>Effects</b>: Returns true if x and y are equal
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
friend bool operator==(const list& x, const list& y)
{ return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); }
//! <b>Effects</b>: Returns true if x and y are unequal
include/boost/container/map.hpp view on Meta::CPAN
BOOST_CONTAINER_FORCEINLINE mapped_type& operator[](const key_type &k) { return this->priv_subscript(k); }
BOOST_CONTAINER_FORCEINLINE mapped_type& operator[](BOOST_RV_REF(key_type) k) { return this->priv_subscript(::boost::move(k)); }
#else
BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, this->priv_subscript)
#endif
//! <b>Effects</b>: If a key equivalent to k already exists in the container, assigns forward<M>(obj)
//! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value
//! as if by insert, constructing it from value_type(k, forward<M>(obj)).
//!
//! No iterators or references are invalidated. If the insertion is successful, pointers and references
//! to the element obtained while it is held in the node handle are invalidated, and pointers and
//! references obtained to that element before it was extracted become valid.
//!
//! <b>Returns</b>: The bool component is true if the insertion took place and false if the assignment
//! took place. The iterator component is pointing at the element that was inserted or updated.
//!
//! <b>Complexity</b>: Logarithmic in the size of the container.
template <class M>
BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> insert_or_assign(const key_type& k, BOOST_FWD_REF(M) obj)
{ return this->base_t::insert_or_assign(const_iterator(), k, ::boost::forward<M>(obj)); }
//! <b>Effects</b>: If a key equivalent to k already exists in the container, assigns forward<M>(obj)
//! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value
//! as if by insert, constructing it from value_type(k, move(obj)).
//!
//! No iterators or references are invalidated. If the insertion is successful, pointers and references
//! to the element obtained while it is held in the node handle are invalidated, and pointers and
//! references obtained to that element before it was extracted become valid.
//!
//! <b>Returns</b>: The bool component is true if the insertion took place and false if the assignment
//! took place. The iterator component is pointing at the element that was inserted or updated.
//!
//! <b>Complexity</b>: Logarithmic in the size of the container.
template <class M>
BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> insert_or_assign(BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
{ return this->base_t::insert_or_assign(const_iterator(), ::boost::move(k), ::boost::forward<M>(obj)); }
//! <b>Effects</b>: If a key equivalent to k already exists in the container, assigns forward<M>(obj)
//! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value
//! as if by insert, constructing it from value_type(k, forward<M>(obj)) and the new element
//! to the container as close as possible to the position just before hint.
//!
//! No iterators or references are invalidated. If the insertion is successful, pointers and references
//! to the element obtained while it is held in the node handle are invalidated, and pointers and
//! references obtained to that element before it was extracted become valid.
//!
//! <b>Returns</b>: The bool component is true if the insertion took place and false if the assignment
//! took place. The iterator component is pointing at the element that was inserted or updated.
//!
//! <b>Complexity</b>: Logarithmic in the size of the container in general, but amortized constant if
//! the new element is inserted just before hint.
template <class M>
BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, const key_type& k, BOOST_FWD_REF(M) obj)
{ return this->base_t::insert_or_assign(hint, k, ::boost::forward<M>(obj)); }
//! <b>Effects</b>: If a key equivalent to k already exists in the container, assigns forward<M>(obj)
//! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value
//! as if by insert, constructing it from value_type(k, move(obj)) and the new element
//! to the container as close as possible to the position just before hint.
//!
//! No iterators or references are invalidated. If the insertion is successful, pointers and references
//! to the element obtained while it is held in the node handle are invalidated, and pointers and
//! references obtained to that element before it was extracted become valid.
//!
//! <b>Returns</b>: The bool component is true if the insertion took place and false if the assignment
//! took place. The iterator component is pointing at the element that was inserted or updated.
//!
//! <b>Complexity</b>: Logarithmic in the size of the container in general, but amortized constant if
//! the new element is inserted just before hint.
template <class M>
BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
{ return this->base_t::insert_or_assign(hint, ::boost::move(k), ::boost::forward<M>(obj)); }
include/boost/container/slist.hpp view on Meta::CPAN
};
} //namespace dtl {
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! An slist is a singly linked list: a list where each element is linked to the next
//! element, but not to the previous element. That is, it is a Sequence that
//! supports forward but not backward traversal, and (amortized) constant time
//! insertion and removal of elements. Slists, like lists, have the important
//! property that insertion and splicing do not invalidate iterators to list elements,
//! and that even removal invalidates only the iterators that point to the elements
//! that are removed. The ordering of iterators may be changed (that is,
//! slist<T>::iterator might have a different predecessor or successor after a list
//! operation than it did before), but the iterators themselves will not be invalidated
//! or made to point to different elements unless that invalidation or mutation is explicit.
//!
//! The main difference between slist and list is that list's iterators are bidirectional
//! iterators, while slist's iterators are forward iterators. This means that slist is
//! less versatile than list; frequently, however, bidirectional iterators are
//! unnecessary. You should usually use slist unless you actually need the extra
//! functionality of list, because singly linked lists are smaller and faster than double
//! linked lists.
//!
//! Important performance note: like every other Sequence, slist defines the member
include/boost/container/slist.hpp view on Meta::CPAN
//! <b>Effects</b>: Erases the element after the element pointed by prev_p
//! of the list.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Does not invalidate iterators or references to non erased elements.
iterator erase_after(const_iterator prev_p)
{
return iterator(this->icont().erase_after_and_dispose(prev_p.get(), Destroyer(this->node_alloc())));
}
//! <b>Effects</b>: Erases the range (before_first, last) from
//! the list.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of erased elements.
//!
//! <b>Note</b>: Does not invalidate iterators or references to non erased elements.
iterator erase_after(const_iterator before_first, const_iterator last)
{
return iterator(this->icont().erase_after_and_dispose(before_first.get(), last.get(), Destroyer(this->node_alloc())));
}
//! <b>Effects</b>: Swaps the contents of *this and x.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements on *this and x.
include/boost/container/slist.hpp view on Meta::CPAN
//!
//! <b>Effects</b>: Transfers all the elements of list x to this list, after the
//! the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
//! are not equal.
//!
//! <b>Complexity</b>: Linear to the elements in x.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of
//! this list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_p, slist& x) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this != &x);
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
this->icont().splice_after(prev_p.get(), x.icont());
}
//! <b>Requires</b>: p must point to an element contained
//! by the list. x != *this
//!
//! <b>Effects</b>: Transfers all the elements of list x to this list, after the
//! the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
//! are not equal.
//!
//! <b>Complexity</b>: Linear to the elements in x.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of
//! this list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice_after(prev_p, static_cast<slist&>(x)); }
//! <b>Requires</b>: prev_p must be a valid iterator of this.
//! i must point to an element contained in list x.
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
//! after the element pointed by prev_p.
//! If prev_p == prev or prev_p == ++prev, this function is a null operation.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_p, slist& x, const_iterator prev) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
this->icont().splice_after(prev_p.get(), x.icont(), prev.get());
}
//! <b>Requires</b>: prev_p must be a valid iterator of this.
//! i must point to an element contained in list x.
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
//! after the element pointed by prev_p.
//! If prev_p == prev or prev_p == ++prev, this function is a null operation.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x, const_iterator prev) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice_after(prev_p, static_cast<slist&>(x), prev); }
//! <b>Requires</b>: prev_p must be a valid iterator of this.
//! before_first and before_last must be valid iterators of x.
//! prev_p must not be contained in [before_first, before_last) range.
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
//! from list x to this list, after the element pointed by prev_p.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear to the number of transferred elements.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_p, slist& x,
const_iterator before_first, const_iterator before_last) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
this->icont().splice_after
(prev_p.get(), x.icont(), before_first.get(), before_last.get());
}
//! <b>Requires</b>: prev_p must be a valid iterator of this.
//! before_first and before_last must be valid iterators of x.
include/boost/container/slist.hpp view on Meta::CPAN
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
//! from list x to this list, after the element pointed by prev_p.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear to the number of transferred elements.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x,
const_iterator before_first, const_iterator before_last) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice_after(prev_p, static_cast<slist&>(x), before_first, before_last); }
//! <b>Requires</b>: prev_p must be a valid iterator of this.
//! before_first and before_last must be valid iterators of x.
//! prev_p must not be contained in [before_first, before_last) range.
//! n == distance(before_first, before_last).
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
//! from list x to this list, after the element pointed by prev_p.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_p, slist& x,
const_iterator before_first, const_iterator before_last,
size_type n) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
this->icont().splice_after
(prev_p.get(), x.icont(), before_first.get(), before_last.get(), n);
}
//! <b>Requires</b>: prev_p must be a valid iterator of this.
include/boost/container/slist.hpp view on Meta::CPAN
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
//! from list x to this list, after the element pointed by prev_p.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x,
const_iterator before_first, const_iterator before_last,
size_type n) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice_after(prev_p, static_cast<slist&>(x), before_first, before_last, n); }
//! <b>Effects</b>: Removes all the elements that compare equal to value.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
include/boost/container/slist.hpp view on Meta::CPAN
//!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
//! in order into *this. The merge is stable; that is, if an element from *this is
//! equivalent to one from x, then the element from *this will precede the one from x.
//!
//! <b>Throws</b>: If comp throws.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references to *this are not invalidated.
template <class StrictWeakOrdering>
void merge(slist& x, StrictWeakOrdering comp)
{
typedef value_to_node_compare<Node, StrictWeakOrdering> value_to_node_compare_type;
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
this->icont().merge(x.icont(), value_to_node_compare_type(comp));
}
//! <b>Requires</b>: p must be a comparison function that induces a strict weak
//! ordering and both *this and x must be sorted according to that ordering
include/boost/container/slist.hpp view on Meta::CPAN
//!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
//! in order into *this. The merge is stable; that is, if an element from *this is
//! equivalent to one from x, then the element from *this will precede the one from x.
//!
//! <b>Throws</b>: If comp throws.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references to *this are not invalidated.
template <class StrictWeakOrdering>
void merge(BOOST_RV_REF(slist) x, StrictWeakOrdering comp)
{ this->merge(static_cast<slist&>(x), comp); }
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
//!
//! <b>Throws</b>: If comparison throws.
//!
//! <b>Notes</b>: Iterators and references are not invalidated.
//!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
void sort()
{ this->sort(value_less_t()); }
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
//!
//! <b>Throws</b>: If comp throws.
//!
//! <b>Notes</b>: Iterators and references are not invalidated.
//!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
template <class StrictWeakOrdering>
void sort(StrictWeakOrdering comp)
{
typedef value_to_node_compare<Node, StrictWeakOrdering> value_to_node_compare_type;
// nothing if the slist has length 0 or 1.
if (this->size() < 2)
return;
this->icont().sort(value_to_node_compare_type(comp));
}
//! <b>Effects</b>: Reverses the order of elements in the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: This function is linear time.
//!
//! <b>Note</b>: Iterators and references are not invalidated
void reverse() BOOST_NOEXCEPT_OR_NOTHROW
{ this->icont().reverse(); }
//////////////////////////////////////////////
//
// list compatibility interface
//
//////////////////////////////////////////////
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
include/boost/container/slist.hpp view on Meta::CPAN
//! by the list. x != *this. this' allocator and x's allocator shall compare equal
//!
//! <b>Effects</b>: Transfers all the elements of list x to this list, before the
//! the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear in distance(begin(), p), and linear in x.size().
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of
//! this list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, slist& x) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice_after(this->previous(p), x); }
//! <b>Requires</b>: p must point to an element contained
//! by the list. x != *this. this' allocator and x's allocator shall compare equal
//!
//! <b>Effects</b>: Transfers all the elements of list x to this list, before the
//! the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear in distance(begin(), p), and linear in x.size().
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of
//! this list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, BOOST_RV_REF(slist) x) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice(p, static_cast<slist&>(x)); }
//! <b>Requires</b>: p must point to an element contained
//! by this list. i must point to an element contained in list x.
//! this' allocator and x's allocator shall compare equal
//!
//! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//! If p == i or p == ++i, this function is a null operation.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear in distance(begin(), p), and in distance(x.begin(), i).
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, slist& x, const_iterator i) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice_after(this->previous(p), x, x.previous(i)); }
//! <b>Requires</b>: p must point to an element contained
//! by this list. i must point to an element contained in list x.
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//! If p == i or p == ++i, this function is a null operation.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear in distance(begin(), p), and in distance(x.begin(), i).
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, BOOST_RV_REF(slist) x, const_iterator i) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice(p, static_cast<slist&>(x), i); }
//! <b>Requires</b>: p must point to an element contained
//! by this list. first and last must point to elements contained in list x.
//!
//! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear in distance(begin(), p), in distance(x.begin(), first),
//! and in distance(first, last).
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, slist& x, const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice_after(this->previous(p), x, x.previous(first), x.previous(last)); }
//! <b>Requires</b>: p must point to an element contained
//! by this list. first and last must point to elements contained in list x.
//! this' allocator and x's allocator shall compare equal
//!
//! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear in distance(begin(), p), in distance(x.begin(), first),
//! and in distance(first, last).
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, BOOST_RV_REF(slist) x, const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice(p, static_cast<slist&>(x), first, last); }
//! <b>Effects</b>: Returns true if x and y are equal
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
friend bool operator==(const slist& x, const slist& y)
{ return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); }
//! <b>Effects</b>: Returns true if x and y are unequal
include/boost/container/string.hpp view on Meta::CPAN
//! member functions use two values, pos and n, to represent a range. In that case pos is
//! the beginning of the range and n is its size. That is, the range is
//! [begin() + pos, begin() + pos + n).
//!
//! Note that the C++ standard does not specify the complexity of basic_string operations.
//! In this implementation, basic_string has performance characteristics very similar to
//! those of vector: access to a single character is O(1), while copy and concatenation
//! are O(N).
//!
//! In this implementation, begin(),
//! end(), rbegin(), rend(), operator[], c_str(), and data() do not invalidate iterators.
//! In this implementation, iterators are only invalidated by member functions that
//! explicitly change the string's contents.
//!
//! \tparam CharT The type of character it contains.
//! \tparam Traits The Character Traits type, which encapsulates basic character operations
//! \tparam Allocator The allocator, used for internal memory management.
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class CharT, class Traits = std::char_traits<CharT>, class Allocator = new_allocator<CharT> >
#else
template <class CharT, class Traits, class Allocator>
#endif
include/boost/container/vector.hpp view on Meta::CPAN
//! <b>Effects</b>: x.swap(y)
//!
//! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE friend void swap(vector& x, vector& y)
{ x.swap(y); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
//! effect. Otherwise, it is a request for allocation of additional memory
//! (memory expansion) that will not invalidate iterators.
//! If the request is successful, then capacity() is greater than or equal to
//! n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
//!
//! <b>Throws</b>: If memory allocation allocation throws or T's copy/move constructor throws.
//!
//! <b>Note</b>: Non-standard extension.
bool stable_reserve(size_type new_cap)
{
const size_type cp = this->capacity();
return cp >= new_cap || (alloc_version::value == 2 && this->m_holder.try_expand_fwd(new_cap - cp));
include/boost/intrusive/avl_set_hook.hpp view on Meta::CPAN
//! <b>Throws</b>: Nothing.
~avl_set_base_hook();
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
//! related to those nodes in one or two containers. That is, if the node
//! this is part of the element e1, the node x is part of the element e2
//! and both elements are included in the containers s1 and s2, then after
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
//! at the position of e1. If one element is not in a container, then
//! after the swap-operation the other element is not in a container.
//! Iterators to e1 and e2 related to those nodes are invalidated.
//!
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
void swap_nodes(avl_set_base_hook &other);
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
//!
//! <b>Returns</b>: true, if the node belongs to a container, false
//! otherwise. This function can be used to test whether \c set::iterator_to
include/boost/intrusive/avl_set_hook.hpp view on Meta::CPAN
//! <b>Throws</b>: Nothing.
~avl_set_member_hook();
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
//! related to those nodes in one or two containers. That is, if the node
//! this is part of the element e1, the node x is part of the element e2
//! and both elements are included in the containers s1 and s2, then after
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
//! at the position of e1. If one element is not in a container, then
//! after the swap-operation the other element is not in a container.
//! Iterators to e1 and e2 related to those nodes are invalidated.
//!
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
void swap_nodes(avl_set_member_hook &other);
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
//!
//! <b>Returns</b>: true, if the node belongs to a container, false
//! otherwise. This function can be used to test whether \c set::iterator_to
include/boost/intrusive/bs_set_hook.hpp view on Meta::CPAN
//! <b>Throws</b>: Nothing.
~bs_set_base_hook();
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
//! related to those nodes in one or two containers. That is, if the node
//! this is part of the element e1, the node x is part of the element e2
//! and both elements are included in the containers s1 and s2, then after
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
//! at the position of e1. If one element is not in a container, then
//! after the swap-operation the other element is not in a container.
//! Iterators to e1 and e2 related to those nodes are invalidated.
//!
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
void swap_nodes(bs_set_base_hook &other);
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
//!
//! <b>Returns</b>: true, if the node belongs to a container, false
//! otherwise. This function can be used to test whether \c set::iterator_to
include/boost/intrusive/bs_set_hook.hpp view on Meta::CPAN
//! <b>Throws</b>: Nothing.
~bs_set_member_hook();
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
//! related to those nodes in one or two containers. That is, if the node
//! this is part of the element e1, the node x is part of the element e2
//! and both elements are included in the containers s1 and s2, then after
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
//! at the position of e1. If one element is not in a container, then
//! after the swap-operation the other element is not in a container.
//! Iterators to e1 and e2 related to those nodes are invalidated.
//!
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
void swap_nodes(bs_set_member_hook &other);
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
//!
//! <b>Returns</b>: true, if the node belongs to a container, false
//! otherwise. This function can be used to test whether \c set::iterator_to
include/boost/intrusive/bstree.hpp view on Meta::CPAN
this->sz_traits().increment();
node_algorithms::push_front(this->header_ptr(), to_insert);
}
//! <b>Effects</b>: Erases the element pointed to by i.
//!
//! <b>Complexity</b>: Average complexity for erase element is constant time.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator i)
{
const_iterator ret(i);
++ret;
node_ptr to_erase(i.pointed_node());
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!node_algorithms::unique(to_erase));
node_algorithms::erase(this->header_ptr(), to_erase);
this->sz_traits().decrement();
include/boost/intrusive/bstree.hpp view on Meta::CPAN
return ret.unconst();
}
//! <b>Effects</b>: Erases the range pointed to by b end e.
//!
//! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
iterator erase(const_iterator b, const_iterator e)
{ size_type n; return this->private_erase(b, e, n); }
//! <b>Effects</b>: Erases all the elements with the given value.
//!
//! <b>Returns</b>: The number of erased elements.
//!
//! <b>Complexity</b>: O(log(size() + N).
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
size_type erase(const key_type &key)
{ return this->erase(key, this->key_comp()); }
//! <b>Requires</b>: key is a value such that `*this` is partitioned with respect to
//! comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk),
//! with nk the key_type of a value_type inserted into `*this`.
//!
//! <b>Effects</b>: Erases all the elements with the given key.
//! according to the comparison functor "comp".
//!
//! <b>Returns</b>: The number of erased elements.
//!
//! <b>Complexity</b>: O(log(size() + N).
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class KeyType, class KeyTypeKeyCompare>
BOOST_INTRUSIVE_DOC1ST(size_type
, typename detail::disable_if_convertible<KeyTypeKeyCompare BOOST_INTRUSIVE_I const_iterator BOOST_INTRUSIVE_I size_type>::type)
erase(const KeyType& key, KeyTypeKeyCompare comp)
{
std::pair<iterator,iterator> p = this->equal_range(key, comp);
size_type n;
this->private_erase(p.first, p.second, n);
return n;
include/boost/intrusive/bstree.hpp view on Meta::CPAN
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Erases the element pointed to by i.
//! Disposer::operator()(pointer) is called for the removed element.
//!
//! <b>Complexity</b>: Average complexity for erase element is constant time.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
{
node_ptr to_erase(i.pointed_node());
iterator ret(this->erase(i));
disposer(this->get_value_traits().to_value_ptr(to_erase));
return ret;
}
include/boost/intrusive/bstree.hpp view on Meta::CPAN
//!
//! <b>Effects</b>: Erases all the elements with the given value.
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
//!
//! <b>Complexity</b>: O(log(size() + N).
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
template<class Disposer>
size_type erase_and_dispose(const key_type &key, Disposer disposer)
{
std::pair<iterator,iterator> p = this->equal_range(key);
size_type n;
this->private_erase(p.first, p.second, n, disposer);
return n;
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Erases the range pointed to by b end e.
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Complexity</b>: Average complexity for erase range is at most
//! O(log(size() + N)), where N is the number of elements in the range.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer)
{ size_type n; return this->private_erase(b, e, n, disposer); }
//! <b>Requires</b>: key is a value such that `*this` is partitioned with respect to
//! comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk)
//! and nk the key_type of a value_type inserted into `*this`.
//!
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
include/boost/intrusive/bstree.hpp view on Meta::CPAN
//! <b>Effects</b>: Erases all the elements with the given key.
//! according to the comparison functor "comp".
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: The number of erased elements.
//!
//! <b>Complexity</b>: O(log(size() + N).
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Note</b>: Invalidates the iterators
//! to the erased elements.
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
BOOST_INTRUSIVE_DOC1ST(size_type
, typename detail::disable_if_convertible<KeyTypeKeyCompare BOOST_INTRUSIVE_I const_iterator BOOST_INTRUSIVE_I size_type>::type)
erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer)
{
std::pair<iterator,iterator> p = this->equal_range(key, comp);
size_type n;
this->private_erase(p.first, p.second, n, disposer);
return n;
}
//! <b>Effects</b>: Erases all of the elements.
//!
//! <b>Complexity</b>: Linear to the number of elements on the container.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. No destructors are called.
void clear()
{
if(safemode_or_autounlink){
this->clear_and_dispose(detail::null_disposer());
}
else{
node_algorithms::init_header(this->header_ptr());
this->sz_traits().set_size(0);
}
}
//! <b>Effects</b>: Erases all of the elements calling disposer(p) for
//! each node to be erased.
//! <b>Complexity</b>: Average complexity for is at most O(log(size() + N)),
//! where N is the number of elements in the container.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements. Calls N times to disposer functor.
template<class Disposer>
void clear_and_dispose(Disposer disposer)
{
node_algorithms::clear_and_dispose(this->header_ptr()
, detail::node_disposer<Disposer, value_traits, AlgoType>(disposer, &this->get_value_traits()));
node_algorithms::init_header(this->header_ptr());
this->sz_traits().set_size(0);
}
include/boost/intrusive/list.hpp view on Meta::CPAN
this->priv_size_traits().increment();
}
//! <b>Effects</b>: Erases the last element of the list.
//! No destructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased element.
void pop_back()
{ return this->pop_back_and_dispose(detail::null_disposer()); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Erases the last element of the list.
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed element.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
void pop_back_and_dispose(Disposer disposer)
{
node_ptr to_erase = node_traits::get_previous(this->get_root_node());
node_algorithms::unlink(to_erase);
this->priv_size_traits().decrement();
if(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(priv_value_traits().to_value_ptr(to_erase));
}
//! <b>Effects</b>: Erases the first element of the list.
//! No destructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased element.
void pop_front()
{ return this->pop_front_and_dispose(detail::null_disposer()); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Erases the first element of the list.
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed element.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
void pop_front_and_dispose(Disposer disposer)
{
node_ptr to_erase = node_traits::get_next(this->get_root_node());
node_algorithms::unlink(to_erase);
this->priv_size_traits().decrement();
if(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(priv_value_traits().to_value_ptr(to_erase));
}
include/boost/intrusive/list.hpp view on Meta::CPAN
//! <b>Effects</b>: Erases the element pointed by i of the list.
//! No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed element,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
iterator erase(const_iterator i)
{ return this->erase_and_dispose(i, detail::null_disposer()); }
//! <b>Requires</b>: b and e must be valid iterators to elements in *this.
//!
//! <b>Effects</b>: Erases the element range pointed by b and e
//! No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of erased elements if it's a safe-mode
//! or auto-unlink value, or constant-time size is enabled. Constant-time otherwise.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
iterator erase(const_iterator b, const_iterator e)
{
if(safemode_or_autounlink || constant_time_size){
return this->erase_and_dispose(b, e, detail::null_disposer());
}
else{
node_algorithms::unlink(b.pointed_node(), e.pointed_node());
return e.unconst();
}
include/boost/intrusive/list.hpp view on Meta::CPAN
//! No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of erased elements if it's a safe-mode
//! or auto-unlink value is enabled. Constant-time otherwise.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
iterator erase(const_iterator b, const_iterator e, size_type n)
{
BOOST_INTRUSIVE_INVARIANT_ASSERT(node_algorithms::distance(b.pointed_node(), e.pointed_node()) == n);
if(safemode_or_autounlink || constant_time_size){
return this->erase_and_dispose(b, e, detail::null_disposer());
}
else{
if(constant_time_size){
this->priv_size_traits().decrease(n);
include/boost/intrusive/list.hpp view on Meta::CPAN
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed element.
//!
//! <b>Returns</b>: the first element remaining beyond the removed element,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template <class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
{
node_ptr to_erase(i.pointed_node());
++i;
node_algorithms::unlink(to_erase);
this->priv_size_traits().decrement();
if(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(this->priv_value_traits().to_value_ptr(to_erase));
include/boost/intrusive/list.hpp view on Meta::CPAN
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements erased.
//!
//! <b>Note</b>: Invalidates the iterators to the erased elements.
template <class Disposer>
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer)
{
node_ptr bp(b.pointed_node()), ep(e.pointed_node());
node_algorithms::unlink(bp, ep);
while(bp != ep){
node_ptr to_erase(bp);
bp = node_traits::get_next(bp);
if(safemode_or_autounlink)
node_algorithms::init(to_erase);
include/boost/intrusive/list.hpp view on Meta::CPAN
}
//! <b>Effects</b>: Erases all the elements of the container.
//! No destructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements of the list.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased elements.
void clear()
{
if(safemode_or_autounlink){
this->clear_and_dispose(detail::null_disposer());
}
else{
node_algorithms::init_header(this->get_root_node());
this->priv_size_traits().set_size(size_type(0));
}
}
include/boost/intrusive/list.hpp view on Meta::CPAN
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Erases all the elements of the container.
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements of the list.
//!
//! <b>Note</b>: Invalidates the iterators to the erased elements.
template <class Disposer>
void clear_and_dispose(Disposer disposer)
{
const_iterator it(this->begin()), itend(this->end());
while(it != itend){
node_ptr to_erase(it.pointed_node());
++it;
if(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(priv_value_traits().to_value_ptr(to_erase));
include/boost/intrusive/list.hpp view on Meta::CPAN
//! <b>Effects</b>: Clears the list and inserts the range pointed by b and e.
//! No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements inserted plus
//! linear to the elements contained in the list if it's a safe-mode
//! or auto-unlink value.
//! Linear to the number of elements inserted in the list otherwise.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements.
template<class Iterator>
void assign(Iterator b, Iterator e)
{
this->clear();
this->insert(this->cend(), b, e);
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
include/boost/intrusive/list.hpp view on Meta::CPAN
//!
//! <b>Effects</b>: Clears the list and inserts the range pointed by b and e.
//! No destructors or copy constructors are called.
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements inserted plus
//! linear to the elements contained in the list.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements.
template<class Iterator, class Disposer>
void dispose_and_assign(Disposer disposer, Iterator b, Iterator e)
{
this->clear_and_dispose(disposer);
this->insert(this->cend(), b, e);
}
//! <b>Requires</b>: p must be a valid iterator of *this.
//!
//! <b>Effects</b>: Transfers all the elements of list x to this list, before the
//! the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of
//! this list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list_impl& x)
{
if(!x.empty()){
node_algorithms::transfer
(p.pointed_node(), x.begin().pointed_node(), x.end().pointed_node());
size_traits &thist = this->priv_size_traits();
size_traits &xt = x.priv_size_traits();
thist.increase(xt.get_size());
xt.set_size(size_type(0));
}
include/boost/intrusive/list.hpp view on Meta::CPAN
//!
//! <b>Effects</b>: Transfers the value pointed by new_ele, from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//! If p == new_ele or p == ++new_ele, this function is a null operation.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list_impl&x, const_iterator new_ele)
{
node_algorithms::transfer(p.pointed_node(), new_ele.pointed_node());
x.priv_size_traits().decrement();
this->priv_size_traits().increment();
}
//! <b>Requires</b>: p must be a valid iterator of *this.
//! f and e must point to elements contained in list x.
//!
//! <b>Effects</b>: Transfers the range pointed by f and e from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements transferred
//! if constant-time size option is enabled. Constant-time otherwise.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list_impl&x, const_iterator f, const_iterator e)
{
if(constant_time_size)
this->splice(p, x, f, e, node_algorithms::distance(f.pointed_node(), e.pointed_node()));
else
this->splice(p, x, f, e, 1);//intrusive::iterator_distance is a dummy value
}
//! <b>Requires</b>: p must be a valid iterator of *this.
//! f and e must point to elements contained in list x.
//! n == distance(f, e)
//!
//! <b>Effects</b>: Transfers the range pointed by f and e from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, list_impl&x, const_iterator f, const_iterator e, size_type n)
{
if(n){
if(constant_time_size){
BOOST_INTRUSIVE_INVARIANT_ASSERT(n == node_algorithms::distance(f.pointed_node(), e.pointed_node()));
node_algorithms::transfer(p.pointed_node(), f.pointed_node(), e.pointed_node());
size_traits &thist = this->priv_size_traits();
size_traits &xt = x.priv_size_traits();
thist.increase(n);
xt.decrease(n);
include/boost/intrusive/list.hpp view on Meta::CPAN
}
}
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or std::less<value_type> throws. Basic guarantee.
//!
//! <b>Notes</b>: Iterators and references are not invalidated.
//!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
void sort()
{ this->sort(std::less<value_type>()); }
//! <b>Requires</b>: p must be a comparison function that induces a strict weak ordering
//!
//! <b>Effects</b>: This function sorts the list *this according to p. The sort is
//! stable, that is, the relative order of equivalent elements is preserved.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or the predicate throws. Basic guarantee.
//!
//! <b>Notes</b>: This won't throw if list_base_hook<> or
//! list_member_hook are used.
//! Iterators and references are not invalidated.
//!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
template<class Predicate>
void sort(Predicate p)
{
if(node_traits::get_next(this->get_root_node())
!= node_traits::get_previous(this->get_root_node())){
list_impl carry(this->priv_value_traits());
detail::array_initializer<list_impl, 64> counter(this->priv_value_traits());
include/boost/intrusive/list.hpp view on Meta::CPAN
//! <b>Effects</b>: This function removes all of x's elements and inserts them
//! in order into *this according to std::less<value_type>. The merge is stable;
//! that is, if an element from *this is equivalent to one from x, then the element
//! from *this will precede the one from x.
//!
//! <b>Throws</b>: If std::less<value_type> throws. Basic guarantee.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references are not invalidated
void merge(list_impl& x)
{ this->merge(x, std::less<value_type>()); }
//! <b>Requires</b>: p must be a comparison function that induces a strict weak
//! ordering and both *this and x must be sorted according to that ordering
//! The lists x and *this must be distinct.
//!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
//! in order into *this. The merge is stable; that is, if an element from *this is
//! equivalent to one from x, then the element from *this will precede the one from x.
//!
//! <b>Throws</b>: If the predicate throws. Basic guarantee.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
template<class Predicate>
void merge(list_impl& x, Predicate p)
{
const_iterator e(this->cend()), ex(x.cend());
const_iterator b(this->cbegin());
while(!x.empty()){
const_iterator ix(x.cbegin());
while (b != e && !p(*ix, *b)){
++b;
}
include/boost/intrusive/list.hpp view on Meta::CPAN
}
}
}
//! <b>Effects</b>: Reverses the order of elements in the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: This function is linear time.
//!
//! <b>Note</b>: Iterators and references are not invalidated
void reverse()
{ node_algorithms::reverse(this->get_root_node()); }
//! <b>Effects</b>: Removes all the elements that compare equal to value.
//! No destructors are called.
//!
//! <b>Throws</b>: If std::equal_to<value_type> throws. Basic guarantee.
//!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
//!
include/boost/intrusive/list.hpp view on Meta::CPAN
}
//! <b>Requires</b>: value must be a reference to a value inserted in a list.
//!
//! <b>Effects</b>: This function returns a const_iterator pointing to the element
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
//! This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(value_traits::to_node_ptr(value)));
return iterator(value_traits::to_node_ptr(value), const_value_traits_ptr());
}
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
//!
//! <b>Effects</b>: This function returns an iterator pointing to the element.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
//! This static function is available only if the <i>value traits</i>
//! is stateless.
static const_iterator s_iterator_to(const_reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
reference r =*detail::uncast(pointer_traits<const_pointer>::pointer_to(value));
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(value_traits::to_node_ptr(r)));
return const_iterator(value_traits::to_node_ptr(r), const_value_traits_ptr());
}
//! <b>Requires</b>: value must be a reference to a value inserted in a list.
//!
//! <b>Effects</b>: This function returns a const_iterator pointing to the element
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
iterator iterator_to(reference value)
{
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(this->priv_value_traits().to_node_ptr(value)));
return iterator(this->priv_value_traits().to_node_ptr(value), this->priv_value_traits_ptr());
}
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
//!
//! <b>Effects</b>: This function returns an iterator pointing to the element.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
const_iterator iterator_to(const_reference value) const
{
reference r = *detail::uncast(pointer_traits<const_pointer>::pointer_to(value));
BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_algorithms::inited(this->priv_value_traits().to_node_ptr(r)));
return const_iterator(this->priv_value_traits().to_node_ptr(r), this->priv_value_traits_ptr());
}
//! <b>Effects</b>: Asserts the integrity of the container.
//!
//! <b>Complexity</b>: Linear time.
include/boost/intrusive/list_hook.hpp view on Meta::CPAN
//! <b>Throws</b>: Nothing.
~list_base_hook();
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
//! related to those nodes in one or two containers. That is, if the node
//! this is part of the element e1, the node x is part of the element e2
//! and both elements are included in the containers s1 and s2, then after
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
//! at the position of e1. If one element is not in a container, then
//! after the swap-operation the other element is not in a container.
//! Iterators to e1 and e2 related to those nodes are invalidated.
//!
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
void swap_nodes(list_base_hook &other);
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
//!
//! <b>Returns</b>: true, if the node belongs to a container, false
//! otherwise. This function can be used to test whether \c list::iterator_to
include/boost/intrusive/list_hook.hpp view on Meta::CPAN
//! <b>Throws</b>: Nothing.
~list_member_hook();
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
//! related to those nodes in one or two containers. That is, if the node
//! this is part of the element e1, the node x is part of the element e2
//! and both elements are included in the containers s1 and s2, then after
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
//! at the position of e1. If one element is not in a container, then
//! after the swap-operation the other element is not in a container.
//! Iterators to e1 and e2 related to those nodes are invalidated.
//!
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
void swap_nodes(list_member_hook &other);
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
//!
//! <b>Returns</b>: true, if the node belongs to a container, false
//! otherwise. This function can be used to test whether \c list::iterator_to
include/boost/intrusive/rbtree_algorithms.hpp view on Meta::CPAN
//! (MIT Press, 1990), except that
//!
//! (1) the header node is maintained with links not only to the root
//! but also to the leftmost node of the tree, to enable constant time
//! begin(), and to the rightmost node of the tree, to enable linear time
//! performance when used with the generic set algorithms (set_union,
//! etc.);
//!
//! (2) when a node being deleted has two children its successor node is
//! relinked into its place, rather than copied, so that the only
//! pointers invalidated are those referring to the deleted node.
//!
//! rbtree_algorithms is configured with a NodeTraits class, which encapsulates the
//! information about the node to be manipulated. NodeTraits must support the
//! following interface:
//!
//! <b>Typedefs</b>:
//!
//! <tt>node</tt>: The type of the node that forms the binary search tree
//!
//! <tt>node_ptr</tt>: A pointer to a node
include/boost/intrusive/set_hook.hpp view on Meta::CPAN
//! <b>Throws</b>: Nothing.
~set_base_hook();
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
//! related to those nodes in one or two containers. That is, if the node
//! this is part of the element e1, the node x is part of the element e2
//! and both elements are included in the containers s1 and s2, then after
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
//! at the position of e1. If one element is not in a container, then
//! after the swap-operation the other element is not in a container.
//! Iterators to e1 and e2 related to those nodes are invalidated.
//!
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
void swap_nodes(set_base_hook &other);
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
//!
//! <b>Returns</b>: true, if the node belongs to a container, false
//! otherwise. This function can be used to test whether \c set::iterator_to
include/boost/intrusive/set_hook.hpp view on Meta::CPAN
//! <b>Throws</b>: Nothing.
~set_member_hook();
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
//! related to those nodes in one or two containers. That is, if the node
//! this is part of the element e1, the node x is part of the element e2
//! and both elements are included in the containers s1 and s2, then after
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
//! at the position of e1. If one element is not in a container, then
//! after the swap-operation the other element is not in a container.
//! Iterators to e1 and e2 related to those nodes are invalidated.
//!
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
void swap_nodes(set_member_hook &other);
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
//!
//! <b>Returns</b>: true, if the node belongs to a container, false
//! otherwise. This function can be used to test whether \c set::iterator_to
include/boost/intrusive/slist.hpp view on Meta::CPAN
//! <b>Effects</b>: Transfers the range [f, before_l] to this
//! list, after the element pointed by prev_pos.
//! No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements transferred
//! if constant_time_size is true. Constant-time otherwise.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
//!
//! <b>Warning</b>: Experimental function, don't use it!
slist_impl( const node_ptr & f, const node_ptr & before_l
, size_type n, const value_traits &v_traits = value_traits())
: data_(v_traits)
{
if(n){
this->priv_size_traits().set_size(n);
if(cache_last){
this->set_last_node(before_l);
include/boost/intrusive/slist.hpp view on Meta::CPAN
}
}
//! <b>Effects</b>: Erases all the elements of the container.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements of the list.
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased elements.
void clear()
{
if(safemode_or_autounlink){
this->clear_and_dispose(detail::null_disposer());
}
else{
this->set_default_constructed_state();
}
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Erases all the elements of the container
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements of the list.
//!
//! <b>Note</b>: Invalidates the iterators to the erased elements.
template <class Disposer>
void clear_and_dispose(Disposer disposer)
{
const_iterator it(this->begin()), itend(this->end());
while(it != itend){
node_ptr to_erase(it.pointed_node());
++it;
if(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(priv_value_traits().to_value_ptr(to_erase));
include/boost/intrusive/slist.hpp view on Meta::CPAN
this->priv_size_traits().increment();
}
//! <b>Effects</b>: Erases the first element of the list.
//! No destructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased element.
void pop_front()
{ return this->pop_front_and_dispose(detail::null_disposer()); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Erases the first element of the list.
//! Disposer::operator()(pointer) is called for the removed element.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
void pop_front_and_dispose(Disposer disposer)
{
node_ptr to_erase = node_traits::get_next(this->get_root_node());
node_algorithms::unlink_after(this->get_root_node());
this->priv_size_traits().decrement();
if(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(priv_value_traits().to_value_ptr(to_erase));
if(cache_last){
include/boost/intrusive/slist.hpp view on Meta::CPAN
//! <b>Effects</b>: Erases the element after the element pointed by prev of
//! the list. No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
iterator erase_after(const_iterator prev)
{ return this->erase_after_and_dispose(prev, detail::null_disposer()); }
//! <b>Effects</b>: Erases the range (before_f, l) from
//! the list. No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of erased elements if it's a safe-mode
//! , auto-unlink value or constant-time size is activated. Constant time otherwise.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
iterator erase_after(const_iterator before_f, const_iterator l)
{
if(safemode_or_autounlink || constant_time_size){
return this->erase_after_and_dispose(before_f, l, detail::null_disposer());
}
else{
const node_ptr bfp = before_f.pointed_node();
const node_ptr lp = l.pointed_node();
if(cache_last){
include/boost/intrusive/slist.hpp view on Meta::CPAN
//! No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: constant-time if link_mode is normal_link.
//! Linear to the elements (l - before_f) otherwise.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
iterator erase_after(const_iterator before_f, const_iterator l, size_type n)
{
BOOST_INTRUSIVE_INVARIANT_ASSERT(node_algorithms::distance((++const_iterator(before_f)).pointed_node(), l.pointed_node()) == n);
if(safemode_or_autounlink){
return this->erase_after(before_f, l);
}
else{
const node_ptr bfp = before_f.pointed_node();
const node_ptr lp = l.pointed_node();
include/boost/intrusive/slist.hpp view on Meta::CPAN
//! <b>Effects</b>: Erases the element pointed by i of the list.
//! No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed element,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the elements before i.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
iterator erase(const_iterator i)
{ return this->erase_after(this->previous(i)); }
//! <b>Requires</b>: f and l must be valid iterator to elements in *this.
//!
//! <b>Effects</b>: Erases the range pointed by b and e.
//! No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the elements before l.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
iterator erase(const_iterator f, const_iterator l)
{ return this->erase_after(this->previous(f), l); }
//! <b>Effects</b>: Erases the range [f, l) from
//! the list. n must be distance(f, l).
//! No destructors are called.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: linear to the elements before f if link_mode is normal_link
//! and constant_time_size is activated. Linear to the elements before l otherwise.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
iterator erase(const_iterator f, const_iterator l, size_type n)
{ return this->erase_after(this->previous(f), l, n); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Effects</b>: Erases the element after the element pointed by prev of
//! the list.
//! Disposer::operator()(pointer) is called for the removed element.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
iterator erase_after_and_dispose(const_iterator prev, Disposer disposer)
{
const_iterator it(prev);
++it;
node_ptr to_erase(it.pointed_node());
++it;
node_ptr prev_n(prev.pointed_node());
node_algorithms::unlink_after(prev_n);
if(cache_last && (to_erase == this->get_last_node())){
include/boost/intrusive/slist.hpp view on Meta::CPAN
//! the list.
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the elements (l - before_f + 1).
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
iterator erase_after_and_dispose(const_iterator before_f, const_iterator l, Disposer disposer)
{
node_ptr bfp(before_f.pointed_node()), lp(l.pointed_node());
node_ptr fp(node_traits::get_next(bfp));
node_algorithms::unlink_after(bfp, lp);
while(fp != lp){
node_ptr to_erase(fp);
fp = node_traits::get_next(fp);
if(safemode_or_autounlink)
include/boost/intrusive/slist.hpp view on Meta::CPAN
//! No destructors are called.
//! Disposer::operator()(pointer) is called for the removed element.
//!
//! <b>Returns</b>: the first element remaining beyond the removed element,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the elements before i.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer)
{ return this->erase_after_and_dispose(this->previous(i), disposer); }
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class Disposer>
iterator erase_and_dispose(iterator i, Disposer disposer)
{ return this->erase_and_dispose(const_iterator(i), disposer); }
#endif
include/boost/intrusive/slist.hpp view on Meta::CPAN
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of erased elements plus linear
//! to the elements before f.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
template<class Disposer>
iterator erase_and_dispose(const_iterator f, const_iterator l, Disposer disposer)
{ return this->erase_after_and_dispose(this->previous(f), l, disposer); }
//! <b>Requires</b>: Dereferencing iterator must yield
//! an lvalue of type value_type.
//!
//! <b>Effects</b>: Clears the list and inserts the range pointed by b and e.
//! No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements inserted plus
//! linear to the elements contained in the list if it's a safe-mode
//! or auto-unlink value.
//! Linear to the number of elements inserted in the list otherwise.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements.
template<class Iterator>
void assign(Iterator b, Iterator e)
{
this->clear();
this->insert_after(this->cbefore_begin(), b, e);
}
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
include/boost/intrusive/slist.hpp view on Meta::CPAN
//!
//! <b>Effects</b>: Clears the list and inserts the range pointed by b and e.
//! No destructors or copy constructors are called.
//! Disposer::operator()(pointer) is called for the removed elements.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements inserted plus
//! linear to the elements contained in the list.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references)
//! to the erased elements.
template<class Iterator, class Disposer>
void dispose_and_assign(Disposer disposer, Iterator b, Iterator e)
{
this->clear_and_dispose(disposer);
this->insert_after(this->cbefore_begin(), b, e, disposer);
}
//! <b>Requires</b>: prev must point to an element contained by this list or
//! to the before_begin() element
include/boost/intrusive/slist.hpp view on Meta::CPAN
//!
//! <b>Returns</b>: Nothing.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: In general, linear to the elements contained in x.
//! Constant-time if cache_last<> option is true and also constant-time if
//! linear<> option is true "this" is empty and "l" is not used.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
//!
//! <b>Additional note</b>: If the optional parameter "l" is provided, it will be
//! assigned to the last spliced element or prev if x is empty.
//! This iterator can be used as new "prev" iterator for a new splice_after call.
//! that will splice new values after the previously spliced values.
void splice_after(const_iterator prev, slist_impl &x, const_iterator *l = 0)
{
if(x.empty()){
if(l) *l = prev;
}
include/boost/intrusive/slist.hpp view on Meta::CPAN
//! x or must be x.before_begin().
//!
//! <b>Effects</b>: Transfers the element after prev_ele, from list x to this list,
//! after the element pointed by prev. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator prev_ele)
{
const_iterator elem = prev_ele;
this->splice_after(prev_pos, x, prev_ele, ++elem, 1);
}
//! <b>Requires</b>: prev_pos must be a dereferenceable iterator in *this or be
//! before_begin(), and before_f and before_l belong to x and
//! ++before_f != x.end() && before_l != x.end().
//!
//! <b>Effects</b>: Transfers the range (before_f, before_l] from list x to this
//! list, after the element pointed by prev_pos.
//! No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements transferred
//! if constant_time_size is true. Constant-time otherwise.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_f, const_iterator before_l)
{
if(constant_time_size)
this->splice_after(prev_pos, x, before_f, before_l, node_algorithms::distance(before_f.pointed_node(), before_l.pointed_node()));
else
this->priv_splice_after
(prev_pos.pointed_node(), x, before_f.pointed_node(), before_l.pointed_node());
}
//! <b>Requires</b>: prev_pos must be a dereferenceable iterator in *this or be
include/boost/intrusive/slist.hpp view on Meta::CPAN
//! n == distance(before_f, before_l).
//!
//! <b>Effects</b>: Transfers the range (before_f, before_l] from list x to this
//! list, after the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_f, const_iterator before_l, size_type n)
{
BOOST_INTRUSIVE_INVARIANT_ASSERT(node_algorithms::distance(before_f.pointed_node(), before_l.pointed_node()) == n);
this->priv_splice_after
(prev_pos.pointed_node(), x, before_f.pointed_node(), before_l.pointed_node());
if(constant_time_size){
this->priv_size_traits().increase(n);
x.priv_size_traits().decrease(n);
}
}
include/boost/intrusive/slist.hpp view on Meta::CPAN
//! <b>Returns</b>: Nothing.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the elements contained in x plus linear to
//! the elements before it.
//! Linear to the elements before it if cache_last<> option is true.
//! Constant-time if cache_last<> option is true and it == end().
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
//!
//! <b>Additional note</b>: If the optional parameter "l" is provided, it will be
//! assigned to the last spliced element or prev if x is empty.
//! This iterator can be used as new "prev" iterator for a new splice_after call.
//! that will splice new values after the previously spliced values.
void splice(const_iterator it, slist_impl &x, const_iterator *l = 0)
{ this->splice_after(this->previous(it), x, l); }
//! <b>Requires</b>: it p must be a valid iterator of *this.
//! elem must point to an element contained in list
include/boost/intrusive/slist.hpp view on Meta::CPAN
//!
//! <b>Effects</b>: Transfers the element elem, from list x to this list,
//! before the element pointed by pos. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the elements before pos and before elem.
//! Linear to the elements before elem if cache_last<> option is true and pos == end().
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator pos, slist_impl &x, const_iterator elem)
{ return this->splice_after(this->previous(pos), x, x.previous(elem)); }
//! <b>Requires</b>: pos must be a dereferenceable iterator in *this
//! and f and f belong to x and f and f a valid range on x.
//!
//! <b>Effects</b>: Transfers the range [f, l) from list x to this
//! list, before the element pointed by pos.
//! No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the sum of elements before pos, f, and l
//! plus linear to the number of elements transferred if constant_time_size is true.
//! Linear to the sum of elements before f, and l
//! plus linear to the number of elements transferred if constant_time_size is true
//! if cache_last<> is true and pos == end()
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator pos, slist_impl &x, const_iterator f, const_iterator l)
{ return this->splice_after(this->previous(pos), x, x.previous(f), x.previous(l)); }
//! <b>Requires</b>: pos must be a dereferenceable iterator in *this
//! and f and l belong to x and f and l a valid range on x.
//! n == distance(f, l).
//!
//! <b>Effects</b>: Transfers the range [f, l) from list x to this
//! list, before the element pointed by pos.
//! No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the sum of elements before pos, f, and l.
//! Linear to the sum of elements before f and l
//! if cache_last<> is true and pos == end().
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator pos, slist_impl &x, const_iterator f, const_iterator l, size_type n)
{ return this->splice_after(this->previous(pos), x, x.previous(f), x.previous(l), n); }
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or the predicate throws. Basic guarantee.
//!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
//!
//! <b>Note</b>: Iterators and references are not invalidated
template<class Predicate>
void sort(Predicate p)
{
if (node_traits::get_next(node_traits::get_next(this->get_root_node()))
!= this->get_root_node()) {
slist_impl carry(this->priv_value_traits());
detail::array_initializer<slist_impl, 64> counter(this->priv_value_traits());
int fill = 0;
const_iterator last_inserted;
include/boost/intrusive/slist.hpp view on Meta::CPAN
//! in order into *this. The merge is stable; that is, if an element from *this is
//! equivalent to one from x, then the element from *this will precede the one from x.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
//! or std::less<value_type> throws. Basic guarantee.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
void sort()
{ this->sort(std::less<value_type>()); }
//! <b>Requires</b>: p must be a comparison function that induces a strict weak
//! ordering and both *this and x must be sorted according to that ordering
//! The lists x and *this must be distinct.
//!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
//! in order into *this. The merge is stable; that is, if an element from *this is
//! equivalent to one from x, then the element from *this will precede the one from x.
//!
//! <b>Returns</b>: Nothing.
//!
//! <b>Throws</b>: If the predicate throws. Basic guarantee.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
//!
//! <b>Additional note</b>: If optional "l" argument is passed, it is assigned
//! to an iterator to the last transferred value or end() is x is empty.
template<class Predicate>
void merge(slist_impl& x, Predicate p, const_iterator *l = 0)
{
const_iterator e(this->cend()), ex(x.cend()), bb(this->cbefore_begin()),
bb_next;
if(l) *l = e.unconst();
while(!x.empty()){
include/boost/intrusive/slist.hpp view on Meta::CPAN
//! <b>Effects</b>: This function removes all of x's elements and inserts them
//! in order into *this according to std::less<value_type>. The merge is stable;
//! that is, if an element from *this is equivalent to one from x, then the element
//! from *this will precede the one from x.
//!
//! <b>Throws</b>: if std::less<value_type> throws. Basic guarantee.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references are not invalidated
void merge(slist_impl& x)
{ this->merge(x, std::less<value_type>()); }
//! <b>Effects</b>: Reverses the order of elements in the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: This function is linear to the contained elements.
//!
//! <b>Note</b>: Iterators and references are not invalidated
void reverse()
{
if(cache_last && !this->empty()){
this->set_last_node(node_traits::get_next(this->get_root_node()));
}
this->priv_reverse(detail::bool_<linear>());
}
//! <b>Effects</b>: Removes all the elements that compare equal to value.
//! No destructors are called.
include/boost/intrusive/slist.hpp view on Meta::CPAN
}
//! <b>Requires</b>: value must be a reference to a value inserted in a list.
//!
//! <b>Effects</b>: This function returns a const_iterator pointing to the element
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
//! This static function is available only if the <i>value traits</i>
//! is stateless.
static iterator s_iterator_to(reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
return iterator (value_traits::to_node_ptr(value), const_value_traits_ptr());
}
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
//!
//! <b>Effects</b>: This function returns an iterator pointing to the element.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
//! This static function is available only if the <i>value traits</i>
//! is stateless.
static const_iterator s_iterator_to(const_reference value)
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
reference r =*detail::uncast(pointer_traits<const_pointer>::pointer_to(value));
return const_iterator(value_traits::to_node_ptr(r), const_value_traits_ptr());
}
//! <b>Requires</b>: value must be a reference to a value inserted in a list.
//!
//! <b>Effects</b>: This function returns a const_iterator pointing to the element
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
iterator iterator_to(reference value)
{
BOOST_INTRUSIVE_INVARIANT_ASSERT(linear || !node_algorithms::inited(this->priv_value_traits().to_node_ptr(value)));
return iterator (this->priv_value_traits().to_node_ptr(value), this->priv_value_traits_ptr());
}
//! <b>Requires</b>: value must be a const reference to a value inserted in a list.
//!
//! <b>Effects</b>: This function returns an iterator pointing to the element.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
const_iterator iterator_to(const_reference value) const
{
reference r =*detail::uncast(pointer_traits<const_pointer>::pointer_to(value));
BOOST_INTRUSIVE_INVARIANT_ASSERT (linear || !node_algorithms::inited(this->priv_value_traits().to_node_ptr(r)));
return const_iterator(this->priv_value_traits().to_node_ptr(r), this->priv_value_traits_ptr());
}
//! <b>Returns</b>: The iterator to the element before i in the list.
//! Returns the end-iterator, if either i is the begin-iterator or the
//! list is empty.
include/boost/intrusive/slist.hpp view on Meta::CPAN
//! <b>Effects</b>: Transfers the range [f, before_l] to this
//! list, after the element pointed by prev_pos.
//! No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements transferred
//! if constant_time_size is true. Constant-time otherwise.
//!
//! <b>Note</b>: Iterators of values obtained from the list that owned f and before_l now
//! point to elements of this list. Iterators of this list and all the references are not invalidated.
//!
//! <b>Warning</b>: Experimental function, don't use it!
void incorporate_after(const_iterator prev_pos, const node_ptr & f, const node_ptr & before_l)
{
if(constant_time_size)
this->incorporate_after(prev_pos, f, before_l, node_algorithms::distance(f.pointed_node(), before_l.pointed_node())+1);
else
this->priv_incorporate_after(prev_pos.pointed_node(), f, before_l);
}
include/boost/intrusive/slist.hpp view on Meta::CPAN
//!
//! <b>Effects</b>: Transfers the range [f, before_l] to this
//! list, after the element pointed by prev_pos.
//! No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators of values obtained from the list that owned f and before_l now
//! point to elements of this list. Iterators of this list and all the references are not invalidated.
//!
//! <b>Warning</b>: Experimental function, don't use it!
void incorporate_after(const_iterator prev_pos, const node_ptr & f, const node_ptr & before_l, size_type n)
{
if(n){
BOOST_INTRUSIVE_INVARIANT_ASSERT(n > 0);
BOOST_INTRUSIVE_INVARIANT_ASSERT
(size_type(boost::intrusive::iterator_distance
( iterator(f, this->priv_value_traits_ptr())
, iterator(before_l, this->priv_value_traits_ptr())))
include/boost/intrusive/slist_hook.hpp view on Meta::CPAN
//! <b>Throws</b>: Nothing.
~slist_base_hook();
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
//! related to those nodes in one or two containers. That is, if the node
//! this is part of the element e1, the node x is part of the element e2
//! and both elements are included in the containers s1 and s2, then after
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
//! at the position of e1. If one element is not in a container, then
//! after the swap-operation the other element is not in a container.
//! Iterators to e1 and e2 related to those nodes are invalidated.
//!
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
void swap_nodes(slist_base_hook &other);
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
//!
//! <b>Returns</b>: true, if the node belongs to a container, false
//! otherwise. This function can be used to test whether \c slist::iterator_to
include/boost/intrusive/slist_hook.hpp view on Meta::CPAN
//! <b>Throws</b>: Nothing.
~slist_member_hook();
//! <b>Effects</b>: Swapping two nodes swaps the position of the elements
//! related to those nodes in one or two containers. That is, if the node
//! this is part of the element e1, the node x is part of the element e2
//! and both elements are included in the containers s1 and s2, then after
//! the swap-operation e1 is in s2 at the position of e2 and e2 is in s1
//! at the position of e1. If one element is not in a container, then
//! after the swap-operation the other element is not in a container.
//! Iterators to e1 and e2 related to those nodes are invalidated.
//!
//! <b>Complexity</b>: Constant
//!
//! <b>Throws</b>: Nothing.
void swap_nodes(slist_member_hook &other);
//! <b>Precondition</b>: link_mode must be \c safe_link or \c auto_unlink.
//!
//! <b>Returns</b>: true, if the node belongs to a container, false
//! otherwise. This function can be used to test whether \c slist::iterator_to
include/boost/numeric/conversion/detail/converter.hpp view on Meta::CPAN
//--------------------------------------------------------------------------
// Range Checker classes.
//
// The following classes are VISIBLE base classes of the user-level converter<> class.
// They supply the optimized 'out_of_range()' and 'validate_range()' static member functions
// visible in the user interface.
//
//--------------------------------------------------------------------------
// Dummy range checker.
template<class Traits>
struct dummy_range_checker
{
typedef typename Traits::argument_type argument_type ;
static range_check_result out_of_range ( argument_type ) { return cInRange ; }
static void validate_range ( argument_type ) {}
} ;
// Generic range checker.
//
// All the range checking logic for all possible combinations of source and target
// can be arranged in terms of one or two predicates, which test overflow on both neg/pos 'sides'
// of the ranges.
//
// These predicates are given here as IsNegOverflow and IsPosOverflow.
//
include/boost/numeric/conversion/detail/converter.hpp view on Meta::CPAN
typedef typename Traits::argument_type argument_type ;
static range_check_result out_of_range ( argument_type s )
{
typedef typename combine<IsNegOverflow,IsPosOverflow>::type Predicate ;
return Predicate::apply(s);
}
static void validate_range ( argument_type s )
{ OverflowHandler()( out_of_range(s) ) ; }
} ;
//--------------------------------------------------------------------------
//
// Selectors for the optimized Range Checker class.
//
//--------------------------------------------------------------------------
include/boost/numeric/conversion/detail/converter.hpp view on Meta::CPAN
typedef RawConverter RawConverterBase ;
typedef Traits traits ;
typedef typename Traits::source_type source_type ;
typedef typename Traits::argument_type argument_type ;
typedef typename Traits::result_type result_type ;
static result_type convert ( argument_type s )
{
RangeCheckerBase::validate_range(s);
source_type s1 = Float2IntRounderBase::nearbyint(s);
return RawConverterBase::low_level_convert(s1);
}
} ;
//
// Non-Rounding Converter : used for all other conversions.
//
template<class Traits,class RangeChecker,class RawConverter>
include/boost/numeric/conversion/detail/converter.hpp view on Meta::CPAN
typedef Traits traits ;
typedef typename Traits::source_type source_type ;
typedef typename Traits::argument_type argument_type ;
typedef typename Traits::result_type result_type ;
static source_type nearbyint ( argument_type s ) { return s ; }
static result_type convert ( argument_type s )
{
RangeCheckerBase::validate_range(s);
return RawConverterBase::low_level_convert(s);
}
} ;
//--------------------------------------------------------------------------
//
// Selectors for the optimized Converter class.