set.hpp
来自「Boost provides free peer-reviewed portab」· HPP 代码 · 共 1,211 行 · 第 1/3 页
HPP
1,211 行
//! //! <b>Throws</b>: Nothing. //! //! <b>Complexity</b>: Constant. reverse_iterator rbegin() { return m_tree.rbegin(); } //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning //! of the reversed container. //! //! <b>Throws</b>: Nothing. //! //! <b>Complexity</b>: Constant. const_reverse_iterator rbegin() const { return m_tree.rbegin(); } //! <b>Effects</b>: Returns a reverse_iterator pointing to the end //! of the reversed container. //! //! <b>Throws</b>: Nothing. //! //! <b>Complexity</b>: Constant. reverse_iterator rend() { return m_tree.rend(); } //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end //! of the reversed container. //! //! <b>Throws</b>: Nothing. //! //! <b>Complexity</b>: Constant. const_reverse_iterator rend() const { return m_tree.rend(); } //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container. //! //! <b>Throws</b>: Nothing. //! //! <b>Complexity</b>: Constant. const_iterator cbegin() const { return m_tree.cbegin(); } //! <b>Effects</b>: Returns a const_iterator to the end of the container. //! //! <b>Throws</b>: Nothing. //! //! <b>Complexity</b>: Constant. const_iterator cend() const { return m_tree.cend(); } //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning //! of the reversed container. //! //! <b>Throws</b>: Nothing. //! //! <b>Complexity</b>: Constant. const_reverse_iterator crbegin() const { return m_tree.crbegin(); } //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end //! of the reversed container. //! //! <b>Throws</b>: Nothing. //! //! <b>Complexity</b>: Constant. const_reverse_iterator crend() const { return m_tree.crend(); } //! <b>Effects</b>: Returns true if the container contains no elements. //! //! <b>Throws</b>: Nothing. //! //! <b>Complexity</b>: Constant. bool empty() const { return m_tree.empty(); } //! <b>Effects</b>: Returns the number of the elements contained in the container. //! //! <b>Throws</b>: Nothing. //! //! <b>Complexity</b>: Constant. size_type size() const { return m_tree.size(); } //! <b>Effects</b>: Returns the largest possible size of the container. //! //! <b>Throws</b>: Nothing. //! //! <b>Complexity</b>: Constant. size_type max_size() const { return m_tree.max_size(); } //! <b>Effects</b>: Swaps the contents of *this and x. //! If this->allocator_type() != x.allocator_type() allocators are also swapped. //! //! <b>Throws</b>: Nothing. //! //! <b>Complexity</b>: Constant. void swap(multiset<T,Pred,Alloc>& x) { m_tree.swap(x.m_tree); } //! <b>Effects</b>: Swaps the contents of *this and x. //! If this->allocator_type() != x.allocator_type() allocators are also swapped. //! //! <b>Throws</b>: Nothing. //! //! <b>Complexity</b>: Constant. #ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE void swap(const detail::moved_object<multiset<T,Pred,Alloc> >& x) { m_tree.swap(x.get().m_tree); } #else void swap(multiset<T,Pred,Alloc> && x) { m_tree.swap(x.m_tree); } #endif //! <b>Effects</b>: Inserts x and returns the iterator pointing to the //! newly inserted element. //! //! <b>Complexity</b>: Logarithmic. iterator insert(const value_type& x) { return m_tree.insert_equal(x); } //! <b>Effects</b>: Inserts a copy of x in the container. //! //! <b>Returns</b>: An iterator pointing to the element with key equivalent //! to the key of x. //! //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t //! is inserted right before p. #ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE iterator insert(const detail::moved_object<value_type>& x) { return m_tree.insert_equal(x); } #else iterator insert(value_type && x) { return m_tree.insert_equal(detail::move_impl(x)); } #endif //! <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 in general, but amortized constant if t //! is inserted right before p. iterator insert(const_iterator p, const value_type& x) { return m_tree.insert_equal(p, 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 in general, but amortized constant if t //! is inserted right before p. #ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE iterator insert(const_iterator p, const detail::moved_object<value_type>& x) { return m_tree.insert_equal(p, x); } #else iterator insert(const_iterator p, value_type && x) { return m_tree.insert_equal(p, detail::move_impl(x)); } #endif //! <b>Requires</b>: i, j are not iterators into *this. //! //! <b>Effects</b>: inserts each element from the range [i,j) . //! //! <b>Complexity</b>: N log(size()+N) (N is the distance from i to j) template <class InputIterator> void insert(InputIterator first, InputIterator last) { m_tree.insert_equal(first, last); } #ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING //! <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. template <class... Args> iterator emplace(Args&&... args) { return m_tree.emplace_equal(detail::forward_impl<Args>(args)...); } //! <b>Effects</b>: Inserts an object of type T constructed with //! std::forward<Args>(args)... //! //! <b>Returns</b>: An iterator pointing to the element with key equivalent //! to the key of x. //! //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t //! is inserted right before p. template <class... Args> iterator emplace_hint(const_iterator hint, Args&&... args) { return m_tree.emplace_hint_equal(hint, detail::forward_impl<Args>(args)...); } #else //#ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING iterator emplace() { return m_tree.emplace_equal(); } iterator emplace_hint(const_iterator hint) { return m_tree.emplace_hint_equal(hint); } #define BOOST_PP_LOCAL_MACRO(n) \ template<BOOST_PP_ENUM_PARAMS(n, class P)> \ iterator emplace(BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_PARAM_LIST, _)) \ { return m_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_PARAM_FORWARD, _)); } \ \ template<BOOST_PP_ENUM_PARAMS(n, class P)> \ iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_PARAM_LIST, _)) \ { return m_tree.emplace_hint_equal(hint, BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_PARAM_FORWARD, _)); }\ //! #define BOOST_PP_LOCAL_LIMITS (1, BOOST_INTERPROCESS_MAX_CONSTRUCTOR_PARAMETERS) #include BOOST_PP_LOCAL_ITERATE() #endif //#ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING //! <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>: Amortized constant time iterator erase(const_iterator p) { return m_tree.erase(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>: log(size()) + count(k) size_type erase(const key_type& x) { return m_tree.erase(x); } //! <b>Effects</b>: Erases all the elements in the range [first, last). //! //! <b>Returns</b>: Returns last. //! //! <b>Complexity</b>: log(size())+N where N is the distance from first to last. iterator erase(const_iterator first, const_iterator last) { return m_tree.erase(first, last); } //! <b>Effects</b>: erase(a.begin(),a.end()). //! //! <b>Postcondition</b>: size() == 0. //! //! <b>Complexity</b>: linear in size(). void clear() { m_tree.clear(); } //! <b>Returns</b>: An iterator pointing to an element with the key //! equivalent to x, or end() if such an element is not found. //! //! <b>Complexity</b>: Logarithmic. iterator find(const key_type& x) { return m_tree.find(x); } //! <b>Returns</b>: A const iterator pointing to an element with the key //! equivalent to x, or end() if such an element is not found. //! //! <b>Complexity</b>: Logarithmic. const_iterator find(const key_type& x) const { return m_tree.find(x); } //! <b>Returns</b>: The number of elements with key equivalent to x. //! //! <b>Complexity</b>: log(size())+count(k) size_type count(const key_type& x) const { return m_tree.count(x); } //! <b>Returns</b>: An iterator pointing to the first element with key not less //! than k, or a.end() if such an element is not found. //! //! <b>Complexity</b>: Logarithmic iterator lower_bound(const key_type& x) { return m_tree.lower_bound(x); } //! <b>Returns</b>: A const iterator pointing to the first element with key not //! less than k, or a.end() if such an element is not found. //! //! <b>Complexity</b>: Logarithmic const_iterator lower_bound(const key_type& x) const { return m_tree.lower_bound(x); } //! <b>Returns</b>: An iterator pointing to the first element with key not less //! than x, or end() if such an element is not found. //! //! <b>Complexity</b>: Logarithmic iterator upper_bound(const key_type& x) { return m_tree.upper_bound(x); } //! <b>Returns</b>: A const iterator pointing to the first element with key not //! less than x, or end() if such an element is not found. //! //! <b>Complexity</b>: Logarithmic const_iterator upper_bound(const key_type& x) const { return m_tree.upper_bound(x); } //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! //! <b>Complexity</b>: Logarithmic std::pair<iterator,iterator> equal_range(const key_type& x) { return m_tree.equal_range(x); } //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! //! <b>Complexity</b>: Logarithmic std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const { return m_tree.equal_range(x); } /// @cond template <class K1, class C1, class A1> friend bool operator== (const multiset<K1,C1,A1>&, const multiset<K1,C1,A1>&); template <class K1, class C1, class A1> friend bool operator< (const multiset<K1,C1,A1>&, const multiset<K1,C1,A1>&); /// @endcond};template <class T, class Pred, class Alloc>inline bool operator==(const multiset<T,Pred,Alloc>& x, const multiset<T,Pred,Alloc>& y) { return x.m_tree == y.m_tree; }template <class T, class Pred, class Alloc>inline bool operator<(const multiset<T,Pred,Alloc>& x, const multiset<T,Pred,Alloc>& y) { return x.m_tree < y.m_tree; }template <class T, class Pred, class Alloc>inline bool operator!=(const multiset<T,Pred,Alloc>& x, const multiset<T,Pred,Alloc>& y) { return !(x == y); }template <class T, class Pred, class Alloc>inline bool operator>(const multiset<T,Pred,Alloc>& x, const multiset<T,Pred,Alloc>& y) { return y < x; }template <class T, class Pred, class Alloc>inline bool operator<=(const multiset<T,Pred,Alloc>& x, const multiset<T,Pred,Alloc>& y) { return !(y < x); }template <class T, class Pred, class Alloc>inline bool operator>=(const multiset<T,Pred,Alloc>& x, const multiset<T,Pred,Alloc>& y) { return !(x < y); }#ifndef BOOST_INTERPROCESS_RVALUE_REFERENCEtemplate <class T, class Pred, class Alloc>inline void swap(multiset<T,Pred,Alloc>& x, multiset<T,Pred,Alloc>& y) { x.swap(y); }template <class T, class Pred, class Alloc>inline void swap(multiset<T,Pred,Alloc>& x, detail::moved_object<multiset<T,Pred,Alloc> >& y) { x.swap(y.get()); }template <class T, class Pred, class Alloc>inline void swap(detail::moved_object<multiset<T,Pred,Alloc> >& y, multiset<T,Pred,Alloc>& x) { y.swap(x.get()); }#elsetemplate <class T, class Pred, class Alloc>inline void swap(multiset<T,Pred,Alloc>&&x, multiset<T,Pred,Alloc>&&y) { x.swap(y); }#endif/// @cond//!This class is movabletemplate <class T, class P, class A>struct is_movable<multiset<T, P, A> >{ enum { value = true };};//!has_trivial_destructor_after_move<> == true_type//!specialization for optimizationstemplate <class T, class C, class A>struct has_trivial_destructor_after_move<multiset<T, C, A> >{ enum { value = has_trivial_destructor<A>::value && has_trivial_destructor<C>::value };};/// @endcond}} //namespace boost { namespace interprocess {#include <boost/interprocess/detail/config_end.hpp>#endif /* BOOST_INTERPROCESS_SET_HPP */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?