annotate DEPENDENCIES/generic/include/boost/container/slist.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 //////////////////////////////////////////////////////////////////////////////
Chris@16 2 //
Chris@101 3 // (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
Chris@16 4 // Software License, Version 1.0. (See accompanying file
Chris@16 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6 //
Chris@16 7 // See http://www.boost.org/libs/container for documentation.
Chris@16 8 //
Chris@16 9 //////////////////////////////////////////////////////////////////////////////
Chris@16 10
Chris@16 11 #ifndef BOOST_CONTAINER_SLIST_HPP
Chris@16 12 #define BOOST_CONTAINER_SLIST_HPP
Chris@16 13
Chris@101 14 #ifndef BOOST_CONFIG_HPP
Chris@101 15 # include <boost/config.hpp>
Chris@101 16 #endif
Chris@101 17
Chris@101 18 #if defined(BOOST_HAS_PRAGMA_ONCE)
Chris@16 19 # pragma once
Chris@16 20 #endif
Chris@16 21
Chris@16 22 #include <boost/container/detail/config_begin.hpp>
Chris@16 23 #include <boost/container/detail/workaround.hpp>
Chris@16 24
Chris@101 25 // container
Chris@16 26 #include <boost/container/container_fwd.hpp>
Chris@101 27 #include <boost/container/new_allocator.hpp> //new_allocator
Chris@16 28 #include <boost/container/throw_exception.hpp>
Chris@101 29 // container/detail
Chris@101 30 #include <boost/container/detail/algorithm.hpp> //algo_equal(), algo_lexicographical_compare
Chris@101 31 #include <boost/container/detail/compare_functors.hpp>
Chris@101 32 #include <boost/container/detail/iterator.hpp>
Chris@16 33 #include <boost/container/detail/iterators.hpp>
Chris@16 34 #include <boost/container/detail/mpl.hpp>
Chris@101 35 #include <boost/container/detail/node_alloc_holder.hpp>
Chris@16 36 #include <boost/container/detail/type_traits.hpp>
Chris@101 37 // intrusive
Chris@101 38 #include <boost/intrusive/pointer_traits.hpp>
Chris@16 39 #include <boost/intrusive/slist.hpp>
Chris@101 40 // move
Chris@101 41 #include <boost/move/iterator.hpp>
Chris@101 42 #include <boost/move/traits.hpp>
Chris@101 43 #include <boost/move/utility_core.hpp>
Chris@101 44 // move/detail
Chris@101 45 #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
Chris@101 46 #include <boost/move/detail/fwd_macros.hpp>
Chris@16 47 #endif
Chris@101 48 #include <boost/move/detail/move_helpers.hpp>
Chris@101 49 // other
Chris@101 50 #include <boost/core/no_exceptions_support.hpp>
Chris@101 51 // std
Chris@101 52 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
Chris@101 53 #include <initializer_list>
Chris@101 54 #endif
Chris@16 55
Chris@16 56 namespace boost {
Chris@16 57 namespace container {
Chris@16 58
Chris@101 59 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 60
Chris@16 61 template <class T, class Allocator>
Chris@16 62 class slist;
Chris@16 63
Chris@16 64 namespace container_detail {
Chris@16 65
Chris@16 66 template<class VoidPointer>
Chris@16 67 struct slist_hook
Chris@16 68 {
Chris@16 69 typedef typename container_detail::bi::make_slist_base_hook
Chris@16 70 <container_detail::bi::void_pointer<VoidPointer>, container_detail::bi::link_mode<container_detail::bi::normal_link> >::type type;
Chris@16 71 };
Chris@16 72
Chris@16 73 template <class T, class VoidPointer>
Chris@16 74 struct slist_node
Chris@16 75 : public slist_hook<VoidPointer>::type
Chris@16 76 {
Chris@16 77 private:
Chris@16 78 slist_node();
Chris@16 79
Chris@16 80 public:
Chris@16 81 typedef T value_type;
Chris@16 82 typedef typename slist_hook<VoidPointer>::type hook_type;
Chris@16 83
Chris@16 84 T m_data;
Chris@16 85
Chris@16 86 T &get_data()
Chris@16 87 { return this->m_data; }
Chris@16 88
Chris@16 89 const T &get_data() const
Chris@16 90 { return this->m_data; }
Chris@16 91 };
Chris@16 92
Chris@101 93 template <class T, class VoidPointer>
Chris@101 94 struct iiterator_node_value_type< slist_node<T,VoidPointer> > {
Chris@101 95 typedef T type;
Chris@101 96 };
Chris@101 97
Chris@16 98 template<class Allocator>
Chris@16 99 struct intrusive_slist_type
Chris@16 100 {
Chris@16 101 typedef boost::container::allocator_traits<Allocator> allocator_traits_type;
Chris@16 102 typedef typename allocator_traits_type::value_type value_type;
Chris@16 103 typedef typename boost::intrusive::pointer_traits
Chris@16 104 <typename allocator_traits_type::pointer>::template
Chris@16 105 rebind_pointer<void>::type
Chris@16 106 void_pointer;
Chris@16 107 typedef typename container_detail::slist_node
Chris@16 108 <value_type, void_pointer> node_type;
Chris@16 109
Chris@16 110 typedef typename container_detail::bi::make_slist
Chris@16 111 <node_type
Chris@16 112 ,container_detail::bi::base_hook<typename slist_hook<void_pointer>::type>
Chris@16 113 ,container_detail::bi::constant_time_size<true>
Chris@16 114 , container_detail::bi::size_type
Chris@16 115 <typename allocator_traits_type::size_type>
Chris@16 116 >::type container_type;
Chris@16 117 typedef container_type type ;
Chris@16 118 };
Chris@16 119
Chris@16 120 } //namespace container_detail {
Chris@16 121
Chris@101 122 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 123
Chris@16 124 //! An slist is a singly linked list: a list where each element is linked to the next
Chris@16 125 //! element, but not to the previous element. That is, it is a Sequence that
Chris@16 126 //! supports forward but not backward traversal, and (amortized) constant time
Chris@16 127 //! insertion and removal of elements. Slists, like lists, have the important
Chris@16 128 //! property that insertion and splicing do not invalidate iterators to list elements,
Chris@16 129 //! and that even removal invalidates only the iterators that point to the elements
Chris@16 130 //! that are removed. The ordering of iterators may be changed (that is,
Chris@16 131 //! slist<T>::iterator might have a different predecessor or successor after a list
Chris@16 132 //! operation than it did before), but the iterators themselves will not be invalidated
Chris@16 133 //! or made to point to different elements unless that invalidation or mutation is explicit.
Chris@16 134 //!
Chris@16 135 //! The main difference between slist and list is that list's iterators are bidirectional
Chris@16 136 //! iterators, while slist's iterators are forward iterators. This means that slist is
Chris@16 137 //! less versatile than list; frequently, however, bidirectional iterators are
Chris@16 138 //! unnecessary. You should usually use slist unless you actually need the extra
Chris@16 139 //! functionality of list, because singly linked lists are smaller and faster than double
Chris@16 140 //! linked lists.
Chris@16 141 //!
Chris@16 142 //! Important performance note: like every other Sequence, slist defines the member
Chris@16 143 //! functions insert and erase. Using these member functions carelessly, however, can
Chris@16 144 //! result in disastrously slow programs. The problem is that insert's first argument is
Chris@16 145 //! an iterator p, and that it inserts the new element(s) before p. This means that
Chris@16 146 //! insert must find the iterator just before p; this is a constant-time operation
Chris@16 147 //! for list, since list has bidirectional iterators, but for slist it must find that
Chris@16 148 //! iterator by traversing the list from the beginning up to p. In other words:
Chris@16 149 //! insert and erase are slow operations anywhere but near the beginning of the slist.
Chris@16 150 //!
Chris@16 151 //! Slist provides the member functions insert_after and erase_after, which are constant
Chris@16 152 //! time operations: you should always use insert_after and erase_after whenever
Chris@16 153 //! possible. If you find that insert_after and erase_after aren't adequate for your
Chris@16 154 //! needs, and that you often need to use insert and erase in the middle of the list,
Chris@16 155 //! then you should probably use list instead of slist.
Chris@101 156 //!
Chris@101 157 //! \tparam T The type of object that is stored in the list
Chris@101 158 //! \tparam Allocator The allocator used for all internal memory management
Chris@16 159 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@101 160 template <class T, class Allocator = new_allocator<T> >
Chris@16 161 #else
Chris@16 162 template <class T, class Allocator>
Chris@16 163 #endif
Chris@16 164 class slist
Chris@16 165 : protected container_detail::node_alloc_holder
Chris@16 166 <Allocator, typename container_detail::intrusive_slist_type<Allocator>::type>
Chris@16 167 {
Chris@101 168 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 169 typedef typename
Chris@16 170 container_detail::intrusive_slist_type<Allocator>::type Icont;
Chris@16 171 typedef container_detail::node_alloc_holder<Allocator, Icont> AllocHolder;
Chris@101 172 typedef typename AllocHolder::NodePtr NodePtr;
Chris@101 173 typedef typename AllocHolder::NodeAlloc NodeAlloc;
Chris@101 174 typedef typename AllocHolder::ValAlloc ValAlloc;
Chris@101 175 typedef typename AllocHolder::Node Node;
Chris@101 176 typedef container_detail::allocator_destroyer<NodeAlloc> Destroyer;
Chris@101 177 typedef typename AllocHolder::alloc_version alloc_version;
Chris@101 178 typedef boost::container::
Chris@101 179 allocator_traits<Allocator> allocator_traits_type;
Chris@101 180 typedef boost::container::equal_to_value<Allocator> equal_to_value_type;
Chris@16 181
Chris@16 182 BOOST_COPYABLE_AND_MOVABLE(slist)
Chris@101 183 typedef container_detail::iterator_from_iiterator<typename Icont::iterator, false> iterator_impl;
Chris@101 184 typedef container_detail::iterator_from_iiterator<typename Icont::iterator, true > const_iterator_impl;
Chris@101 185 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 186
Chris@16 187 public:
Chris@16 188 //////////////////////////////////////////////
Chris@16 189 //
Chris@16 190 // types
Chris@16 191 //
Chris@16 192 //////////////////////////////////////////////
Chris@16 193
Chris@16 194 typedef T value_type;
Chris@16 195 typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
Chris@16 196 typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
Chris@16 197 typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
Chris@16 198 typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
Chris@16 199 typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
Chris@16 200 typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
Chris@16 201 typedef Allocator allocator_type;
Chris@16 202 typedef BOOST_CONTAINER_IMPDEF(NodeAlloc) stored_allocator_type;
Chris@16 203 typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator;
Chris@16 204 typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl) const_iterator;
Chris@16 205
Chris@16 206 public:
Chris@16 207
Chris@16 208 //////////////////////////////////////////////
Chris@16 209 //
Chris@16 210 // construct/copy/destroy
Chris@16 211 //
Chris@16 212 //////////////////////////////////////////////
Chris@16 213
Chris@16 214 //! <b>Effects</b>: Constructs a list taking the allocator as parameter.
Chris@16 215 //!
Chris@16 216 //! <b>Throws</b>: If allocator_type's copy constructor throws.
Chris@16 217 //!
Chris@16 218 //! <b>Complexity</b>: Constant.
Chris@16 219 slist()
Chris@16 220 : AllocHolder()
Chris@16 221 {}
Chris@16 222
Chris@16 223 //! <b>Effects</b>: Constructs a list taking the allocator as parameter.
Chris@16 224 //!
Chris@16 225 //! <b>Throws</b>: Nothing
Chris@16 226 //!
Chris@16 227 //! <b>Complexity</b>: Constant.
Chris@101 228 explicit slist(const allocator_type& a) BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 229 : AllocHolder(a)
Chris@16 230 {}
Chris@16 231
Chris@101 232 //! <b>Effects</b>: Constructs a list
Chris@101 233 //! and inserts n value-initialized value_types.
Chris@101 234 //!
Chris@101 235 //! <b>Throws</b>: If allocator_type's default constructor
Chris@101 236 //! throws or T's default or copy constructor throws.
Chris@101 237 //!
Chris@101 238 //! <b>Complexity</b>: Linear to n.
Chris@16 239 explicit slist(size_type n)
Chris@16 240 : AllocHolder(allocator_type())
Chris@16 241 { this->resize(n); }
Chris@16 242
Chris@16 243 //! <b>Effects</b>: Constructs a list that will use a copy of allocator a
Chris@16 244 //! and inserts n copies of value.
Chris@16 245 //!
Chris@101 246 //! <b>Throws</b>: If allocator_type's default constructor
Chris@101 247 //! throws or T's default or copy constructor throws.
Chris@101 248 //!
Chris@101 249 //! <b>Complexity</b>: Linear to n.
Chris@101 250 slist(size_type n, const allocator_type &a)
Chris@101 251 : AllocHolder(a)
Chris@101 252 { this->resize(n); }
Chris@101 253
Chris@101 254 //! <b>Effects</b>: Constructs a list that will use a copy of allocator a
Chris@101 255 //! and inserts n copies of value.
Chris@101 256 //!
Chris@101 257 //! <b>Throws</b>: If allocator_type's default constructor
Chris@16 258 //! throws or T's default or copy constructor throws.
Chris@16 259 //!
Chris@16 260 //! <b>Complexity</b>: Linear to n.
Chris@16 261 explicit slist(size_type n, const value_type& x, const allocator_type& a = allocator_type())
Chris@16 262 : AllocHolder(a)
Chris@16 263 { this->insert_after(this->cbefore_begin(), n, x); }
Chris@16 264
Chris@16 265 //! <b>Effects</b>: Constructs a list that will use a copy of allocator a
Chris@16 266 //! and inserts a copy of the range [first, last) in the list.
Chris@16 267 //!
Chris@101 268 //! <b>Throws</b>: If allocator_type's default constructor
Chris@101 269 //! throws or T's constructor taking a dereferenced InIt throws.
Chris@16 270 //!
Chris@16 271 //! <b>Complexity</b>: Linear to the range [first, last).
Chris@16 272 template <class InpIt>
Chris@16 273 slist(InpIt first, InpIt last, const allocator_type& a = allocator_type())
Chris@16 274 : AllocHolder(a)
Chris@16 275 { this->insert_after(this->cbefore_begin(), first, last); }
Chris@16 276
Chris@101 277 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
Chris@101 278 //! <b>Effects</b>: Constructs a list that will use a copy of allocator a
Chris@101 279 //! and inserts a copy of the range [il.begin(), il.end()) in the list.
Chris@101 280 //!
Chris@101 281 //! <b>Throws</b>: If allocator_type's default constructor
Chris@101 282 //! throws or T's constructor taking a dereferenced std::initializer_list iterator throws.
Chris@101 283 //!
Chris@101 284 //! <b>Complexity</b>: Linear to the range [il.begin(), il.end()).
Chris@101 285 slist(std::initializer_list<value_type> il, const allocator_type& a = allocator_type())
Chris@101 286 : AllocHolder(a)
Chris@101 287 { this->insert_after(this->cbefore_begin(), il.begin(), il.end()); }
Chris@101 288 #endif
Chris@101 289
Chris@101 290 //! <b>Effects</b>: Copy constructs a list.
Chris@16 291 //!
Chris@16 292 //! <b>Postcondition</b>: x == *this.
Chris@16 293 //!
Chris@101 294 //! <b>Throws</b>: If allocator_type's default constructor
Chris@16 295 //!
Chris@16 296 //! <b>Complexity</b>: Linear to the elements x contains.
Chris@16 297 slist(const slist& x)
Chris@16 298 : AllocHolder(x)
Chris@16 299 { this->insert_after(this->cbefore_begin(), x.begin(), x.end()); }
Chris@16 300
Chris@101 301 //! <b>Effects</b>: Move constructor. Moves x's resources to *this.
Chris@16 302 //!
Chris@16 303 //! <b>Throws</b>: If allocator_type's copy constructor throws.
Chris@16 304 //!
Chris@16 305 //! <b>Complexity</b>: Constant.
Chris@16 306 slist(BOOST_RV_REF(slist) x)
Chris@101 307 : AllocHolder(BOOST_MOVE_BASE(AllocHolder, x))
Chris@16 308 {}
Chris@16 309
Chris@16 310 //! <b>Effects</b>: Copy constructs a list using the specified allocator.
Chris@16 311 //!
Chris@16 312 //! <b>Postcondition</b>: x == *this.
Chris@16 313 //!
Chris@101 314 //! <b>Throws</b>: If allocator_type's default constructor
Chris@16 315 //!
Chris@16 316 //! <b>Complexity</b>: Linear to the elements x contains.
Chris@16 317 slist(const slist& x, const allocator_type &a)
Chris@16 318 : AllocHolder(a)
Chris@16 319 { this->insert_after(this->cbefore_begin(), x.begin(), x.end()); }
Chris@16 320
Chris@16 321 //! <b>Effects</b>: Move constructor using the specified allocator.
Chris@16 322 //! Moves x's resources to *this.
Chris@16 323 //!
Chris@16 324 //! <b>Throws</b>: If allocation or value_type's copy constructor throws.
Chris@16 325 //!
Chris@16 326 //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise.
Chris@16 327 slist(BOOST_RV_REF(slist) x, const allocator_type &a)
Chris@16 328 : AllocHolder(a)
Chris@16 329 {
Chris@16 330 if(this->node_alloc() == x.node_alloc()){
Chris@16 331 this->icont().swap(x.icont());
Chris@16 332 }
Chris@16 333 else{
Chris@101 334 this->insert_after(this->cbefore_begin(), boost::make_move_iterator(x.begin()), boost::make_move_iterator(x.end()));
Chris@16 335 }
Chris@16 336 }
Chris@16 337
Chris@16 338 //! <b>Effects</b>: Destroys the list. All stored values are destroyed
Chris@16 339 //! and used memory is deallocated.
Chris@16 340 //!
Chris@16 341 //! <b>Throws</b>: Nothing.
Chris@16 342 //!
Chris@16 343 //! <b>Complexity</b>: Linear to the number of elements.
Chris@101 344 ~slist() BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 345 {} //AllocHolder clears the slist
Chris@16 346
Chris@16 347 //! <b>Effects</b>: Makes *this contain the same elements as x.
Chris@16 348 //!
Chris@16 349 //! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
Chris@16 350 //! of each of x's elements.
Chris@16 351 //!
Chris@16 352 //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
Chris@16 353 //!
Chris@16 354 //! <b>Complexity</b>: Linear to the number of elements in x.
Chris@16 355 slist& operator= (BOOST_COPY_ASSIGN_REF(slist) x)
Chris@16 356 {
Chris@16 357 if (&x != this){
Chris@16 358 NodeAlloc &this_alloc = this->node_alloc();
Chris@16 359 const NodeAlloc &x_alloc = x.node_alloc();
Chris@16 360 container_detail::bool_<allocator_traits_type::
Chris@16 361 propagate_on_container_copy_assignment::value> flag;
Chris@16 362 if(flag && this_alloc != x_alloc){
Chris@16 363 this->clear();
Chris@16 364 }
Chris@16 365 this->AllocHolder::copy_assign_alloc(x);
Chris@16 366 this->assign(x.begin(), x.end());
Chris@16 367 }
Chris@16 368 return *this;
Chris@16 369 }
Chris@16 370
Chris@16 371 //! <b>Effects</b>: Makes *this contain the same elements as x.
Chris@16 372 //!
Chris@16 373 //! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
Chris@16 374 //! of each of x's elements.
Chris@16 375 //!
Chris@101 376 //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment
Chris@101 377 //! is false and (allocation throws or value_type's move constructor throws)
Chris@16 378 //!
Chris@101 379 //! <b>Complexity</b>: Constant if allocator_traits_type::
Chris@101 380 //! propagate_on_container_move_assignment is true or
Chris@101 381 //! this->get>allocator() == x.get_allocator(). Linear otherwise.
Chris@16 382 slist& operator= (BOOST_RV_REF(slist) x)
Chris@101 383 BOOST_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_move_assignment::value
Chris@101 384 || allocator_traits_type::is_always_equal::value)
Chris@16 385 {
Chris@101 386 BOOST_ASSERT(this != &x);
Chris@101 387 NodeAlloc &this_alloc = this->node_alloc();
Chris@101 388 NodeAlloc &x_alloc = x.node_alloc();
Chris@101 389 const bool propagate_alloc = allocator_traits_type::
Chris@101 390 propagate_on_container_move_assignment::value;
Chris@101 391 const bool allocators_equal = this_alloc == x_alloc; (void)allocators_equal;
Chris@101 392 //Resources can be transferred if both allocators are
Chris@101 393 //going to be equal after this function (either propagated or already equal)
Chris@101 394 if(propagate_alloc || allocators_equal){
Chris@101 395 //Destroy
Chris@101 396 this->clear();
Chris@101 397 //Move allocator if needed
Chris@101 398 this->AllocHolder::move_assign_alloc(x);
Chris@101 399 //Obtain resources
Chris@101 400 this->icont() = boost::move(x.icont());
Chris@101 401 }
Chris@101 402 //Else do a one by one move
Chris@101 403 else{
Chris@101 404 this->assign( boost::make_move_iterator(x.begin())
Chris@101 405 , boost::make_move_iterator(x.end()));
Chris@16 406 }
Chris@16 407 return *this;
Chris@16 408 }
Chris@16 409
Chris@101 410 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
Chris@101 411 //! <b>Effects</b>: Makes *this contain the same elements as in il.
Chris@101 412 //!
Chris@101 413 //! <b>Postcondition</b>: this->size() == il.size(). *this contains a copy
Chris@101 414 //! of each of il's elements.
Chris@101 415 //!
Chris@101 416 //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment
Chris@101 417 //! is false and (allocation throws or value_type's move constructor throws)
Chris@101 418 slist& operator=(std::initializer_list<value_type> il)
Chris@101 419 {
Chris@101 420 assign(il.begin(), il.end());
Chris@101 421 return *this;
Chris@101 422 }
Chris@101 423 #endif
Chris@101 424
Chris@16 425 //! <b>Effects</b>: Assigns the n copies of val to *this.
Chris@16 426 //!
Chris@16 427 //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
Chris@16 428 //!
Chris@16 429 //! <b>Complexity</b>: Linear to n.
Chris@16 430 void assign(size_type n, const T& val)
Chris@16 431 {
Chris@16 432 typedef constant_iterator<value_type, difference_type> cvalue_iterator;
Chris@16 433 return this->assign(cvalue_iterator(val, n), cvalue_iterator());
Chris@16 434 }
Chris@16 435
Chris@16 436 //! <b>Effects</b>: Assigns the range [first, last) to *this.
Chris@16 437 //!
Chris@16 438 //! <b>Throws</b>: If memory allocation throws or
Chris@16 439 //! T's constructor from dereferencing InpIt throws.
Chris@16 440 //!
Chris@16 441 //! <b>Complexity</b>: Linear to n.
Chris@16 442 template <class InpIt>
Chris@16 443 void assign(InpIt first, InpIt last
Chris@16 444 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 445 , typename container_detail::enable_if_c
Chris@16 446 < !container_detail::is_convertible<InpIt, size_type>::value
Chris@16 447 >::type * = 0
Chris@16 448 #endif
Chris@16 449 )
Chris@16 450 {
Chris@16 451 iterator end_n(this->end());
Chris@16 452 iterator prev(this->before_begin());
Chris@16 453 iterator node(this->begin());
Chris@16 454 while (node != end_n && first != last){
Chris@16 455 *node = *first;
Chris@16 456 prev = node;
Chris@16 457 ++node;
Chris@16 458 ++first;
Chris@16 459 }
Chris@16 460 if (first != last)
Chris@16 461 this->insert_after(prev, first, last);
Chris@16 462 else
Chris@16 463 this->erase_after(prev, end_n);
Chris@16 464 }
Chris@16 465
Chris@101 466 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
Chris@101 467 //! <b>Effects</b>: Assigns the range [il.begin(), il.end()) to *this.
Chris@101 468 //!
Chris@101 469 //! <b>Throws</b>: If memory allocation throws or
Chris@101 470 //! T's constructor from dereferencing std::initializer_list iterator throws.
Chris@101 471 //!
Chris@101 472 //! <b>Complexity</b>: Linear to range [il.begin(), il.end()).
Chris@101 473
Chris@101 474 void assign(std::initializer_list<value_type> il)
Chris@101 475 {
Chris@101 476 assign(il.begin(), il.end());
Chris@101 477 }
Chris@101 478 #endif
Chris@16 479 //! <b>Effects</b>: Returns a copy of the internal allocator.
Chris@16 480 //!
Chris@16 481 //! <b>Throws</b>: If allocator's copy constructor throws.
Chris@16 482 //!
Chris@16 483 //! <b>Complexity</b>: Constant.
Chris@101 484 allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 485 { return allocator_type(this->node_alloc()); }
Chris@16 486
Chris@16 487 //! <b>Effects</b>: Returns a reference to the internal allocator.
Chris@16 488 //!
Chris@16 489 //! <b>Throws</b>: Nothing
Chris@16 490 //!
Chris@16 491 //! <b>Complexity</b>: Constant.
Chris@16 492 //!
Chris@16 493 //! <b>Note</b>: Non-standard extension.
Chris@101 494 stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 495 { return this->node_alloc(); }
Chris@16 496
Chris@16 497 //! <b>Effects</b>: Returns a reference to the internal allocator.
Chris@16 498 //!
Chris@16 499 //! <b>Throws</b>: Nothing
Chris@16 500 //!
Chris@16 501 //! <b>Complexity</b>: Constant.
Chris@16 502 //!
Chris@16 503 //! <b>Note</b>: Non-standard extension.
Chris@101 504 const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 505 { return this->node_alloc(); }
Chris@16 506
Chris@16 507 //////////////////////////////////////////////
Chris@16 508 //
Chris@16 509 // iterators
Chris@16 510 //
Chris@16 511 //////////////////////////////////////////////
Chris@16 512
Chris@16 513 //! <b>Effects</b>: Returns a non-dereferenceable iterator that,
Chris@16 514 //! when incremented, yields begin(). This iterator may be used
Chris@16 515 //! as the argument to insert_after, erase_after, etc.
Chris@16 516 //!
Chris@16 517 //! <b>Throws</b>: Nothing.
Chris@16 518 //!
Chris@16 519 //! <b>Complexity</b>: Constant.
Chris@101 520 iterator before_begin() BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 521 { return iterator(end()); }
Chris@16 522
Chris@16 523 //! <b>Effects</b>: Returns a non-dereferenceable const_iterator
Chris@16 524 //! that, when incremented, yields begin(). This iterator may be used
Chris@16 525 //! as the argument to insert_after, erase_after, etc.
Chris@16 526 //!
Chris@16 527 //! <b>Throws</b>: Nothing.
Chris@16 528 //!
Chris@16 529 //! <b>Complexity</b>: Constant.
Chris@101 530 const_iterator before_begin() const BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 531 { return this->cbefore_begin(); }
Chris@16 532
Chris@16 533 //! <b>Effects</b>: Returns an iterator to the first element contained in the list.
Chris@16 534 //!
Chris@16 535 //! <b>Throws</b>: Nothing.
Chris@16 536 //!
Chris@16 537 //! <b>Complexity</b>: Constant.
Chris@101 538 iterator begin() BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 539 { return iterator(this->icont().begin()); }
Chris@16 540
Chris@16 541 //! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
Chris@16 542 //!
Chris@16 543 //! <b>Throws</b>: Nothing.
Chris@16 544 //!
Chris@16 545 //! <b>Complexity</b>: Constant.
Chris@101 546 const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 547 { return this->cbegin(); }
Chris@16 548
Chris@16 549 //! <b>Effects</b>: Returns an iterator to the end of the list.
Chris@16 550 //!
Chris@16 551 //! <b>Throws</b>: Nothing.
Chris@16 552 //!
Chris@16 553 //! <b>Complexity</b>: Constant.
Chris@101 554 iterator end() BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 555 { return iterator(this->icont().end()); }
Chris@16 556
Chris@16 557 //! <b>Effects</b>: Returns a const_iterator to the end of the list.
Chris@16 558 //!
Chris@16 559 //! <b>Throws</b>: Nothing.
Chris@16 560 //!
Chris@16 561 //! <b>Complexity</b>: Constant.
Chris@101 562 const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 563 { return this->cend(); }
Chris@16 564
Chris@16 565 //! <b>Effects</b>: Returns a non-dereferenceable const_iterator
Chris@16 566 //! that, when incremented, yields begin(). This iterator may be used
Chris@16 567 //! as the argument to insert_after, erase_after, etc.
Chris@16 568 //!
Chris@16 569 //! <b>Throws</b>: Nothing.
Chris@16 570 //!
Chris@16 571 //! <b>Complexity</b>: Constant.
Chris@101 572 const_iterator cbefore_begin() const BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 573 { return const_iterator(end()); }
Chris@16 574
Chris@16 575 //! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
Chris@16 576 //!
Chris@16 577 //! <b>Throws</b>: Nothing.
Chris@16 578 //!
Chris@16 579 //! <b>Complexity</b>: Constant.
Chris@101 580 const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 581 { return const_iterator(this->non_const_icont().begin()); }
Chris@16 582
Chris@16 583 //! <b>Effects</b>: Returns a const_iterator to the end of the list.
Chris@16 584 //!
Chris@16 585 //! <b>Throws</b>: Nothing.
Chris@16 586 //!
Chris@16 587 //! <b>Complexity</b>: Constant.
Chris@101 588 const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 589 { return const_iterator(this->non_const_icont().end()); }
Chris@16 590
Chris@16 591 //! <b>Returns</b>: The iterator to the element before i in the sequence.
Chris@16 592 //! Returns the end-iterator, if either i is the begin-iterator or the
Chris@16 593 //! sequence is empty.
Chris@16 594 //!
Chris@16 595 //! <b>Throws</b>: Nothing.
Chris@16 596 //!
Chris@16 597 //! <b>Complexity</b>: Linear to the number of elements before i.
Chris@16 598 //!
Chris@16 599 //! <b>Note</b>: Non-standard extension.
Chris@101 600 iterator previous(iterator p) BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 601 { return iterator(this->icont().previous(p.get())); }
Chris@16 602
Chris@16 603 //! <b>Returns</b>: The const_iterator to the element before i in the sequence.
Chris@16 604 //! Returns the end-const_iterator, if either i is the begin-const_iterator or
Chris@16 605 //! the sequence is empty.
Chris@16 606 //!
Chris@16 607 //! <b>Throws</b>: Nothing.
Chris@16 608 //!
Chris@16 609 //! <b>Complexity</b>: Linear to the number of elements before i.
Chris@16 610 //!
Chris@16 611 //! <b>Note</b>: Non-standard extension.
Chris@16 612 const_iterator previous(const_iterator p)
Chris@16 613 { return const_iterator(this->icont().previous(p.get())); }
Chris@16 614
Chris@16 615 //////////////////////////////////////////////
Chris@16 616 //
Chris@16 617 // capacity
Chris@16 618 //
Chris@16 619 //////////////////////////////////////////////
Chris@16 620
Chris@16 621 //! <b>Effects</b>: Returns true if the list contains no elements.
Chris@16 622 //!
Chris@16 623 //! <b>Throws</b>: Nothing.
Chris@16 624 //!
Chris@16 625 //! <b>Complexity</b>: Constant.
Chris@16 626 bool empty() const
Chris@16 627 { return !this->size(); }
Chris@16 628
Chris@16 629 //! <b>Effects</b>: Returns the number of the elements contained in the list.
Chris@16 630 //!
Chris@16 631 //! <b>Throws</b>: Nothing.
Chris@16 632 //!
Chris@16 633 //! <b>Complexity</b>: Constant.
Chris@16 634 size_type size() const
Chris@16 635 { return this->icont().size(); }
Chris@16 636
Chris@16 637 //! <b>Effects</b>: Returns the largest possible size of the list.
Chris@16 638 //!
Chris@16 639 //! <b>Throws</b>: Nothing.
Chris@16 640 //!
Chris@16 641 //! <b>Complexity</b>: Constant.
Chris@16 642 size_type max_size() const
Chris@16 643 { return AllocHolder::max_size(); }
Chris@16 644
Chris@16 645 //! <b>Effects</b>: Inserts or erases elements at the end such that
Chris@16 646 //! the size becomes n. New elements are value initialized.
Chris@16 647 //!
Chris@16 648 //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
Chris@16 649 //!
Chris@16 650 //! <b>Complexity</b>: Linear to the difference between size() and new_size.
Chris@16 651 void resize(size_type new_size)
Chris@16 652 {
Chris@16 653 const_iterator last_pos;
Chris@16 654 if(!priv_try_shrink(new_size, last_pos)){
Chris@16 655 typedef value_init_construct_iterator<value_type, difference_type> value_init_iterator;
Chris@16 656 this->insert_after(last_pos, value_init_iterator(new_size - this->size()), value_init_iterator());
Chris@16 657 }
Chris@16 658 }
Chris@16 659
Chris@16 660 //! <b>Effects</b>: Inserts or erases elements at the end such that
Chris@16 661 //! the size becomes n. New elements are copy constructed from x.
Chris@16 662 //!
Chris@16 663 //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
Chris@16 664 //!
Chris@16 665 //! <b>Complexity</b>: Linear to the difference between size() and new_size.
Chris@16 666 void resize(size_type new_size, const T& x)
Chris@16 667 {
Chris@16 668 const_iterator last_pos;
Chris@16 669 if(!priv_try_shrink(new_size, last_pos)){
Chris@16 670 this->insert_after(last_pos, new_size, x);
Chris@16 671 }
Chris@16 672 }
Chris@16 673
Chris@16 674 //////////////////////////////////////////////
Chris@16 675 //
Chris@16 676 // element access
Chris@16 677 //
Chris@16 678 //////////////////////////////////////////////
Chris@16 679
Chris@16 680 //! <b>Requires</b>: !empty()
Chris@16 681 //!
Chris@16 682 //! <b>Effects</b>: Returns a reference to the first element
Chris@16 683 //! from the beginning of the container.
Chris@16 684 //!
Chris@16 685 //! <b>Throws</b>: Nothing.
Chris@16 686 //!
Chris@16 687 //! <b>Complexity</b>: Constant.
Chris@16 688 reference front()
Chris@16 689 { return *this->begin(); }
Chris@16 690
Chris@16 691 //! <b>Requires</b>: !empty()
Chris@16 692 //!
Chris@16 693 //! <b>Effects</b>: Returns a const reference to the first element
Chris@16 694 //! from the beginning of the container.
Chris@16 695 //!
Chris@16 696 //! <b>Throws</b>: Nothing.
Chris@16 697 //!
Chris@16 698 //! <b>Complexity</b>: Constant.
Chris@16 699 const_reference front() const
Chris@16 700 { return *this->begin(); }
Chris@16 701
Chris@16 702 //////////////////////////////////////////////
Chris@16 703 //
Chris@16 704 // modifiers
Chris@16 705 //
Chris@16 706 //////////////////////////////////////////////
Chris@16 707
Chris@101 708 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 709
Chris@16 710 //! <b>Effects</b>: Inserts an object of type T constructed with
Chris@16 711 //! std::forward<Args>(args)... in the front of the list
Chris@16 712 //!
Chris@16 713 //! <b>Throws</b>: If memory allocation throws or
Chris@16 714 //! T's copy constructor throws.
Chris@16 715 //!
Chris@16 716 //! <b>Complexity</b>: Amortized constant time.
Chris@16 717 template <class... Args>
Chris@101 718 void emplace_front(BOOST_FWD_REF(Args)... args)
Chris@16 719 { this->emplace_after(this->cbefore_begin(), boost::forward<Args>(args)...); }
Chris@16 720
Chris@16 721 //! <b>Effects</b>: Inserts an object of type T constructed with
Chris@16 722 //! std::forward<Args>(args)... after prev
Chris@16 723 //!
Chris@16 724 //! <b>Throws</b>: If memory allocation throws or
Chris@16 725 //! T's in-place constructor throws.
Chris@16 726 //!
Chris@16 727 //! <b>Complexity</b>: Constant
Chris@16 728 template <class... Args>
Chris@101 729 iterator emplace_after(const_iterator prev, BOOST_FWD_REF(Args)... args)
Chris@16 730 {
Chris@16 731 NodePtr pnode(AllocHolder::create_node(boost::forward<Args>(args)...));
Chris@16 732 return iterator(this->icont().insert_after(prev.get(), *pnode));
Chris@16 733 }
Chris@16 734
Chris@101 735 #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
Chris@16 736
Chris@101 737 #define BOOST_CONTAINER_SLIST_EMPLACE_CODE(N) \
Chris@101 738 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
Chris@101 739 void emplace_front(BOOST_MOVE_UREF##N)\
Chris@101 740 { this->emplace_after(this->cbefore_begin() BOOST_MOVE_I##N BOOST_MOVE_FWD##N);}\
Chris@101 741 \
Chris@101 742 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
Chris@101 743 iterator emplace_after(const_iterator p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
Chris@101 744 {\
Chris@101 745 NodePtr pnode (AllocHolder::create_node(BOOST_MOVE_FWD##N));\
Chris@101 746 return iterator(this->icont().insert_after(p.get(), *pnode));\
Chris@101 747 }\
Chris@101 748 //
Chris@101 749 BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SLIST_EMPLACE_CODE)
Chris@101 750 #undef BOOST_CONTAINER_SLIST_EMPLACE_CODE
Chris@16 751
Chris@101 752 #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
Chris@16 753
Chris@16 754 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 755 //! <b>Effects</b>: Inserts a copy of x at the beginning of the list.
Chris@16 756 //!
Chris@16 757 //! <b>Throws</b>: If memory allocation throws or
Chris@16 758 //! T's copy constructor throws.
Chris@16 759 //!
Chris@16 760 //! <b>Complexity</b>: Amortized constant time.
Chris@16 761 void push_front(const T &x);
Chris@16 762
Chris@16 763 //! <b>Effects</b>: Constructs a new element in the beginning of the list
Chris@101 764 //! and moves the resources of x to this new element.
Chris@16 765 //!
Chris@16 766 //! <b>Throws</b>: If memory allocation throws.
Chris@16 767 //!
Chris@16 768 //! <b>Complexity</b>: Amortized constant time.
Chris@16 769 void push_front(T &&x);
Chris@16 770 #else
Chris@16 771 BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
Chris@16 772 #endif
Chris@16 773
Chris@16 774
Chris@16 775 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 776 //! <b>Requires</b>: p must be a valid iterator of *this.
Chris@16 777 //!
Chris@101 778 //! <b>Effects</b>: Inserts a copy of the value after prev_p.
Chris@16 779 //!
Chris@16 780 //! <b>Returns</b>: An iterator to the inserted element.
Chris@16 781 //!
Chris@16 782 //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
Chris@16 783 //!
Chris@16 784 //! <b>Complexity</b>: Amortized constant time.
Chris@16 785 //!
Chris@16 786 //! <b>Note</b>: Does not affect the validity of iterators and references of
Chris@16 787 //! previous values.
Chris@101 788 iterator insert_after(const_iterator prev_p, const T &x);
Chris@16 789
Chris@101 790 //! <b>Requires</b>: prev_p must be a valid iterator of *this.
Chris@16 791 //!
Chris@16 792 //! <b>Effects</b>: Inserts a move constructed copy object from the value after the
Chris@101 793 //! p pointed by prev_p.
Chris@16 794 //!
Chris@16 795 //! <b>Returns</b>: An iterator to the inserted element.
Chris@16 796 //!
Chris@16 797 //! <b>Throws</b>: If memory allocation throws.
Chris@16 798 //!
Chris@16 799 //! <b>Complexity</b>: Amortized constant time.
Chris@16 800 //!
Chris@16 801 //! <b>Note</b>: Does not affect the validity of iterators and references of
Chris@16 802 //! previous values.
Chris@101 803 iterator insert_after(const_iterator prev_p, T &&x);
Chris@16 804 #else
Chris@16 805 BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert_after, T, iterator, priv_insert_after, const_iterator, const_iterator)
Chris@16 806 #endif
Chris@16 807
Chris@101 808 //! <b>Requires</b>: prev_p must be a valid iterator of *this.
Chris@16 809 //!
Chris@101 810 //! <b>Effects</b>: Inserts n copies of x after prev_p.
Chris@16 811 //!
Chris@101 812 //! <b>Returns</b>: an iterator to the last inserted element or prev_p if n is 0.
Chris@16 813 //!
Chris@16 814 //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
Chris@16 815 //!
Chris@16 816 //!
Chris@16 817 //! <b>Complexity</b>: Linear to n.
Chris@16 818 //!
Chris@16 819 //! <b>Note</b>: Does not affect the validity of iterators and references of
Chris@16 820 //! previous values.
Chris@101 821 iterator insert_after(const_iterator prev_p, size_type n, const value_type& x)
Chris@16 822 {
Chris@16 823 typedef constant_iterator<value_type, difference_type> cvalue_iterator;
Chris@101 824 return this->insert_after(prev_p, cvalue_iterator(x, n), cvalue_iterator());
Chris@16 825 }
Chris@16 826
Chris@101 827 //! <b>Requires</b>: prev_p must be a valid iterator of *this.
Chris@16 828 //!
Chris@101 829 //! <b>Effects</b>: Inserts the range pointed by [first, last) after prev_p.
Chris@16 830 //!
Chris@101 831 //! <b>Returns</b>: an iterator to the last inserted element or prev_p if first == last.
Chris@16 832 //!
Chris@16 833 //! <b>Throws</b>: If memory allocation throws, T's constructor from a
Chris@16 834 //! dereferenced InpIt throws.
Chris@16 835 //!
Chris@16 836 //! <b>Complexity</b>: Linear to the number of elements inserted.
Chris@16 837 //!
Chris@16 838 //! <b>Note</b>: Does not affect the validity of iterators and references of
Chris@16 839 //! previous values.
Chris@16 840 template <class InpIt>
Chris@101 841 iterator insert_after(const_iterator prev_p, InpIt first, InpIt last
Chris@16 842 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 843 , typename container_detail::enable_if_c
Chris@16 844 < !container_detail::is_convertible<InpIt, size_type>::value
Chris@16 845 && (container_detail::is_input_iterator<InpIt>::value
Chris@101 846 || container_detail::is_same<alloc_version, version_1>::value
Chris@16 847 )
Chris@16 848 >::type * = 0
Chris@16 849 #endif
Chris@16 850 )
Chris@16 851 {
Chris@101 852 iterator ret_it(prev_p.get());
Chris@16 853 for (; first != last; ++first){
Chris@16 854 ret_it = iterator(this->icont().insert_after(ret_it.get(), *this->create_node_from_it(first)));
Chris@16 855 }
Chris@16 856 return ret_it;
Chris@16 857 }
Chris@16 858
Chris@101 859 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
Chris@101 860 //! <b>Requires</b>: prev_p must be a valid iterator of *this.
Chris@101 861 //!
Chris@101 862 //! <b>Effects</b>: Inserts the range pointed by [il.begin(), il.end()) after prev_p.
Chris@101 863 //!
Chris@101 864 //! <b>Returns</b>: an iterator to the last inserted element or prev_p if il.begin() == il.end().
Chris@101 865 //!
Chris@101 866 //! <b>Throws</b>: If memory allocation throws, T's constructor from a
Chris@101 867 //! dereferenced std::initializer_list iterator throws.
Chris@101 868 //!
Chris@101 869 //! <b>Complexity</b>: Linear to the number of elements inserted.
Chris@101 870 //!
Chris@101 871 //! <b>Note</b>: Does not affect the validity of iterators and references of
Chris@101 872 //! previous values.
Chris@101 873 iterator insert_after(const_iterator prev_p, std::initializer_list<value_type> il)
Chris@101 874 {
Chris@101 875 return insert_after(prev_p, il.begin(), il.end());
Chris@101 876 }
Chris@101 877 #endif
Chris@16 878 #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 879 template <class FwdIt>
Chris@16 880 iterator insert_after(const_iterator prev, FwdIt first, FwdIt last
Chris@16 881 , typename container_detail::enable_if_c
Chris@16 882 < !container_detail::is_convertible<FwdIt, size_type>::value
Chris@16 883 && !(container_detail::is_input_iterator<FwdIt>::value
Chris@101 884 || container_detail::is_same<alloc_version, version_1>::value
Chris@16 885 )
Chris@16 886 >::type * = 0
Chris@16 887 )
Chris@16 888 {
Chris@16 889 //Optimized allocation and construction
Chris@16 890 insertion_functor func(this->icont(), prev.get());
Chris@101 891 this->allocate_many_and_construct(first, boost::container::iterator_distance(first, last), func);
Chris@16 892 return iterator(func.inserted_first());
Chris@16 893 }
Chris@16 894 #endif
Chris@16 895
Chris@16 896 //! <b>Effects</b>: Removes the first element from the list.
Chris@16 897 //!
Chris@16 898 //! <b>Throws</b>: Nothing.
Chris@16 899 //!
Chris@16 900 //! <b>Complexity</b>: Amortized constant time.
Chris@16 901 void pop_front()
Chris@16 902 { this->icont().pop_front_and_dispose(Destroyer(this->node_alloc())); }
Chris@16 903
Chris@101 904 //! <b>Effects</b>: Erases the element after the element pointed by prev_p
Chris@16 905 //! of the list.
Chris@16 906 //!
Chris@16 907 //! <b>Returns</b>: the first element remaining beyond the removed elements,
Chris@16 908 //! or end() if no such element exists.
Chris@16 909 //!
Chris@16 910 //! <b>Throws</b>: Nothing.
Chris@16 911 //!
Chris@16 912 //! <b>Complexity</b>: Constant.
Chris@16 913 //!
Chris@16 914 //! <b>Note</b>: Does not invalidate iterators or references to non erased elements.
Chris@101 915 iterator erase_after(const_iterator prev_p)
Chris@16 916 {
Chris@101 917 return iterator(this->icont().erase_after_and_dispose(prev_p.get(), Destroyer(this->node_alloc())));
Chris@16 918 }
Chris@16 919
Chris@16 920 //! <b>Effects</b>: Erases the range (before_first, last) from
Chris@16 921 //! the list.
Chris@16 922 //!
Chris@16 923 //! <b>Returns</b>: the first element remaining beyond the removed elements,
Chris@16 924 //! or end() if no such element exists.
Chris@16 925 //!
Chris@16 926 //! <b>Throws</b>: Nothing.
Chris@16 927 //!
Chris@16 928 //! <b>Complexity</b>: Linear to the number of erased elements.
Chris@16 929 //!
Chris@16 930 //! <b>Note</b>: Does not invalidate iterators or references to non erased elements.
Chris@16 931 iterator erase_after(const_iterator before_first, const_iterator last)
Chris@16 932 {
Chris@16 933 return iterator(this->icont().erase_after_and_dispose(before_first.get(), last.get(), Destroyer(this->node_alloc())));
Chris@16 934 }
Chris@16 935
Chris@16 936 //! <b>Effects</b>: Swaps the contents of *this and x.
Chris@16 937 //!
Chris@16 938 //! <b>Throws</b>: Nothing.
Chris@16 939 //!
Chris@16 940 //! <b>Complexity</b>: Linear to the number of elements on *this and x.
Chris@16 941 void swap(slist& x)
Chris@101 942 BOOST_NOEXCEPT_IF( allocator_traits_type::propagate_on_container_swap::value
Chris@101 943 || allocator_traits_type::is_always_equal::value)
Chris@16 944 { AllocHolder::swap(x); }
Chris@16 945
Chris@16 946 //! <b>Effects</b>: Erases all the elements of the list.
Chris@16 947 //!
Chris@16 948 //! <b>Throws</b>: Nothing.
Chris@16 949 //!
Chris@16 950 //! <b>Complexity</b>: Linear to the number of elements in the list.
Chris@16 951 void clear()
Chris@16 952 { this->icont().clear_and_dispose(Destroyer(this->node_alloc())); }
Chris@16 953
Chris@16 954 //////////////////////////////////////////////
Chris@16 955 //
Chris@16 956 // slist operations
Chris@16 957 //
Chris@16 958 //////////////////////////////////////////////
Chris@16 959
Chris@16 960 //! <b>Requires</b>: p must point to an element contained
Chris@16 961 //! by the list. x != *this
Chris@16 962 //!
Chris@16 963 //! <b>Effects</b>: Transfers all the elements of list x to this list, after the
Chris@16 964 //! the element pointed by p. No destructors or copy constructors are called.
Chris@16 965 //!
Chris@16 966 //! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
Chris@16 967 //! are not equal.
Chris@16 968 //!
Chris@16 969 //! <b>Complexity</b>: Linear to the elements in x.
Chris@16 970 //!
Chris@16 971 //! <b>Note</b>: Iterators of values obtained from list x now point to elements of
Chris@16 972 //! this list. Iterators of this list and all the references are not invalidated.
Chris@101 973 void splice_after(const_iterator prev_p, slist& x) BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 974 {
Chris@16 975 BOOST_ASSERT(this != &x);
Chris@16 976 BOOST_ASSERT(this->node_alloc() == x.node_alloc());
Chris@101 977 this->icont().splice_after(prev_p.get(), x.icont());
Chris@16 978 }
Chris@16 979
Chris@16 980 //! <b>Requires</b>: p must point to an element contained
Chris@16 981 //! by the list. x != *this
Chris@16 982 //!
Chris@16 983 //! <b>Effects</b>: Transfers all the elements of list x to this list, after the
Chris@16 984 //! the element pointed by p. No destructors or copy constructors are called.
Chris@16 985 //!
Chris@16 986 //! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
Chris@16 987 //! are not equal.
Chris@16 988 //!
Chris@16 989 //! <b>Complexity</b>: Linear to the elements in x.
Chris@16 990 //!
Chris@16 991 //! <b>Note</b>: Iterators of values obtained from list x now point to elements of
Chris@16 992 //! this list. Iterators of this list and all the references are not invalidated.
Chris@101 993 void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x) BOOST_NOEXCEPT_OR_NOTHROW
Chris@101 994 { this->splice_after(prev_p, static_cast<slist&>(x)); }
Chris@16 995
Chris@101 996 //! <b>Requires</b>: prev_p must be a valid iterator of this.
Chris@16 997 //! i must point to an element contained in list x.
Chris@16 998 //! this' allocator and x's allocator shall compare equal.
Chris@16 999 //!
Chris@16 1000 //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
Chris@101 1001 //! after the element pointed by prev_p.
Chris@101 1002 //! If prev_p == prev or prev_p == ++prev, this function is a null operation.
Chris@16 1003 //!
Chris@16 1004 //! <b>Throws</b>: Nothing
Chris@16 1005 //!
Chris@16 1006 //! <b>Complexity</b>: Constant.
Chris@16 1007 //!
Chris@16 1008 //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
Chris@16 1009 //! list. Iterators of this list and all the references are not invalidated.
Chris@101 1010 void splice_after(const_iterator prev_p, slist& x, const_iterator prev) BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 1011 {
Chris@16 1012 BOOST_ASSERT(this->node_alloc() == x.node_alloc());
Chris@101 1013 this->icont().splice_after(prev_p.get(), x.icont(), prev.get());
Chris@16 1014 }
Chris@16 1015
Chris@101 1016 //! <b>Requires</b>: prev_p must be a valid iterator of this.
Chris@16 1017 //! i must point to an element contained in list x.
Chris@16 1018 //! this' allocator and x's allocator shall compare equal.
Chris@16 1019 //!
Chris@16 1020 //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
Chris@101 1021 //! after the element pointed by prev_p.
Chris@101 1022 //! If prev_p == prev or prev_p == ++prev, this function is a null operation.
Chris@16 1023 //!
Chris@16 1024 //! <b>Throws</b>: Nothing
Chris@16 1025 //!
Chris@16 1026 //! <b>Complexity</b>: Constant.
Chris@16 1027 //!
Chris@16 1028 //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
Chris@16 1029 //! list. Iterators of this list and all the references are not invalidated.
Chris@101 1030 void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x, const_iterator prev) BOOST_NOEXCEPT_OR_NOTHROW
Chris@101 1031 { this->splice_after(prev_p, static_cast<slist&>(x), prev); }
Chris@16 1032
Chris@101 1033 //! <b>Requires</b>: prev_p must be a valid iterator of this.
Chris@16 1034 //! before_first and before_last must be valid iterators of x.
Chris@101 1035 //! prev_p must not be contained in [before_first, before_last) range.
Chris@16 1036 //! this' allocator and x's allocator shall compare equal.
Chris@16 1037 //!
Chris@16 1038 //! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
Chris@101 1039 //! from list x to this list, after the element pointed by prev_p.
Chris@16 1040 //!
Chris@16 1041 //! <b>Throws</b>: Nothing
Chris@16 1042 //!
Chris@16 1043 //! <b>Complexity</b>: Linear to the number of transferred elements.
Chris@16 1044 //!
Chris@16 1045 //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
Chris@16 1046 //! list. Iterators of this list and all the references are not invalidated.
Chris@101 1047 void splice_after(const_iterator prev_p, slist& x,
Chris@101 1048 const_iterator before_first, const_iterator before_last) BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 1049 {
Chris@16 1050 BOOST_ASSERT(this->node_alloc() == x.node_alloc());
Chris@16 1051 this->icont().splice_after
Chris@101 1052 (prev_p.get(), x.icont(), before_first.get(), before_last.get());
Chris@16 1053 }
Chris@16 1054
Chris@101 1055 //! <b>Requires</b>: prev_p must be a valid iterator of this.
Chris@16 1056 //! before_first and before_last must be valid iterators of x.
Chris@101 1057 //! prev_p must not be contained in [before_first, before_last) range.
Chris@16 1058 //! this' allocator and x's allocator shall compare equal.
Chris@16 1059 //!
Chris@16 1060 //! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
Chris@101 1061 //! from list x to this list, after the element pointed by prev_p.
Chris@16 1062 //!
Chris@16 1063 //! <b>Throws</b>: Nothing
Chris@16 1064 //!
Chris@16 1065 //! <b>Complexity</b>: Linear to the number of transferred elements.
Chris@16 1066 //!
Chris@16 1067 //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
Chris@16 1068 //! list. Iterators of this list and all the references are not invalidated.
Chris@101 1069 void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x,
Chris@101 1070 const_iterator before_first, const_iterator before_last) BOOST_NOEXCEPT_OR_NOTHROW
Chris@101 1071 { this->splice_after(prev_p, static_cast<slist&>(x), before_first, before_last); }
Chris@16 1072
Chris@101 1073 //! <b>Requires</b>: prev_p must be a valid iterator of this.
Chris@16 1074 //! before_first and before_last must be valid iterators of x.
Chris@101 1075 //! prev_p must not be contained in [before_first, before_last) range.
Chris@101 1076 //! n == distance(before_first, before_last).
Chris@16 1077 //! this' allocator and x's allocator shall compare equal.
Chris@16 1078 //!
Chris@16 1079 //! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
Chris@101 1080 //! from list x to this list, after the element pointed by prev_p.
Chris@16 1081 //!
Chris@16 1082 //! <b>Throws</b>: Nothing
Chris@16 1083 //!
Chris@16 1084 //! <b>Complexity</b>: Constant.
Chris@16 1085 //!
Chris@16 1086 //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
Chris@16 1087 //! list. Iterators of this list and all the references are not invalidated.
Chris@101 1088 void splice_after(const_iterator prev_p, slist& x,
Chris@16 1089 const_iterator before_first, const_iterator before_last,
Chris@101 1090 size_type n) BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 1091 {
Chris@16 1092 BOOST_ASSERT(this->node_alloc() == x.node_alloc());
Chris@16 1093 this->icont().splice_after
Chris@101 1094 (prev_p.get(), x.icont(), before_first.get(), before_last.get(), n);
Chris@16 1095 }
Chris@16 1096
Chris@101 1097 //! <b>Requires</b>: prev_p must be a valid iterator of this.
Chris@16 1098 //! before_first and before_last must be valid iterators of x.
Chris@101 1099 //! prev_p must not be contained in [before_first, before_last) range.
Chris@101 1100 //! n == distance(before_first, before_last).
Chris@16 1101 //! this' allocator and x's allocator shall compare equal.
Chris@16 1102 //!
Chris@16 1103 //! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
Chris@101 1104 //! from list x to this list, after the element pointed by prev_p.
Chris@16 1105 //!
Chris@16 1106 //! <b>Throws</b>: Nothing
Chris@16 1107 //!
Chris@16 1108 //! <b>Complexity</b>: Constant.
Chris@16 1109 //!
Chris@16 1110 //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
Chris@16 1111 //! list. Iterators of this list and all the references are not invalidated.
Chris@101 1112 void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x,
Chris@16 1113 const_iterator before_first, const_iterator before_last,
Chris@101 1114 size_type n) BOOST_NOEXCEPT_OR_NOTHROW
Chris@101 1115 { this->splice_after(prev_p, static_cast<slist&>(x), before_first, before_last, n); }
Chris@16 1116
Chris@16 1117 //! <b>Effects</b>: Removes all the elements that compare equal to value.
Chris@16 1118 //!
Chris@16 1119 //! <b>Throws</b>: Nothing.
Chris@16 1120 //!
Chris@16 1121 //! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
Chris@16 1122 //!
Chris@16 1123 //! <b>Note</b>: The relative order of elements that are not removed is unchanged,
Chris@16 1124 //! and iterators to elements that are not removed remain valid.
Chris@16 1125 void remove(const T& value)
Chris@101 1126 { this->remove_if(equal_to_value_type(value)); }
Chris@16 1127
Chris@16 1128 //! <b>Effects</b>: Removes all the elements for which a specified
Chris@16 1129 //! predicate is satisfied.
Chris@16 1130 //!
Chris@16 1131 //! <b>Throws</b>: If pred throws.
Chris@16 1132 //!
Chris@16 1133 //! <b>Complexity</b>: Linear time. It performs exactly size() calls to the predicate.
Chris@16 1134 //!
Chris@16 1135 //! <b>Note</b>: The relative order of elements that are not removed is unchanged,
Chris@16 1136 //! and iterators to elements that are not removed remain valid.
Chris@16 1137 template <class Pred>
Chris@16 1138 void remove_if(Pred pred)
Chris@16 1139 {
Chris@101 1140 typedef value_to_node_compare<Node, Pred> value_to_node_compare_type;
Chris@101 1141 this->icont().remove_and_dispose_if(value_to_node_compare_type(pred), Destroyer(this->node_alloc()));
Chris@16 1142 }
Chris@16 1143
Chris@16 1144 //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
Chris@16 1145 //! elements that are equal from the list.
Chris@16 1146 //!
Chris@16 1147 //! <b>Throws</b>: If comparison throws.
Chris@16 1148 //!
Chris@16 1149 //! <b>Complexity</b>: Linear time (size()-1 comparisons equality comparisons).
Chris@16 1150 //!
Chris@16 1151 //! <b>Note</b>: The relative order of elements that are not removed is unchanged,
Chris@16 1152 //! and iterators to elements that are not removed remain valid.
Chris@16 1153 void unique()
Chris@16 1154 { this->unique(value_equal()); }
Chris@16 1155
Chris@16 1156 //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
Chris@16 1157 //! elements that satisfy some binary predicate from the list.
Chris@16 1158 //!
Chris@16 1159 //! <b>Throws</b>: If pred throws.
Chris@16 1160 //!
Chris@16 1161 //! <b>Complexity</b>: Linear time (size()-1 comparisons calls to pred()).
Chris@16 1162 //!
Chris@16 1163 //! <b>Note</b>: The relative order of elements that are not removed is unchanged,
Chris@16 1164 //! and iterators to elements that are not removed remain valid.
Chris@16 1165 template <class Pred>
Chris@16 1166 void unique(Pred pred)
Chris@16 1167 {
Chris@101 1168 typedef value_to_node_compare<Node, Pred> value_to_node_compare_type;
Chris@101 1169 this->icont().unique_and_dispose(value_to_node_compare_type(pred), Destroyer(this->node_alloc()));
Chris@16 1170 }
Chris@16 1171
Chris@16 1172 //! <b>Requires</b>: The lists x and *this must be distinct.
Chris@16 1173 //!
Chris@16 1174 //! <b>Effects</b>: This function removes all of x's elements and inserts them
Chris@16 1175 //! in order into *this according to std::less<value_type>. The merge is stable;
Chris@16 1176 //! that is, if an element from *this is equivalent to one from x, then the element
Chris@16 1177 //! from *this will precede the one from x.
Chris@16 1178 //!
Chris@16 1179 //! <b>Throws</b>: If comparison throws.
Chris@16 1180 //!
Chris@16 1181 //! <b>Complexity</b>: This function is linear time: it performs at most
Chris@16 1182 //! size() + x.size() - 1 comparisons.
Chris@16 1183 void merge(slist & x)
Chris@16 1184 { this->merge(x, value_less()); }
Chris@16 1185
Chris@16 1186 //! <b>Requires</b>: The lists x and *this must be distinct.
Chris@16 1187 //!
Chris@16 1188 //! <b>Effects</b>: This function removes all of x's elements and inserts them
Chris@16 1189 //! in order into *this according to std::less<value_type>. The merge is stable;
Chris@16 1190 //! that is, if an element from *this is equivalent to one from x, then the element
Chris@16 1191 //! from *this will precede the one from x.
Chris@16 1192 //!
Chris@16 1193 //! <b>Throws</b>: If comparison throws.
Chris@16 1194 //!
Chris@16 1195 //! <b>Complexity</b>: This function is linear time: it performs at most
Chris@16 1196 //! size() + x.size() - 1 comparisons.
Chris@16 1197 void merge(BOOST_RV_REF(slist) x)
Chris@16 1198 { this->merge(static_cast<slist&>(x)); }
Chris@16 1199
Chris@16 1200 //! <b>Requires</b>: p must be a comparison function that induces a strict weak
Chris@16 1201 //! ordering and both *this and x must be sorted according to that ordering
Chris@16 1202 //! The lists x and *this must be distinct.
Chris@16 1203 //!
Chris@16 1204 //! <b>Effects</b>: This function removes all of x's elements and inserts them
Chris@16 1205 //! in order into *this. The merge is stable; that is, if an element from *this is
Chris@16 1206 //! equivalent to one from x, then the element from *this will precede the one from x.
Chris@16 1207 //!
Chris@16 1208 //! <b>Throws</b>: If comp throws.
Chris@16 1209 //!
Chris@16 1210 //! <b>Complexity</b>: This function is linear time: it performs at most
Chris@16 1211 //! size() + x.size() - 1 comparisons.
Chris@16 1212 //!
Chris@16 1213 //! <b>Note</b>: Iterators and references to *this are not invalidated.
Chris@16 1214 template <class StrictWeakOrdering>
Chris@16 1215 void merge(slist& x, StrictWeakOrdering comp)
Chris@16 1216 {
Chris@101 1217 typedef value_to_node_compare<Node, StrictWeakOrdering> value_to_node_compare_type;
Chris@16 1218 BOOST_ASSERT(this->node_alloc() == x.node_alloc());
Chris@101 1219 this->icont().merge(x.icont(), value_to_node_compare_type(comp));
Chris@16 1220 }
Chris@16 1221
Chris@16 1222 //! <b>Requires</b>: p must be a comparison function that induces a strict weak
Chris@16 1223 //! ordering and both *this and x must be sorted according to that ordering
Chris@16 1224 //! The lists x and *this must be distinct.
Chris@16 1225 //!
Chris@16 1226 //! <b>Effects</b>: This function removes all of x's elements and inserts them
Chris@16 1227 //! in order into *this. The merge is stable; that is, if an element from *this is
Chris@16 1228 //! equivalent to one from x, then the element from *this will precede the one from x.
Chris@16 1229 //!
Chris@16 1230 //! <b>Throws</b>: If comp throws.
Chris@16 1231 //!
Chris@16 1232 //! <b>Complexity</b>: This function is linear time: it performs at most
Chris@16 1233 //! size() + x.size() - 1 comparisons.
Chris@16 1234 //!
Chris@16 1235 //! <b>Note</b>: Iterators and references to *this are not invalidated.
Chris@16 1236 template <class StrictWeakOrdering>
Chris@16 1237 void merge(BOOST_RV_REF(slist) x, StrictWeakOrdering comp)
Chris@16 1238 { this->merge(static_cast<slist&>(x), comp); }
Chris@16 1239
Chris@16 1240 //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
Chris@16 1241 //! The sort is stable, that is, the relative order of equivalent elements is preserved.
Chris@16 1242 //!
Chris@16 1243 //! <b>Throws</b>: If comparison throws.
Chris@16 1244 //!
Chris@16 1245 //! <b>Notes</b>: Iterators and references are not invalidated.
Chris@16 1246 //!
Chris@16 1247 //! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
Chris@16 1248 //! is the list's size.
Chris@16 1249 void sort()
Chris@16 1250 { this->sort(value_less()); }
Chris@16 1251
Chris@16 1252 //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
Chris@16 1253 //! The sort is stable, that is, the relative order of equivalent elements is preserved.
Chris@16 1254 //!
Chris@16 1255 //! <b>Throws</b>: If comp throws.
Chris@16 1256 //!
Chris@16 1257 //! <b>Notes</b>: Iterators and references are not invalidated.
Chris@16 1258 //!
Chris@16 1259 //! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
Chris@16 1260 //! is the list's size.
Chris@16 1261 template <class StrictWeakOrdering>
Chris@16 1262 void sort(StrictWeakOrdering comp)
Chris@16 1263 {
Chris@101 1264 typedef value_to_node_compare<Node, StrictWeakOrdering> value_to_node_compare_type;
Chris@16 1265 // nothing if the slist has length 0 or 1.
Chris@16 1266 if (this->size() < 2)
Chris@16 1267 return;
Chris@101 1268 this->icont().sort(value_to_node_compare_type(comp));
Chris@16 1269 }
Chris@16 1270
Chris@16 1271 //! <b>Effects</b>: Reverses the order of elements in the list.
Chris@16 1272 //!
Chris@16 1273 //! <b>Throws</b>: Nothing.
Chris@16 1274 //!
Chris@16 1275 //! <b>Complexity</b>: This function is linear time.
Chris@16 1276 //!
Chris@16 1277 //! <b>Note</b>: Iterators and references are not invalidated
Chris@101 1278 void reverse() BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 1279 { this->icont().reverse(); }
Chris@16 1280
Chris@16 1281 //////////////////////////////////////////////
Chris@16 1282 //
Chris@16 1283 // list compatibility interface
Chris@16 1284 //
Chris@16 1285 //////////////////////////////////////////////
Chris@16 1286
Chris@101 1287 #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 1288
Chris@16 1289 //! <b>Effects</b>: Inserts an object of type T constructed with
Chris@16 1290 //! std::forward<Args>(args)... before p
Chris@16 1291 //!
Chris@16 1292 //! <b>Throws</b>: If memory allocation throws or
Chris@16 1293 //! T's in-place constructor throws.
Chris@16 1294 //!
Chris@16 1295 //! <b>Complexity</b>: Linear to the elements before p
Chris@16 1296 template <class... Args>
Chris@101 1297 iterator emplace(const_iterator p, BOOST_FWD_REF(Args)... args)
Chris@16 1298 { return this->emplace_after(this->previous(p), boost::forward<Args>(args)...); }
Chris@16 1299
Chris@101 1300 #else
Chris@16 1301
Chris@101 1302 #define BOOST_CONTAINER_SLIST_EMPLACE_CODE(N) \
Chris@101 1303 BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
Chris@101 1304 iterator emplace(const_iterator p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
Chris@101 1305 {\
Chris@101 1306 return this->emplace_after(this->previous(p) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
Chris@101 1307 }\
Chris@101 1308 //
Chris@101 1309 BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SLIST_EMPLACE_CODE)
Chris@101 1310 #undef BOOST_CONTAINER_SLIST_EMPLACE_CODE
Chris@101 1311
Chris@101 1312 #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
Chris@16 1313
Chris@16 1314 #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
Chris@16 1315 //! <b>Requires</b>: p must be a valid iterator of *this.
Chris@16 1316 //!
Chris@16 1317 //! <b>Effects</b>: Insert a copy of x before p.
Chris@16 1318 //!
Chris@16 1319 //! <b>Returns</b>: an iterator to the inserted element.
Chris@16 1320 //!
Chris@16 1321 //! <b>Throws</b>: If memory allocation throws or x's copy constructor throws.
Chris@16 1322 //!
Chris@16 1323 //! <b>Complexity</b>: Linear to the elements before p.
Chris@101 1324 iterator insert(const_iterator p, const T &x);
Chris@16 1325
Chris@16 1326 //! <b>Requires</b>: p must be a valid iterator of *this.
Chris@16 1327 //!
Chris@101 1328 //! <b>Effects</b>: Insert a new element before p with x's resources.
Chris@16 1329 //!
Chris@16 1330 //! <b>Returns</b>: an iterator to the inserted element.
Chris@16 1331 //!
Chris@16 1332 //! <b>Throws</b>: If memory allocation throws.
Chris@16 1333 //!
Chris@16 1334 //! <b>Complexity</b>: Linear to the elements before p.
Chris@101 1335 iterator insert(const_iterator prev_p, T &&x);
Chris@16 1336 #else
Chris@16 1337 BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator, const_iterator)
Chris@16 1338 #endif
Chris@16 1339
Chris@16 1340 //! <b>Requires</b>: p must be a valid iterator of *this.
Chris@16 1341 //!
Chris@16 1342 //! <b>Effects</b>: Inserts n copies of x before p.
Chris@16 1343 //!
Chris@16 1344 //! <b>Returns</b>: an iterator to the first inserted element or p if n == 0.
Chris@16 1345 //!
Chris@16 1346 //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
Chris@16 1347 //!
Chris@16 1348 //! <b>Complexity</b>: Linear to n plus linear to the elements before p.
Chris@16 1349 iterator insert(const_iterator p, size_type n, const value_type& x)
Chris@16 1350 {
Chris@16 1351 const_iterator prev(this->previous(p));
Chris@16 1352 this->insert_after(prev, n, x);
Chris@16 1353 return ++iterator(prev.get());
Chris@16 1354 }
Chris@101 1355
Chris@16 1356 //! <b>Requires</b>: p must be a valid iterator of *this.
Chris@16 1357 //!
Chris@16 1358 //! <b>Effects</b>: Insert a copy of the [first, last) range before p.
Chris@16 1359 //!
Chris@16 1360 //! <b>Returns</b>: an iterator to the first inserted element or p if first == last.
Chris@16 1361 //!
Chris@16 1362 //! <b>Throws</b>: If memory allocation throws, T's constructor from a
Chris@16 1363 //! dereferenced InpIt throws.
Chris@16 1364 //!
Chris@101 1365 //! <b>Complexity</b>: Linear to distance [first, last) plus
Chris@16 1366 //! linear to the elements before p.
Chris@16 1367 template <class InIter>
Chris@16 1368 iterator insert(const_iterator p, InIter first, InIter last)
Chris@16 1369 {
Chris@16 1370 const_iterator prev(this->previous(p));
Chris@16 1371 this->insert_after(prev, first, last);
Chris@16 1372 return ++iterator(prev.get());
Chris@16 1373 }
Chris@16 1374
Chris@101 1375 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
Chris@101 1376 //! <b>Requires</b>: p must be a valid iterator of *this.
Chris@101 1377 //!
Chris@101 1378 //! <b>Effects</b>: Insert a copy of the [il.begin(), il.end()) range before p.
Chris@101 1379 //!
Chris@101 1380 //! <b>Returns</b>: an iterator to the first inserted element or p if il.begin() == il.end().
Chris@101 1381 //!
Chris@101 1382 //! <b>Throws</b>: If memory allocation throws, T's constructor from a
Chris@101 1383 //! dereferenced std::initializer_list iterator throws.
Chris@101 1384 //!
Chris@101 1385 //! <b>Complexity</b>: Linear to the range [il.begin(), il.end()) plus
Chris@101 1386 //! linear to the elements before p.
Chris@101 1387 iterator insert(const_iterator p, std::initializer_list<value_type> il)
Chris@101 1388 {
Chris@101 1389 return insert(p, il.begin(), il.end());
Chris@101 1390 }
Chris@101 1391 #endif
Chris@101 1392
Chris@16 1393 //! <b>Requires</b>: p must be a valid iterator of *this.
Chris@16 1394 //!
Chris@16 1395 //! <b>Effects</b>: Erases the element at p p.
Chris@16 1396 //!
Chris@16 1397 //! <b>Throws</b>: Nothing.
Chris@16 1398 //!
Chris@16 1399 //! <b>Complexity</b>: Linear to the number of elements before p.
Chris@101 1400 iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 1401 { return iterator(this->erase_after(previous(p))); }
Chris@16 1402
Chris@16 1403 //! <b>Requires</b>: first and last must be valid iterator to elements in *this.
Chris@16 1404 //!
Chris@16 1405 //! <b>Effects</b>: Erases the elements pointed by [first, last).
Chris@16 1406 //!
Chris@16 1407 //! <b>Throws</b>: Nothing.
Chris@16 1408 //!
Chris@16 1409 //! <b>Complexity</b>: Linear to the distance between first and last plus
Chris@16 1410 //! linear to the elements before first.
Chris@101 1411 iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 1412 { return iterator(this->erase_after(previous(first), last)); }
Chris@16 1413
Chris@16 1414 //! <b>Requires</b>: p must point to an element contained
Chris@16 1415 //! by the list. x != *this. this' allocator and x's allocator shall compare equal
Chris@16 1416 //!
Chris@16 1417 //! <b>Effects</b>: Transfers all the elements of list x to this list, before the
Chris@16 1418 //! the element pointed by p. No destructors or copy constructors are called.
Chris@16 1419 //!
Chris@16 1420 //! <b>Throws</b>: Nothing
Chris@16 1421 //!
Chris@16 1422 //! <b>Complexity</b>: Linear in distance(begin(), p), and linear in x.size().
Chris@16 1423 //!
Chris@16 1424 //! <b>Note</b>: Iterators of values obtained from list x now point to elements of
Chris@16 1425 //! this list. Iterators of this list and all the references are not invalidated.
Chris@101 1426 void splice(const_iterator p, slist& x) BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 1427 { this->splice_after(this->previous(p), x); }
Chris@16 1428
Chris@16 1429 //! <b>Requires</b>: p must point to an element contained
Chris@16 1430 //! by the list. x != *this. this' allocator and x's allocator shall compare equal
Chris@16 1431 //!
Chris@16 1432 //! <b>Effects</b>: Transfers all the elements of list x to this list, before the
Chris@16 1433 //! the element pointed by p. No destructors or copy constructors are called.
Chris@16 1434 //!
Chris@16 1435 //! <b>Throws</b>: Nothing
Chris@16 1436 //!
Chris@16 1437 //! <b>Complexity</b>: Linear in distance(begin(), p), and linear in x.size().
Chris@16 1438 //!
Chris@16 1439 //! <b>Note</b>: Iterators of values obtained from list x now point to elements of
Chris@16 1440 //! this list. Iterators of this list and all the references are not invalidated.
Chris@101 1441 void splice(const_iterator p, BOOST_RV_REF(slist) x) BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 1442 { this->splice(p, static_cast<slist&>(x)); }
Chris@16 1443
Chris@16 1444 //! <b>Requires</b>: p must point to an element contained
Chris@16 1445 //! by this list. i must point to an element contained in list x.
Chris@16 1446 //! this' allocator and x's allocator shall compare equal
Chris@16 1447 //!
Chris@16 1448 //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
Chris@16 1449 //! before the the element pointed by p. No destructors or copy constructors are called.
Chris@16 1450 //! If p == i or p == ++i, this function is a null operation.
Chris@16 1451 //!
Chris@16 1452 //! <b>Throws</b>: Nothing
Chris@16 1453 //!
Chris@16 1454 //! <b>Complexity</b>: Linear in distance(begin(), p), and in distance(x.begin(), i).
Chris@16 1455 //!
Chris@16 1456 //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
Chris@16 1457 //! list. Iterators of this list and all the references are not invalidated.
Chris@101 1458 void splice(const_iterator p, slist& x, const_iterator i) BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 1459 { this->splice_after(this->previous(p), x, this->previous(i)); }
Chris@16 1460
Chris@16 1461 //! <b>Requires</b>: p must point to an element contained
Chris@16 1462 //! by this list. i must point to an element contained in list x.
Chris@16 1463 //! this' allocator and x's allocator shall compare equal.
Chris@16 1464 //!
Chris@16 1465 //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
Chris@16 1466 //! before the the element pointed by p. No destructors or copy constructors are called.
Chris@16 1467 //! If p == i or p == ++i, this function is a null operation.
Chris@16 1468 //!
Chris@16 1469 //! <b>Throws</b>: Nothing
Chris@16 1470 //!
Chris@16 1471 //! <b>Complexity</b>: Linear in distance(begin(), p), and in distance(x.begin(), i).
Chris@16 1472 //!
Chris@16 1473 //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
Chris@16 1474 //! list. Iterators of this list and all the references are not invalidated.
Chris@101 1475 void splice(const_iterator p, BOOST_RV_REF(slist) x, const_iterator i) BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 1476 { this->splice(p, static_cast<slist&>(x), i); }
Chris@16 1477
Chris@16 1478 //! <b>Requires</b>: p must point to an element contained
Chris@16 1479 //! by this list. first and last must point to elements contained in list x.
Chris@16 1480 //!
Chris@16 1481 //! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
Chris@16 1482 //! before the the element pointed by p. No destructors or copy constructors are called.
Chris@16 1483 //! this' allocator and x's allocator shall compare equal.
Chris@16 1484 //!
Chris@16 1485 //! <b>Throws</b>: Nothing
Chris@16 1486 //!
Chris@16 1487 //! <b>Complexity</b>: Linear in distance(begin(), p), in distance(x.begin(), first),
Chris@16 1488 //! and in distance(first, last).
Chris@16 1489 //!
Chris@16 1490 //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
Chris@16 1491 //! list. Iterators of this list and all the references are not invalidated.
Chris@101 1492 void splice(const_iterator p, slist& x, const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 1493 { this->splice_after(this->previous(p), x, this->previous(first), this->previous(last)); }
Chris@16 1494
Chris@16 1495 //! <b>Requires</b>: p must point to an element contained
Chris@16 1496 //! by this list. first and last must point to elements contained in list x.
Chris@16 1497 //! this' allocator and x's allocator shall compare equal
Chris@16 1498 //!
Chris@16 1499 //! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
Chris@16 1500 //! before the the element pointed by p. No destructors or copy constructors are called.
Chris@16 1501 //!
Chris@16 1502 //! <b>Throws</b>: Nothing
Chris@16 1503 //!
Chris@16 1504 //! <b>Complexity</b>: Linear in distance(begin(), p), in distance(x.begin(), first),
Chris@16 1505 //! and in distance(first, last).
Chris@16 1506 //!
Chris@16 1507 //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
Chris@16 1508 //! list. Iterators of this list and all the references are not invalidated.
Chris@101 1509 void splice(const_iterator p, BOOST_RV_REF(slist) x, const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW
Chris@16 1510 { this->splice(p, static_cast<slist&>(x), first, last); }
Chris@16 1511
Chris@101 1512 //! <b>Effects</b>: Returns true if x and y are equal
Chris@101 1513 //!
Chris@101 1514 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 1515 friend bool operator==(const slist& x, const slist& y)
Chris@101 1516 { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); }
Chris@101 1517
Chris@101 1518 //! <b>Effects</b>: Returns true if x and y are unequal
Chris@101 1519 //!
Chris@101 1520 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 1521 friend bool operator!=(const slist& x, const slist& y)
Chris@101 1522 { return !(x == y); }
Chris@101 1523
Chris@101 1524 //! <b>Effects</b>: Returns true if x is less than y
Chris@101 1525 //!
Chris@101 1526 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 1527 friend bool operator<(const slist& x, const slist& y)
Chris@101 1528 { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
Chris@101 1529
Chris@101 1530 //! <b>Effects</b>: Returns true if x is greater than y
Chris@101 1531 //!
Chris@101 1532 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 1533 friend bool operator>(const slist& x, const slist& y)
Chris@101 1534 { return y < x; }
Chris@101 1535
Chris@101 1536 //! <b>Effects</b>: Returns true if x is equal or less than y
Chris@101 1537 //!
Chris@101 1538 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 1539 friend bool operator<=(const slist& x, const slist& y)
Chris@101 1540 { return !(y < x); }
Chris@101 1541
Chris@101 1542 //! <b>Effects</b>: Returns true if x is equal or greater than y
Chris@101 1543 //!
Chris@101 1544 //! <b>Complexity</b>: Linear to the number of elements in the container.
Chris@101 1545 friend bool operator>=(const slist& x, const slist& y)
Chris@101 1546 { return !(x < y); }
Chris@101 1547
Chris@101 1548 //! <b>Effects</b>: x.swap(y)
Chris@101 1549 //!
Chris@101 1550 //! <b>Complexity</b>: Constant.
Chris@101 1551 friend void swap(slist& x, slist& y)
Chris@101 1552 { x.swap(y); }
Chris@101 1553
Chris@101 1554 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 1555 private:
Chris@16 1556
Chris@101 1557 void priv_push_front (const T &x)
Chris@101 1558 { this->insert_after(this->cbefore_begin(), x); }
Chris@16 1559
Chris@16 1560 void priv_push_front (BOOST_RV_REF(T) x)
Chris@101 1561 { this->insert_after(this->cbefore_begin(), ::boost::move(x)); }
Chris@16 1562
Chris@16 1563 bool priv_try_shrink(size_type new_size, const_iterator &last_pos)
Chris@16 1564 {
Chris@16 1565 typename Icont::iterator end_n(this->icont().end()), cur(this->icont().before_begin()), cur_next;
Chris@16 1566 while (++(cur_next = cur) != end_n && new_size > 0){
Chris@16 1567 --new_size;
Chris@16 1568 cur = cur_next;
Chris@16 1569 }
Chris@16 1570 last_pos = const_iterator(cur);
Chris@16 1571 if (cur_next != end_n){
Chris@16 1572 this->erase_after(last_pos, const_iterator(end_n));
Chris@16 1573 return true;
Chris@16 1574 }
Chris@16 1575 else{
Chris@16 1576 return false;
Chris@16 1577 }
Chris@16 1578 }
Chris@16 1579
Chris@16 1580 template<class U>
Chris@16 1581 iterator priv_insert(const_iterator p, BOOST_FWD_REF(U) x)
Chris@16 1582 { return this->insert_after(previous(p), ::boost::forward<U>(x)); }
Chris@16 1583
Chris@16 1584 template<class U>
Chris@101 1585 iterator priv_insert_after(const_iterator prev_p, BOOST_FWD_REF(U) x)
Chris@101 1586 { return iterator(this->icont().insert_after(prev_p.get(), *this->create_node(::boost::forward<U>(x)))); }
Chris@16 1587
Chris@16 1588 class insertion_functor;
Chris@16 1589 friend class insertion_functor;
Chris@16 1590
Chris@16 1591 class insertion_functor
Chris@16 1592 {
Chris@16 1593 Icont &icont_;
Chris@16 1594 typedef typename Icont::iterator iiterator;
Chris@16 1595 typedef typename Icont::const_iterator iconst_iterator;
Chris@16 1596 const iconst_iterator prev_;
Chris@16 1597 iiterator ret_;
Chris@16 1598
Chris@16 1599 public:
Chris@16 1600 insertion_functor(Icont &icont, typename Icont::const_iterator prev)
Chris@16 1601 : icont_(icont), prev_(prev), ret_(prev.unconst())
Chris@16 1602 {}
Chris@16 1603
Chris@16 1604 void operator()(Node &n)
Chris@16 1605 {
Chris@16 1606 ret_ = this->icont_.insert_after(prev_, n);
Chris@16 1607 }
Chris@16 1608
Chris@16 1609 iiterator inserted_first() const
Chris@16 1610 { return ret_; }
Chris@16 1611 };
Chris@16 1612
Chris@16 1613 //Functors for member algorithm defaults
Chris@16 1614 struct value_less
Chris@16 1615 {
Chris@16 1616 bool operator()(const value_type &a, const value_type &b) const
Chris@16 1617 { return a < b; }
Chris@16 1618 };
Chris@16 1619
Chris@16 1620 struct value_equal
Chris@16 1621 {
Chris@16 1622 bool operator()(const value_type &a, const value_type &b) const
Chris@16 1623 { return a == b; }
Chris@16 1624 };
Chris@16 1625
Chris@16 1626 struct value_equal_to_this
Chris@16 1627 {
Chris@16 1628 explicit value_equal_to_this(const value_type &ref)
Chris@16 1629 : m_ref(ref){}
Chris@16 1630
Chris@16 1631 bool operator()(const value_type &val) const
Chris@16 1632 { return m_ref == val; }
Chris@16 1633
Chris@16 1634 const value_type &m_ref;
Chris@16 1635 };
Chris@101 1636 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 1637 };
Chris@16 1638
Chris@16 1639 }}
Chris@16 1640
Chris@101 1641 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 1642
Chris@16 1643 namespace boost {
Chris@16 1644
Chris@16 1645 //!has_trivial_destructor_after_move<> == true_type
Chris@16 1646 //!specialization for optimizations
Chris@16 1647 template <class T, class Allocator>
Chris@16 1648 struct has_trivial_destructor_after_move<boost::container::slist<T, Allocator> >
Chris@101 1649 {
Chris@101 1650 typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
Chris@101 1651 static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
Chris@101 1652 ::boost::has_trivial_destructor_after_move<pointer>::value;
Chris@101 1653 };
Chris@16 1654
Chris@16 1655 namespace container {
Chris@16 1656
Chris@101 1657 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 1658
Chris@16 1659 }} //namespace boost{ namespace container {
Chris@16 1660
Chris@16 1661 // Specialization of insert_iterator so that insertions will be constant
Chris@16 1662 // time rather than linear time.
Chris@16 1663
Chris@101 1664 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 1665
Chris@101 1666 #if defined(__clang__) && defined(_LIBCPP_VERSION)
Chris@101 1667 #define BOOST_CONTAINER_CLANG_INLINE_STD_NS
Chris@101 1668 #pragma GCC diagnostic push
Chris@101 1669 #pragma GCC diagnostic ignored "-Wc++11-extensions"
Chris@101 1670 #endif
Chris@101 1671
Chris@101 1672 BOOST_CONTAINER_STD_NS_BEG
Chris@16 1673
Chris@16 1674 template <class T, class Allocator>
Chris@16 1675 class insert_iterator<boost::container::slist<T, Allocator> >
Chris@16 1676 {
Chris@16 1677 protected:
Chris@16 1678 typedef boost::container::slist<T, Allocator> Container;
Chris@16 1679 Container* container;
Chris@16 1680 typename Container::iterator iter;
Chris@16 1681 public:
Chris@16 1682 typedef Container container_type;
Chris@16 1683 typedef output_iterator_tag iterator_category;
Chris@16 1684 typedef void value_type;
Chris@16 1685 typedef void difference_type;
Chris@16 1686 typedef void pointer;
Chris@16 1687 typedef void reference;
Chris@16 1688
Chris@16 1689 insert_iterator(Container& x,
Chris@16 1690 typename Container::iterator i,
Chris@16 1691 bool is_previous = false)
Chris@16 1692 : container(&x), iter(is_previous ? i : x.previous(i)){ }
Chris@16 1693
Chris@16 1694 insert_iterator<Container>&
Chris@16 1695 operator=(const typename Container::value_type& value)
Chris@16 1696 {
Chris@16 1697 iter = container->insert_after(iter, value);
Chris@16 1698 return *this;
Chris@16 1699 }
Chris@16 1700 insert_iterator<Container>& operator*(){ return *this; }
Chris@16 1701 insert_iterator<Container>& operator++(){ return *this; }
Chris@16 1702 insert_iterator<Container>& operator++(int){ return *this; }
Chris@16 1703 };
Chris@16 1704
Chris@101 1705 BOOST_CONTAINER_STD_NS_END
Chris@16 1706
Chris@101 1707 #ifdef BOOST_CONTAINER_CLANG_INLINE_STD_NS
Chris@101 1708 #pragma GCC diagnostic pop
Chris@101 1709 #undef BOOST_CONTAINER_CLANG_INLINE_STD_NS
Chris@101 1710 #endif //BOOST_CONTAINER_CLANG_INLINE_STD_NS
Chris@101 1711
Chris@101 1712 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
Chris@16 1713
Chris@16 1714 #include <boost/container/detail/config_end.hpp>
Chris@16 1715
Chris@16 1716 #endif // BOOST_CONTAINER_SLIST_HPP