////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2026. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_CONTAINER_SEGTOR_HPP #define BOOST_CONTAINER_SEGTOR_HPP #ifndef BOOST_CONFIG_HPP # include #endif #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif #include #include #include namespace boost { namespace container { #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED //! A segtor (contraction of "segmented vector" is a sequence container that supports //! random access to elements, constant time insertion and removal of elements at //! the end, and linear time insertion and removal of elements in the middle. //! //! It's the single-ended version of boost::container::deque: it provides //! push_back, pop_back, emplace_back, etc., but does not provide push_front, //! pop_front, or emplace_front. //! //! \tparam T The type of object that is stored in the segtor //! \tparam Allocator The allocator used for all internal memory management, use void //! for the default allocator //! \tparam Options A type produced from \c boost::container::segtor_options. template #else template #endif class segtor : public deque_impl { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED BOOST_COPYABLE_AND_MOVABLE(segtor) typedef deque_impl base_type; #endif public: ////////////////////////////////////////////// // // types // ////////////////////////////////////////////// typedef T value_type; typedef typename base_type::allocator_type allocator_type; typedef typename base_type::pointer pointer; typedef typename base_type::const_pointer const_pointer; typedef typename base_type::reference reference; typedef typename base_type::const_reference const_reference; typedef typename base_type::size_type size_type; typedef typename base_type::difference_type difference_type; typedef typename base_type::iterator iterator; typedef typename base_type::const_iterator const_iterator; typedef typename base_type::reverse_iterator reverse_iterator; typedef typename base_type::const_reverse_iterator const_reverse_iterator; typedef typename base_type::stored_allocator_type stored_allocator_type; using base_type::get_block_size; #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED using base_type::get_segment_size; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED static const std::size_t is_reservable = base_type::is_reservable; ////////////////////////////////////////////// // // construct/copy/destroy // ////////////////////////////////////////////// //! Effects: Default constructs a segtor. //! //! Throws: If allocator_type's default constructor throws. //! //! Complexity: Constant. segtor() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) : base_type() {} //! Effects: Constructs a segtor taking the allocator as parameter. //! //! Throws: Nothing //! //! Complexity: Constant. explicit segtor(const allocator_type& a) BOOST_NOEXCEPT_OR_NOTHROW : base_type(a) {} //! Effects: Constructs a segtor //! and inserts n value initialized values. //! //! Throws: If allocator_type's default constructor //! throws or T's value initialization throws. //! //! Complexity: Linear to n. explicit segtor(size_type n) : base_type(n) {} //! Effects: Constructs a segtor //! and inserts n default initialized values. //! //! Throws: If allocator_type's default constructor //! throws or T's default initialization or copy constructor throws. //! //! Complexity: Linear to n. //! //! Note: Non-standard extension segtor(size_type n, default_init_t) : base_type(n, default_init) {} //! Effects: Constructs a segtor that will use a copy of allocator a //! and inserts n value initialized values. //! //! Throws: If allocator_type's default constructor //! throws or T's value initialization throws. //! //! Complexity: Linear to n. explicit segtor(size_type n, const allocator_type& a) : base_type(n, a) {} //! Effects: Constructs a segtor that will use a copy of allocator a //! and inserts n default initialized values. //! //! Throws: If allocator_type's default constructor //! throws or T's default initialization or copy constructor throws. //! //! Complexity: Linear to n. //! //! Note: Non-standard extension segtor(size_type n, default_init_t, const allocator_type& a) : base_type(n, default_init, a) {} //! Effects: Constructs a segtor that will use a copy of allocator a //! and inserts n copies of value. //! //! Throws: If allocator_type's default constructor //! throws or T's copy constructor throws. //! //! Complexity: Linear to n. segtor(size_type n, const value_type& value) : base_type(n, value) {} //! Effects: Constructs a segtor that will use a copy of allocator a //! and inserts n copies of value. //! //! Throws: If allocator_type's default constructor //! throws or T's copy constructor throws. //! //! Complexity: Linear to n. segtor(size_type n, const value_type& value, const allocator_type& a) : base_type(n, value, a) {} //! Effects: Constructs a segtor that will use a copy of allocator a //! and inserts a copy of the range [first, last). //! //! Throws: If allocator_type's default constructor //! throws or T's constructor taking a dereferenced InIt throws. //! //! Complexity: Linear to the range [first, last). template segtor(InIt first, InIt last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) , typename dtl::disable_if_convertible::type* = 0 #endif ) : base_type(first, last) {} //! Effects: Constructs a segtor that will use a copy of allocator a //! and inserts a copy of the range [first, last). //! //! Throws: If allocator_type's default constructor //! throws or T's constructor taking a dereferenced InIt throws. //! //! Complexity: Linear to the range [first, last). template segtor(InIt first, InIt last, const allocator_type& a #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) , typename dtl::disable_if_convertible::type* = 0 #endif ) : base_type(first, last, a) {} #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) //! Effects: Constructs a segtor that will use a copy of allocator a //! and inserts a copy of the range [il.begin(), il.end()). //! //! Throws: If allocator_type's default constructor //! throws or T's constructor taking a dereferenced std::initializer_list iterator throws. //! //! Complexity: Linear to the range [il.begin(), il.end()). segtor(std::initializer_list il, const allocator_type& a = allocator_type()) : base_type(il, a) {} #endif //! Effects: Copy constructs a segtor. //! //! Postcondition: x == *this. //! //! Complexity: Linear to the elements x contains. segtor(const segtor& x) : base_type(x) {} //! Effects: Move constructor. Moves x's resources to *this. //! //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. segtor(BOOST_RV_REF(segtor) x) BOOST_NOEXCEPT_OR_NOTHROW : base_type(boost::move(static_cast(x))) {} //! Effects: Copy constructs a segtor using the specified allocator. //! //! Postcondition: x == *this. //! //! Throws: If allocation //! throws or T's copy constructor throws. //! //! Complexity: Linear to the elements x contains. segtor(const segtor& x, const allocator_type& a) : base_type(x, a) {} //! Effects: Move constructor using the specified allocator. //! Moves x's resources to *this if a == allocator_type(). //! Otherwise copies values from x to *this. //! //! Throws: If allocation or T's copy constructor throws. //! //! Complexity: Constant if a == x.get_allocator(), linear otherwise. segtor(BOOST_RV_REF(segtor) x, const allocator_type& a) : base_type(boost::move(static_cast(x)), a) {} //! Effects: Destroys the segtor. All stored values are destroyed //! and used memory is deallocated. //! //! Throws: Nothing. //! //! Complexity: Linear to the number of elements. ~segtor() BOOST_NOEXCEPT_OR_NOTHROW {} //! Effects: Makes *this contain the same elements as x. //! //! Postcondition: this->size() == x.size(). *this contains a copy //! of each of x's elements. //! //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to the number of elements in x. segtor& operator=(BOOST_COPY_ASSIGN_REF(segtor) x) { base_type::operator=(static_cast(x)); return *this; } //! Effects: Move assignment. All x's values are transferred to *this. //! //! Throws: If allocator_traits_type::propagate_on_container_move_assignment //! is false and (allocation throws or value_type's move constructor throws) //! //! Complexity: Constant if allocator_traits_type:: //! propagate_on_container_move_assignment is true or //! this->get_allocator() == x.get_allocator(). Linear otherwise. segtor& operator=(BOOST_RV_REF(segtor) x) BOOST_NOEXCEPT_IF(allocator_traits::propagate_on_container_move_assignment::value || allocator_traits::is_always_equal::value) { base_type::operator=(BOOST_MOVE_BASE(base_type, x)); return *this; } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) //! Effects: Makes *this contain the same elements as il. //! //! Postcondition: this->size() == il.size(). *this contains a copy //! of each of il's elements. //! //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to the number of elements in il. segtor& operator=(std::initializer_list il) { base_type::operator=(il); return *this; } #endif ////////////////////////////////////////////// // // capacity // ////////////////////////////////////////////// //! Requires: The container must be "reservable" (is_reservable == true) //! //! Effects: If n is less than or equal to capacity() or the container is not reservable, //! 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. //! //! Throws: If memory allocation throws. //! //! Complexity: Linear to n. //! //! Note: Non-standard extension. void reserve(size_type n) { this->reserve_back(n); } //! Effects: Returns the number of elements that can be inserted //! at the back without allocating additional memory. //! //! Throws: Nothing. //! //! Complexity: Constant. //! //! Note: Non-standard extension. BOOST_CONTAINER_NODISCARD size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return this->back_capacity(); } #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED //! Effects: Returns the number of continguous elements per segment/block. //! Same as get_block_size(). //! //! Throws: Nothing. //! //! Complexity: Constant. static size_type get_segment_size() BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns the number of continguous elements per segment/block. //! Same as get_segment_size(). //! //! Throws: Nothing. //! //! Complexity: Constant. static size_type get_block_size() BOOST_NOEXCEPT_OR_NOTHROW; ////////////////////////////////////////////// // // iterators // ////////////////////////////////////////////// //! Effects: Returns an iterator to the first element contained in the container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD iterator begin() BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns a const_iterator to the first element contained in the container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns an iterator to the end of the container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD iterator end() BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns a const_iterator to the end of the container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns a reverse_iterator pointing to the beginning //! of the reversed container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns a reverse_iterator pointing to the end //! of the reversed container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns a const_iterator to the first element contained in the container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns a const_iterator to the end of the container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW; ////////////////////////////////////////////// // // element access // ////////////////////////////////////////////// //! Effects: Returns true if the container contains no elements. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD bool empty() const BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns the number of the elements contained in the container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD size_type size() const BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns the largest possible size of the container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW; //! Requires: !empty() //! //! Effects: Returns a reference to the first element of the container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD reference front(); //! Requires: !empty() //! //! Effects: Returns a const reference to the first element from the beginning of the container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD const_reference front() const; //! Requires: !empty() //! //! Effects: Returns a reference to the last element of the container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD reference back(); //! Requires: !empty() //! //! Effects: Returns a const reference to the last element of the container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD const_reference back() const; //! Requires: size() > n. //! //! Effects: Returns a reference to the nth element from the beginning of the container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD reference operator[](size_type n); //! Requires: size() > n. //! //! Effects: Returns a const reference to the nth element from the beginning of the container. //! //! Throws: Nothing. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD const_reference operator[](size_type n) const; //! Requires: size() > n. //! //! Effects: Returns a reference to the nth element from the beginning of the container. //! //! Throws: range_error if n >= size() //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD reference at(size_type n); //! Requires: size() > n. //! //! Effects: Returns a const reference to the nth element from the beginning of the container. //! //! Throws: range_error if n >= size() //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD const_reference at(size_type n) const; ////////////////////////////////////////////// // // allocator // ////////////////////////////////////////////// //! Effects: Returns a copy of the internal allocator. //! //! Throws: If allocator's copy constructor throws. //! //! Complexity: Constant. BOOST_CONTAINER_NODISCARD allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns a reference to the internal allocator. //! //! Throws: Nothing //! //! Complexity: Constant. //! //! Note: Non-standard extension. BOOST_CONTAINER_NODISCARD const stored_allocator_type& get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Returns a reference to the internal allocator. //! //! Throws: Nothing //! //! Complexity: Constant. //! //! Note: Non-standard extension. BOOST_CONTAINER_NODISCARD stored_allocator_type& get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW; ////////////////////////////////////////////// // // modifiers // ////////////////////////////////////////////// //! Effects: Assigns the n copies of val to *this. //! //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to n. void assign(size_type n, const value_type& value); //! Effects: Assigns the range [first, last) to *this. //! //! Throws: If memory allocation throws or //! T's constructor from dereferencing InIt throws. //! //! Complexity: Linear to the distance [first, last). template void assign(InIt first, InIt last); //! Effects: Assigns the range [il.begin(), il.end()) to *this. //! //! Throws: If memory allocation throws or //! T's constructor from dereferencing std::initializer_list iterator throws. //! //! Complexity: Linear to il.size(). void assign(std::initializer_list il); //! Effects: Erases all the elements of the container. //! //! Throws: Nothing. //! //! Complexity: Linear to the number of elements in the container. void clear() BOOST_NOEXCEPT_OR_NOTHROW; //! Requires: p must be a valid iterator of *this. //! //! Effects: Inserts an object of type T constructed with //! std::forward(args)... before p //! //! Throws: If memory allocation throws or the in-place constructor throws. //! //! Complexity: If p is end(), amortized constant time //! Linear time otherwise. template iterator emplace(const_iterator p, BOOST_FWD_REF(Args)... args); //! Effects: Inserts an object of type T constructed with //! std::forward(args)... at the end of the container. //! //! Returns: A reference to the created object. //! //! Throws: If memory allocation throws or the in-place constructor throws. //! //! Complexity: Amortized constant time template reference emplace_back(BOOST_FWD_REF(Args)... args); //! Requires: p must be a valid iterator of *this. //! //! Effects: Insert a copy of x before p. //! //! Returns: an iterator to the inserted element. //! //! Throws: If memory allocation throws or x's copy constructor throws. //! //! Complexity: If p is end(), amortized constant time //! Linear time otherwise. iterator insert(const_iterator p, const value_type& x); //! Requires: p must be a valid iterator of *this. //! //! Effects: Insert a new element before p with x's resources. //! //! Returns: an iterator to the inserted element. //! //! Throws: If memory allocation throws. //! //! Complexity: If p is end(), amortized constant time //! Linear time otherwise. iterator insert(const_iterator p, BOOST_RV_REF(value_type) x); //! Requires: pos must be a valid iterator of *this. //! //! Effects: Insert n copies of x before pos. //! //! Returns: an iterator to the first inserted element or pos if n is 0. //! //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to n. iterator insert(const_iterator pos, size_type n, const value_type& x), //! Requires: pos must be a valid iterator of *this. //! //! Effects: Insert a copy of the [first, last) range before pos. //! //! Returns: an iterator to the first inserted element or pos if first == last. //! //! Throws: If memory allocation throws, T's constructor from a //! dereferenced InIt throws or T's copy constructor throws. //! //! Complexity: Linear to distance [first, last). template iterator insert(const_iterator pos, InIt first, InIt last); #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) //! Requires: pos must be a valid iterator of *this. //! //! Effects: Insert a copy of the [il.begin(), il.end()) range before pos. //! //! Returns: an iterator to the first inserted element or pos if il.begin() == il.end(). //! //! Throws: If memory allocation throws, T's constructor from a //! dereferenced std::initializer_list throws or T's copy constructor throws. //! //! Complexity: Linear to distance [il.begin(), il.end()). iterator insert(const_iterator pos, std::initializer_list il); #endif //! Effects: Erases the element at p. //! //! Throws: Nothing. //! //! Complexity: Linear to the elements between pos and the //! last element (if pos is near the end) or the first element //! if (pos is near the beginning). //! Constant if pos is the first or the last element. iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Erases the elements pointed by [first, last). //! //! Throws: Nothing. //! //! Complexity: Linear to the distance between first and //! last plus the elements between pos and the //! last element (if pos is near the end) or the first element //! if (pos is near the beginning). iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Inserts a copy of x at the end of the container. //! //! Throws: If memory allocation throws or //! T's copy constructor throws. //! //! Complexity: Amortized constant time. void push_back(const value_type& x); //! Effects: Constructs a new element at the end of the container //! and moves the resources of x to this new element. //! //! Throws: If memory allocation throws. //! //! Complexity: Amortized constant time. void push_back(BOOST_RV_REF(value_type) x); //! Effects: Removes the last element from the container. //! //! Throws: Nothing. //! //! Complexity: Constant time. void pop_back() BOOST_NOEXCEPT_OR_NOTHROW; //! Effects: Inserts or erases elements at the end such that //! the size becomes n. New elements are value initialized. //! //! Throws: If memory allocation throws, or T's constructor throws. //! //! Complexity: Linear to the difference between size() and new_size. void resize(size_type new_size); //! Effects: Inserts or erases elements at the end such that //! the size becomes n. New elements are default initialized. //! //! Throws: If memory allocation throws, or T's constructor throws. //! //! Complexity: Linear to the difference between size() and new_size. //! //! Note: Non-standard extension void resize(size_type new_size, default_init_t); //! Effects: Inserts or erases elements at the end such that //! the size becomes n. New elements are copy constructed from x. //! //! Throws: If memory allocation throws, or T's copy constructor throws. //! //! Complexity: Linear to the difference between size() and new_size. void resize(size_type new_size, const value_type& x); //! Effects: Swaps the contents of *this and x. //! //! Throws: Nothing. //! //! Complexity: Constant. void swap(segtor& x); #endif //#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED //! Effects: Returns true if x and y are equal //! //! Complexity: Linear to the number of elements in the container. BOOST_CONTAINER_NODISCARD inline friend bool operator==(const segtor& x, const segtor& y) { return static_cast(x) == static_cast(y); } //! Effects: Returns true if x and y are unequal //! //! Complexity: Linear to the number of elements in the container. BOOST_CONTAINER_NODISCARD inline friend bool operator!=(const segtor& x, const segtor& y) { return static_cast(x) != static_cast(y); } //! Effects: Returns true if x is less than y //! //! Complexity: Linear to the number of elements in the container. BOOST_CONTAINER_NODISCARD inline friend bool operator<(const segtor& x, const segtor& y) { return static_cast(x) < static_cast(y); } //! Effects: Returns true if x is greater than y //! //! Complexity: Linear to the number of elements in the container. BOOST_CONTAINER_NODISCARD inline friend bool operator>(const segtor& x, const segtor& y) { return static_cast(x) > static_cast(y); } //! Effects: Returns true if x is equal or less than y //! //! Complexity: Linear to the number of elements in the container. BOOST_CONTAINER_NODISCARD inline friend bool operator<=(const segtor& x, const segtor& y) { return static_cast(x) <= static_cast(y); } //! Effects: Returns true if x is equal or greater than y //! //! Complexity: Linear to the number of elements in the container. BOOST_CONTAINER_NODISCARD inline friend bool operator>=(const segtor& x, const segtor& y) { return static_cast(x) >= static_cast(y); } //! Effects: x.swap(y) //! //! Complexity: Constant. inline friend void swap(segtor& x, segtor& y) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y))) { static_cast(x).swap(static_cast(y)); } }; #ifndef BOOST_CONTAINER_NO_CXX17_CTAD template segtor(InputIterator, InputIterator) -> segtor::type>; template segtor(InputIterator, InputIterator, Allocator const&) -> segtor::type, Allocator>; #endif //! Effects: Erases all elements that compare equal to v from the container c. //! //! Complexity: Linear. template inline typename segtor::size_type erase(segtor& c, const U& v) { typename segtor::size_type old_size = c.size(); c.erase(boost::container::remove(c.begin(), c.end(), v), c.end()); return old_size - c.size(); } //! Effects: Erases all elements that satisfy the predicate pred from the container c. //! //! Complexity: Linear. template inline typename segtor::size_type erase_if(segtor& c, Pred pred) { typename segtor::size_type old_size = c.size(); c.erase(boost::container::remove_if(c.begin(), c.end(), pred), c.end()); return old_size - c.size(); } } //namespace container { } //namespace boost { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED namespace boost { template struct has_trivial_destructor_after_move > : has_trivial_destructor_after_move > {}; } //namespace boost { #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #include #endif //#ifndef BOOST_CONTAINER_SEGTOR_HPP