flat_set.hpp 79 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
  4. // Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/container for documentation.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #ifndef BOOST_CONTAINER_FLAT_SET_HPP
  11. #define BOOST_CONTAINER_FLAT_SET_HPP
  12. #ifndef BOOST_CONFIG_HPP
  13. # include <boost/config.hpp>
  14. #endif
  15. #if defined(BOOST_HAS_PRAGMA_ONCE)
  16. # pragma once
  17. #endif
  18. #include <boost/container/detail/config_begin.hpp>
  19. #include <boost/container/detail/workaround.hpp>
  20. // container
  21. #include <boost/container/allocator_traits.hpp>
  22. #include <boost/container/container_fwd.hpp>
  23. #include <boost/container/new_allocator.hpp> //new_allocator
  24. // container/detail
  25. #include <boost/container/detail/flat_tree.hpp>
  26. #include <boost/container/detail/mpl.hpp>
  27. // move
  28. #include <boost/move/traits.hpp>
  29. #include <boost/move/utility_core.hpp>
  30. // move/detail
  31. #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  32. #include <boost/move/detail/fwd_macros.hpp>
  33. #endif
  34. #include <boost/move/detail/move_helpers.hpp>
  35. // intrusive/detail
  36. #include <boost/intrusive/detail/minimal_pair_header.hpp> //pair
  37. #include <boost/intrusive/detail/minimal_less_equal_header.hpp>//less, equal
  38. // std
  39. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  40. #include <initializer_list>
  41. #endif
  42. namespace boost {
  43. namespace container {
  44. #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  45. template <class Key, class Compare, class AllocatorOrContainer>
  46. class flat_multiset;
  47. #endif
  48. //! flat_set is a Sorted Associative Container that stores objects of type Key.
  49. //! It is also a Unique Associative Container, meaning that no two elements are the same.
  50. //!
  51. //! flat_set is similar to std::set but it's implemented by as an ordered sequence container.
  52. //! The underlying sequence container is by default <i>vector</i> but it can also work
  53. //! user-provided vector-like SequenceContainers (like <i>static_vector</i> or <i>small_vector</i>).
  54. //!
  55. //! Using vector-like sequence containers means that inserting a new element into a flat_set might invalidate
  56. //! previous iterators and references (unless that sequence container is <i>stable_vector</i> or a similar
  57. //! container that offers stable pointers and references). Similarly, erasing an element might invalidate
  58. //! iterators and references pointing to elements that come after (their keys are bigger) the erased element.
  59. //!
  60. //! This container provides random-access iterators.
  61. //!
  62. //! \tparam Key is the type to be inserted in the set, which is also the key_type
  63. //! \tparam Compare is the comparison functor used to order keys
  64. //! \tparam AllocatorOrContainer is either:
  65. //! - The allocator to allocate <code>value_type</code>s (e.g. <i>allocator< std::pair<Key, T> > </i>).
  66. //! (in this case <i>sequence_type</i> will be vector<value_type, AllocatorOrContainer>)
  67. //! - The SequenceContainer to be used as the underlying <i>sequence_type</i>. It must be a vector-like
  68. //! sequence container with random-access iterators.
  69. #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
  70. template <class Key, class Compare = std::less<Key>, class AllocatorOrContainer = new_allocator<Key> >
  71. #else
  72. template <class Key, class Compare, class AllocatorOrContainer>
  73. #endif
  74. class flat_set
  75. ///@cond
  76. : public dtl::flat_tree<Key, dtl::identity<Key>, Compare, AllocatorOrContainer>
  77. ///@endcond
  78. {
  79. #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  80. private:
  81. BOOST_COPYABLE_AND_MOVABLE(flat_set)
  82. typedef dtl::flat_tree<Key, dtl::identity<Key>, Compare, AllocatorOrContainer> tree_t;
  83. public:
  84. tree_t &tree()
  85. { return *this; }
  86. const tree_t &tree() const
  87. { return *this; }
  88. #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  89. public:
  90. //////////////////////////////////////////////
  91. //
  92. // types
  93. //
  94. //////////////////////////////////////////////
  95. typedef Key key_type;
  96. typedef Compare key_compare;
  97. typedef Key value_type;
  98. typedef typename BOOST_CONTAINER_IMPDEF(tree_t::sequence_type) sequence_type;
  99. typedef typename sequence_type::allocator_type allocator_type;
  100. typedef ::boost::container::allocator_traits<allocator_type> allocator_traits_type;
  101. typedef typename sequence_type::pointer pointer;
  102. typedef typename sequence_type::const_pointer const_pointer;
  103. typedef typename sequence_type::reference reference;
  104. typedef typename sequence_type::const_reference const_reference;
  105. typedef typename sequence_type::size_type size_type;
  106. typedef typename sequence_type::difference_type difference_type;
  107. typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type) stored_allocator_type;
  108. typedef typename BOOST_CONTAINER_IMPDEF(tree_t::value_compare) value_compare;
  109. typedef typename sequence_type::iterator iterator;
  110. typedef typename sequence_type::const_iterator const_iterator;
  111. typedef typename sequence_type::reverse_iterator reverse_iterator;
  112. typedef typename sequence_type::const_reverse_iterator const_reverse_iterator;
  113. public:
  114. //////////////////////////////////////////////
  115. //
  116. // construct/copy/destroy
  117. //
  118. //////////////////////////////////////////////
  119. //! <b>Effects</b>: Default constructs an empty container.
  120. //!
  121. //! <b>Complexity</b>: Constant.
  122. BOOST_CONTAINER_FORCEINLINE
  123. flat_set() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<AllocatorOrContainer>::value &&
  124. dtl::is_nothrow_default_constructible<Compare>::value)
  125. : tree_t()
  126. {}
  127. //! <b>Effects</b>: Constructs an empty container using the specified
  128. //! comparison object.
  129. //!
  130. //! <b>Complexity</b>: Constant.
  131. BOOST_CONTAINER_FORCEINLINE
  132. explicit flat_set(const Compare& comp)
  133. : tree_t(comp)
  134. {}
  135. //! <b>Effects</b>: Constructs an empty container using the specified allocator.
  136. //!
  137. //! <b>Complexity</b>: Constant.
  138. BOOST_CONTAINER_FORCEINLINE
  139. explicit flat_set(const allocator_type& a)
  140. : tree_t(a)
  141. {}
  142. //! <b>Effects</b>: Constructs an empty container using the specified
  143. //! comparison object and allocator.
  144. //!
  145. //! <b>Complexity</b>: Constant.
  146. BOOST_CONTAINER_FORCEINLINE
  147. flat_set(const Compare& comp, const allocator_type& a)
  148. : tree_t(comp, a)
  149. {}
  150. //! <b>Effects</b>: Constructs an empty container and
  151. //! inserts elements from the range [first ,last ).
  152. //!
  153. //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
  154. //! comp and otherwise N logN, where N is last - first.
  155. template <class InputIterator>
  156. BOOST_CONTAINER_FORCEINLINE
  157. flat_set(InputIterator first, InputIterator last)
  158. : tree_t(true, first, last)
  159. {}
  160. //! <b>Effects</b>: Constructs an empty container using the specified
  161. //! allocator, and inserts elements from the range [first ,last ).
  162. //!
  163. //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
  164. //! comp and otherwise N logN, where N is last - first.
  165. template <class InputIterator>
  166. BOOST_CONTAINER_FORCEINLINE
  167. flat_set(InputIterator first, InputIterator last, const allocator_type& a)
  168. : tree_t(true, first, last, a)
  169. {}
  170. //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
  171. //! inserts elements from the range [first ,last ).
  172. //!
  173. //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
  174. //! comp and otherwise N logN, where N is last - first.
  175. template <class InputIterator>
  176. BOOST_CONTAINER_FORCEINLINE
  177. flat_set(InputIterator first, InputIterator last, const Compare& comp)
  178. : tree_t(true, first, last, comp)
  179. {}
  180. //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
  181. //! allocator, and inserts elements from the range [first ,last ).
  182. //!
  183. //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
  184. //! comp and otherwise N logN, where N is last - first.
  185. template <class InputIterator>
  186. BOOST_CONTAINER_FORCEINLINE
  187. flat_set(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
  188. : tree_t(true, first, last, comp, a)
  189. {}
  190. //! <b>Effects</b>: Constructs an empty container and
  191. //! inserts elements from the ordered unique range [first ,last). This function
  192. //! is more efficient than the normal range creation for ordered ranges.
  193. //!
  194. //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
  195. //! unique values.
  196. //!
  197. //! <b>Complexity</b>: Linear in N.
  198. //!
  199. //! <b>Note</b>: Non-standard extension.
  200. template <class InputIterator>
  201. BOOST_CONTAINER_FORCEINLINE
  202. flat_set(ordered_unique_range_t, InputIterator first, InputIterator last)
  203. : tree_t(ordered_unique_range, first, last)
  204. {}
  205. //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
  206. //! inserts elements from the ordered unique range [first ,last). This function
  207. //! is more efficient than the normal range creation for ordered ranges.
  208. //!
  209. //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
  210. //! unique values.
  211. //!
  212. //! <b>Complexity</b>: Linear in N.
  213. //!
  214. //! <b>Note</b>: Non-standard extension.
  215. template <class InputIterator>
  216. BOOST_CONTAINER_FORCEINLINE
  217. flat_set(ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp)
  218. : tree_t(ordered_unique_range, first, last, comp)
  219. {}
  220. //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
  221. //! allocator, and inserts elements from the ordered unique range [first ,last). This function
  222. //! is more efficient than the normal range creation for ordered ranges.
  223. //!
  224. //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
  225. //! unique values.
  226. //!
  227. //! <b>Complexity</b>: Linear in N.
  228. //!
  229. //! <b>Note</b>: Non-standard extension.
  230. template <class InputIterator>
  231. BOOST_CONTAINER_FORCEINLINE
  232. flat_set(ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
  233. : tree_t(ordered_unique_range, first, last, comp, a)
  234. {}
  235. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  236. //! <b>Effects</b>: Constructs an empty container and
  237. //! inserts elements from the range [il.begin(), il.end()).
  238. //!
  239. //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using
  240. //! comp and otherwise N logN, where N is il.begin() - il.end().
  241. BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il)
  242. : tree_t(true, il.begin(), il.end())
  243. {}
  244. //! <b>Effects</b>: Constructs an empty container using the specified
  245. //! allocator, and inserts elements from the range [il.begin(), il.end()).
  246. //!
  247. //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using
  248. //! comp and otherwise N logN, where N is il.begin() - il.end().
  249. BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il, const allocator_type& a)
  250. : tree_t(true, il.begin(), il.end(), a)
  251. {}
  252. //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
  253. //! inserts elements from the range [il.begin(), il.end()).
  254. //!
  255. //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using
  256. //! comp and otherwise N logN, where N is il.begin() - il.end().
  257. BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il, const Compare& comp)
  258. : tree_t(true, il.begin(), il.end(), comp)
  259. {}
  260. //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
  261. //! allocator, and inserts elements from the range [il.begin(), il.end()).
  262. //!
  263. //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using
  264. //! comp and otherwise N logN, where N is il.begin() - il.end().
  265. BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
  266. : tree_t(true, il.begin(), il.end(), comp, a)
  267. {}
  268. //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
  269. //! inserts elements from the ordered unique range [il.begin(), il.end()). This function
  270. //! is more efficient than the normal range creation for ordered ranges.
  271. //!
  272. //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
  273. //! unique values.
  274. //!
  275. //! <b>Complexity</b>: Linear in N.
  276. //!
  277. //! <b>Note</b>: Non-standard extension.
  278. BOOST_CONTAINER_FORCEINLINE flat_set(ordered_unique_range_t, std::initializer_list<value_type> il)
  279. : tree_t(ordered_unique_range, il.begin(), il.end())
  280. {}
  281. //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
  282. //! inserts elements from the ordered unique range [il.begin(), il.end()). This function
  283. //! is more efficient than the normal range creation for ordered ranges.
  284. //!
  285. //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
  286. //! unique values.
  287. //!
  288. //! <b>Complexity</b>: Linear in N.
  289. //!
  290. //! <b>Note</b>: Non-standard extension.
  291. BOOST_CONTAINER_FORCEINLINE flat_set(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp)
  292. : tree_t(ordered_unique_range, il.begin(), il.end(), comp)
  293. {}
  294. //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
  295. //! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function
  296. //! is more efficient than the normal range creation for ordered ranges.
  297. //!
  298. //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
  299. //! unique values.
  300. //!
  301. //! <b>Complexity</b>: Linear in N.
  302. //!
  303. //! <b>Note</b>: Non-standard extension.
  304. BOOST_CONTAINER_FORCEINLINE flat_set(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
  305. : tree_t(ordered_unique_range, il.begin(), il.end(), comp, a)
  306. {}
  307. #endif
  308. //! <b>Effects</b>: Copy constructs the container.
  309. //!
  310. //! <b>Complexity</b>: Linear in x.size().
  311. BOOST_CONTAINER_FORCEINLINE flat_set(const flat_set& x)
  312. : tree_t(static_cast<const tree_t&>(x))
  313. {}
  314. //! <b>Effects</b>: Move constructs thecontainer. Constructs *this using x's resources.
  315. //!
  316. //! <b>Complexity</b>: Constant.
  317. //!
  318. //! <b>Postcondition</b>: x is emptied.
  319. BOOST_CONTAINER_FORCEINLINE flat_set(BOOST_RV_REF(flat_set) x)
  320. BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<Compare>::value)
  321. : tree_t(BOOST_MOVE_BASE(tree_t, x))
  322. {}
  323. //! <b>Effects</b>: Copy constructs a container using the specified allocator.
  324. //!
  325. //! <b>Complexity</b>: Linear in x.size().
  326. BOOST_CONTAINER_FORCEINLINE flat_set(const flat_set& x, const allocator_type &a)
  327. : tree_t(static_cast<const tree_t&>(x), a)
  328. {}
  329. //! <b>Effects</b>: Move constructs a container using the specified allocator.
  330. //! Constructs *this using x's resources.
  331. //!
  332. //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise
  333. BOOST_CONTAINER_FORCEINLINE flat_set(BOOST_RV_REF(flat_set) x, const allocator_type &a)
  334. : tree_t(BOOST_MOVE_BASE(tree_t, x), a)
  335. {}
  336. //! <b>Effects</b>: Makes *this a copy of x.
  337. //!
  338. //! <b>Complexity</b>: Linear in x.size().
  339. BOOST_CONTAINER_FORCEINLINE flat_set& operator=(BOOST_COPY_ASSIGN_REF(flat_set) x)
  340. { return static_cast<flat_set&>(this->tree_t::operator=(static_cast<const tree_t&>(x))); }
  341. //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment
  342. //! is false and (allocation throws or value_type's move constructor throws)
  343. //!
  344. //! <b>Complexity</b>: Constant if allocator_traits_type::
  345. //! propagate_on_container_move_assignment is true or
  346. //! this->get>allocator() == x.get_allocator(). Linear otherwise.
  347. BOOST_CONTAINER_FORCEINLINE flat_set& operator=(BOOST_RV_REF(flat_set) x)
  348. BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value ||
  349. allocator_traits_type::is_always_equal::value) &&
  350. boost::container::dtl::is_nothrow_move_assignable<Compare>::value)
  351. { return static_cast<flat_set&>(this->tree_t::operator=(BOOST_MOVE_BASE(tree_t, x))); }
  352. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  353. //! <b>Effects</b>: Copy all elements from il to *this.
  354. //!
  355. //! <b>Complexity</b>: Linear in il.size().
  356. flat_set& operator=(std::initializer_list<value_type> il)
  357. {
  358. this->clear();
  359. this->insert(il.begin(), il.end());
  360. return *this;
  361. }
  362. #endif
  363. #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
  364. //! <b>Effects</b>: Returns a copy of the allocator that
  365. //! was passed to the object's constructor.
  366. //!
  367. //! <b>Complexity</b>: Constant.
  368. allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW;
  369. //! <b>Effects</b>: Returns a reference to the internal allocator.
  370. //!
  371. //! <b>Throws</b>: Nothing
  372. //!
  373. //! <b>Complexity</b>: Constant.
  374. //!
  375. //! <b>Note</b>: Non-standard extension.
  376. stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW;
  377. //! <b>Effects</b>: Returns a reference to the internal allocator.
  378. //!
  379. //! <b>Throws</b>: Nothing
  380. //!
  381. //! <b>Complexity</b>: Constant.
  382. //!
  383. //! <b>Note</b>: Non-standard extension.
  384. const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW;
  385. //! <b>Effects</b>: Returns an iterator to the first element contained in the container.
  386. //!
  387. //! <b>Throws</b>: Nothing.
  388. //!
  389. //! <b>Complexity</b>: Constant.
  390. iterator begin() BOOST_NOEXCEPT_OR_NOTHROW;
  391. //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
  392. //!
  393. //! <b>Throws</b>: Nothing.
  394. //!
  395. //! <b>Complexity</b>: Constant.
  396. const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW;
  397. //! <b>Effects</b>: Returns an iterator to the end of the container.
  398. //!
  399. //! <b>Throws</b>: Nothing.
  400. //!
  401. //! <b>Complexity</b>: Constant.
  402. iterator end() BOOST_NOEXCEPT_OR_NOTHROW;
  403. //! <b>Effects</b>: Returns a const_iterator to the end of the container.
  404. //!
  405. //! <b>Throws</b>: Nothing.
  406. //!
  407. //! <b>Complexity</b>: Constant.
  408. const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW;
  409. //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
  410. //! of the reversed container.
  411. //!
  412. //! <b>Throws</b>: Nothing.
  413. //!
  414. //! <b>Complexity</b>: Constant.
  415. reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW;
  416. //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
  417. //! of the reversed container.
  418. //!
  419. //! <b>Throws</b>: Nothing.
  420. //!
  421. //! <b>Complexity</b>: Constant.
  422. const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
  423. //! <b>Effects</b>: Returns a reverse_iterator pointing to the end
  424. //! of the reversed container.
  425. //!
  426. //! <b>Throws</b>: Nothing.
  427. //!
  428. //! <b>Complexity</b>: Constant.
  429. reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW;
  430. //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
  431. //! of the reversed container.
  432. //!
  433. //! <b>Throws</b>: Nothing.
  434. //!
  435. //! <b>Complexity</b>: Constant.
  436. const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW;
  437. //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
  438. //!
  439. //! <b>Throws</b>: Nothing.
  440. //!
  441. //! <b>Complexity</b>: Constant.
  442. const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
  443. //! <b>Effects</b>: Returns a const_iterator to the end of the container.
  444. //!
  445. //! <b>Throws</b>: Nothing.
  446. //!
  447. //! <b>Complexity</b>: Constant.
  448. const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW;
  449. //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
  450. //! of the reversed container.
  451. //!
  452. //! <b>Throws</b>: Nothing.
  453. //!
  454. //! <b>Complexity</b>: Constant.
  455. const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
  456. //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
  457. //! of the reversed container.
  458. //!
  459. //! <b>Throws</b>: Nothing.
  460. //!
  461. //! <b>Complexity</b>: Constant.
  462. const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW;
  463. //! <b>Effects</b>: Returns true if the container contains no elements.
  464. //!
  465. //! <b>Throws</b>: Nothing.
  466. //!
  467. //! <b>Complexity</b>: Constant.
  468. bool empty() const BOOST_NOEXCEPT_OR_NOTHROW;
  469. //! <b>Effects</b>: Returns the number of the elements contained in the container.
  470. //!
  471. //! <b>Throws</b>: Nothing.
  472. //!
  473. //! <b>Complexity</b>: Constant.
  474. size_type size() const BOOST_NOEXCEPT_OR_NOTHROW;
  475. //! <b>Effects</b>: Returns the largest possible size of the container.
  476. //!
  477. //! <b>Throws</b>: Nothing.
  478. //!
  479. //! <b>Complexity</b>: Constant.
  480. size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW;
  481. //! <b>Effects</b>: Number of elements for which memory has been allocated.
  482. //! capacity() is always greater than or equal to size().
  483. //!
  484. //! <b>Throws</b>: Nothing.
  485. //!
  486. //! <b>Complexity</b>: Constant.
  487. size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW;
  488. //! <b>Effects</b>: If n is less than or equal to capacity(), or the
  489. //! underlying container has no `reserve` member, this call has no
  490. //! effect. Otherwise, it is a request for allocation of additional memory.
  491. //! If the request is successful, then capacity() is greater than or equal to
  492. //! n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
  493. //!
  494. //! <b>Throws</b>: If memory allocation allocation throws or T's copy constructor throws.
  495. //!
  496. //! <b>Note</b>: If capacity() is less than "cnt", iterators and references to
  497. //! to values might be invalidated.
  498. void reserve(size_type cnt);
  499. //! <b>Effects</b>: Tries to deallocate the excess of memory created
  500. // with previous allocations. The size of the vector is unchanged
  501. //!
  502. //! <b>Throws</b>: If memory allocation throws, or Key's copy constructor throws.
  503. //!
  504. //! <b>Complexity</b>: Linear to size().
  505. void shrink_to_fit();
  506. #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  507. //////////////////////////////////////////////
  508. //
  509. // modifiers
  510. //
  511. //////////////////////////////////////////////
  512. #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  513. //! <b>Effects</b>: Inserts an object x of type Key constructed with
  514. //! std::forward<Args>(args)... if and only if there is no element in the container
  515. //! with key equivalent to the key of x.
  516. //!
  517. //! <b>Returns</b>: The bool component of the returned pair is true if and only
  518. //! if the insertion takes place, and the iterator component of the pair
  519. //! points to the element with key equivalent to the key of x.
  520. //!
  521. //! <b>Complexity</b>: Logarithmic search time plus linear insertion
  522. //! to the elements with bigger keys than x.
  523. //!
  524. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  525. template <class... Args>
  526. BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_FWD_REF(Args)... args)
  527. { return this->tree_t::emplace_unique(boost::forward<Args>(args)...); }
  528. //! <b>Effects</b>: Inserts an object of type Key constructed with
  529. //! std::forward<Args>(args)... in the container if and only if there is
  530. //! no element in the container with key equivalent to the key of x.
  531. //! p is a hint pointing to where the insert should start to search.
  532. //!
  533. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  534. //! to the key of x.
  535. //!
  536. //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
  537. //! right before p) plus insertion linear to the elements with bigger keys than x.
  538. //!
  539. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  540. template <class... Args>
  541. BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args)
  542. { return this->tree_t::emplace_hint_unique(p, boost::forward<Args>(args)...); }
  543. #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  544. #define BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE(N) \
  545. BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
  546. BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_MOVE_UREF##N)\
  547. { return this->tree_t::emplace_unique(BOOST_MOVE_FWD##N); }\
  548. \
  549. BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
  550. BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
  551. { return this->tree_t::emplace_hint_unique(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
  552. //
  553. BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE)
  554. #undef BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE
  555. #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  556. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  557. //! <b>Effects</b>: Inserts x if and only if there is no element in the container
  558. //! with key equivalent to the key of x.
  559. //!
  560. //! <b>Returns</b>: The bool component of the returned pair is true if and only
  561. //! if the insertion takes place, and the iterator component of the pair
  562. //! points to the element with key equivalent to the key of x.
  563. //!
  564. //! <b>Complexity</b>: Logarithmic search time plus linear insertion
  565. //! to the elements with bigger keys than x.
  566. //!
  567. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  568. std::pair<iterator, bool> insert(const value_type &x);
  569. //! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
  570. //! only if there is no element in the container with key equivalent to the key of x.
  571. //!
  572. //! <b>Returns</b>: The bool component of the returned pair is true if and only
  573. //! if the insertion takes place, and the iterator component of the pair
  574. //! points to the element with key equivalent to the key of x.
  575. //!
  576. //! <b>Complexity</b>: Logarithmic search time plus linear insertion
  577. //! to the elements with bigger keys than x.
  578. //!
  579. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  580. std::pair<iterator, bool> insert(value_type &&x);
  581. #else
  582. private:
  583. typedef std::pair<iterator, bool> insert_return_pair;
  584. public:
  585. BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, insert_return_pair, this->priv_insert)
  586. #endif
  587. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  588. //! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
  589. //! no element in the container with key equivalent to the key of x.
  590. //! p is a hint pointing to where the insert should start to search.
  591. //!
  592. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  593. //! to the key of x.
  594. //!
  595. //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
  596. //! right before p) plus insertion linear to the elements with bigger keys than x.
  597. //!
  598. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  599. iterator insert(const_iterator p, const value_type &x);
  600. //! <b>Effects</b>: Inserts an element move constructed from x in the container.
  601. //! p is a hint pointing to where the insert should start to search.
  602. //!
  603. //! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
  604. //!
  605. //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
  606. //! right before p) plus insertion linear to the elements with bigger keys than x.
  607. //!
  608. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  609. iterator insert(const_iterator p, value_type &&x);
  610. #else
  611. BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator)
  612. #endif
  613. //! <b>Requires</b>: first, last are not iterators into *this.
  614. //!
  615. //! <b>Effects</b>: inserts each element from the range [first,last) if and only
  616. //! if there is no element with key equivalent to the key of that element.
  617. //!
  618. //! <b>Complexity</b>: N log(N).
  619. //!
  620. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  621. template <class InputIterator>
  622. BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last)
  623. { this->tree_t::insert_unique(first, last); }
  624. //! <b>Requires</b>: first, last are not iterators into *this and
  625. //! must be ordered according to the predicate and must be
  626. //! unique values.
  627. //!
  628. //! <b>Effects</b>: inserts each element from the range [first,last) .This function
  629. //! is more efficient than the normal range creation for ordered ranges.
  630. //!
  631. //! <b>Complexity</b>: Linear.
  632. //!
  633. //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
  634. template <class InputIterator>
  635. BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, InputIterator first, InputIterator last)
  636. { this->tree_t::insert_unique(ordered_unique_range, first, last); }
  637. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  638. //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) if and only
  639. //! if there is no element with key equivalent to the key of that element.
  640. //!
  641. //! <b>Complexity</b>: N log(N).
  642. //!
  643. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  644. BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il)
  645. { this->tree_t::insert_unique(il.begin(), il.end()); }
  646. //! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate
  647. //! and must be unique values.
  648. //!
  649. //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) .This function
  650. //! is more efficient than the normal range creation for ordered ranges.
  651. //!
  652. //! <b>Complexity</b>: Linear.
  653. //!
  654. //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
  655. BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, std::initializer_list<value_type> il)
  656. { this->tree_t::insert_unique(ordered_unique_range, il.begin(), il.end()); }
  657. #endif
  658. //! @copydoc ::boost::container::flat_map::merge(flat_map<Key, T, C2, AllocatorOrContainer>&)
  659. template<class C2>
  660. BOOST_CONTAINER_FORCEINLINE void merge(flat_set<Key, C2, AllocatorOrContainer>& source)
  661. { this->tree_t::merge_unique(source.tree()); }
  662. //! @copydoc ::boost::container::flat_set::merge(flat_set<Key, C2, AllocatorOrContainer>&)
  663. template<class C2>
  664. BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_set<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source)
  665. { return this->merge(static_cast<flat_set<Key, C2, AllocatorOrContainer>&>(source)); }
  666. //! @copydoc ::boost::container::flat_map::merge(flat_multimap<Key, T, C2, AllocatorOrContainer>&)
  667. template<class C2>
  668. BOOST_CONTAINER_FORCEINLINE void merge(flat_multiset<Key, C2, AllocatorOrContainer>& source)
  669. { this->tree_t::merge_unique(source.tree()); }
  670. //! @copydoc ::boost::container::flat_set::merge(flat_multiset<Key, C2, AllocatorOrContainer>&)
  671. template<class C2>
  672. BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multiset<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source)
  673. { return this->merge(static_cast<flat_multiset<Key, C2, AllocatorOrContainer>&>(source)); }
  674. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  675. //! <b>Effects</b>: Erases the element pointed to by p.
  676. //!
  677. //! <b>Returns</b>: Returns an iterator pointing to the element immediately
  678. //! following q prior to the element being erased. If no such element exists,
  679. //! returns end().
  680. //!
  681. //! <b>Complexity</b>: Linear to the elements with keys bigger than p
  682. //!
  683. //! <b>Note</b>: Invalidates elements with keys
  684. //! not less than the erased element.
  685. iterator erase(const_iterator p);
  686. //! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
  687. //!
  688. //! <b>Returns</b>: Returns the number of erased elements.
  689. //!
  690. //! <b>Complexity</b>: Logarithmic search time plus erasure time
  691. //! linear to the elements with bigger keys.
  692. size_type erase(const key_type& x);
  693. //! <b>Effects</b>: Erases all the elements in the range [first, last).
  694. //!
  695. //! <b>Returns</b>: Returns last.
  696. //!
  697. //! <b>Complexity</b>: size()*N where N is the distance from first to last.
  698. //!
  699. //! <b>Complexity</b>: Logarithmic search time plus erasure time
  700. //! linear to the elements with bigger keys.
  701. iterator erase(const_iterator first, const_iterator last);
  702. //! <b>Effects</b>: Swaps the contents of *this and x.
  703. //!
  704. //! <b>Throws</b>: Nothing.
  705. //!
  706. //! <b>Complexity</b>: Constant.
  707. void swap(flat_set& x)
  708. BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
  709. && boost::container::dtl::is_nothrow_swappable<Compare>::value );
  710. //! <b>Effects</b>: erase(a.begin(),a.end()).
  711. //!
  712. //! <b>Postcondition</b>: size() == 0.
  713. //!
  714. //! <b>Complexity</b>: linear in size().
  715. void clear() BOOST_NOEXCEPT_OR_NOTHROW;
  716. //! <b>Effects</b>: Returns the comparison object out
  717. //! of which a was constructed.
  718. //!
  719. //! <b>Complexity</b>: Constant.
  720. key_compare key_comp() const;
  721. //! <b>Effects</b>: Returns an object of value_compare constructed out
  722. //! of the comparison object.
  723. //!
  724. //! <b>Complexity</b>: Constant.
  725. value_compare value_comp() const;
  726. //! <b>Returns</b>: An iterator pointing to an element with the key
  727. //! equivalent to x, or end() if such an element is not found.
  728. //!
  729. //! <b>Complexity</b>: Logarithmic.
  730. iterator find(const key_type& x);
  731. //! <b>Returns</b>: A const_iterator pointing to an element with the key
  732. //! equivalent to x, or end() if such an element is not found.
  733. //!
  734. //! <b>Complexity</b>: Logarithmic.
  735. const_iterator find(const key_type& x) const;
  736. //! <b>Requires</b>: This overload is available only if
  737. //! key_compare::is_transparent exists.
  738. //!
  739. //! <b>Returns</b>: An iterator pointing to an element with the key
  740. //! equivalent to x, or end() if such an element is not found.
  741. //!
  742. //! <b>Complexity</b>: Logarithmic.
  743. template<typename K>
  744. iterator find(const K& x);
  745. //! <b>Requires</b>: This overload is available only if
  746. //! key_compare::is_transparent exists.
  747. //!
  748. //! <b>Returns</b>: A const_iterator pointing to an element with the key
  749. //! equivalent to x, or end() if such an element is not found.
  750. //!
  751. //! <b>Complexity</b>: Logarithmic.
  752. template<typename K>
  753. const_iterator find(const K& x) const;
  754. //! <b>Requires</b>: size() >= n.
  755. //!
  756. //! <b>Effects</b>: Returns an iterator to the nth element
  757. //! from the beginning of the container. Returns end()
  758. //! if n == size().
  759. //!
  760. //! <b>Throws</b>: Nothing.
  761. //!
  762. //! <b>Complexity</b>: Constant.
  763. //!
  764. //! <b>Note</b>: Non-standard extension
  765. iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW;
  766. //! <b>Requires</b>: size() >= n.
  767. //!
  768. //! <b>Effects</b>: Returns a const_iterator to the nth element
  769. //! from the beginning of the container. Returns end()
  770. //! if n == size().
  771. //!
  772. //! <b>Throws</b>: Nothing.
  773. //!
  774. //! <b>Complexity</b>: Constant.
  775. //!
  776. //! <b>Note</b>: Non-standard extension
  777. const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW;
  778. //! <b>Requires</b>: begin() <= p <= end().
  779. //!
  780. //! <b>Effects</b>: Returns the index of the element pointed by p
  781. //! and size() if p == end().
  782. //!
  783. //! <b>Throws</b>: Nothing.
  784. //!
  785. //! <b>Complexity</b>: Constant.
  786. //!
  787. //! <b>Note</b>: Non-standard extension
  788. size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW;
  789. //! <b>Requires</b>: begin() <= p <= end().
  790. //!
  791. //! <b>Effects</b>: Returns the index of the element pointed by p
  792. //! and size() if p == end().
  793. //!
  794. //! <b>Throws</b>: Nothing.
  795. //!
  796. //! <b>Complexity</b>: Constant.
  797. //!
  798. //! <b>Note</b>: Non-standard extension
  799. size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW;
  800. #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  801. //! <b>Returns</b>: The number of elements with key equivalent to x.
  802. //!
  803. //! <b>Complexity</b>: log(size())+count(k)
  804. BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const
  805. { return static_cast<size_type>(this->tree_t::find(x) != this->tree_t::cend()); }
  806. //! <b>Requires</b>: This overload is available only if
  807. //! key_compare::is_transparent exists.
  808. //!
  809. //! <b>Returns</b>: The number of elements with key equivalent to x.
  810. //!
  811. //! <b>Complexity</b>: log(size())+count(k)
  812. template<typename K>
  813. BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const
  814. { return static_cast<size_type>(this->tree_t::find(x) != this->tree_t::cend()); }
  815. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  816. //! <b>Returns</b>: An iterator pointing to the first element with key not less
  817. //! than k, or a.end() if such an element is not found.
  818. //!
  819. //! <b>Complexity</b>: Logarithmic
  820. iterator lower_bound(const key_type& x);
  821. //! <b>Returns</b>: A const iterator pointing to the first element with key not
  822. //! less than k, or a.end() if such an element is not found.
  823. //!
  824. //! <b>Complexity</b>: Logarithmic
  825. const_iterator lower_bound(const key_type& x) const;
  826. //! <b>Requires</b>: This overload is available only if
  827. //! key_compare::is_transparent exists.
  828. //!
  829. //! <b>Returns</b>: An iterator pointing to the first element with key not less
  830. //! than k, or a.end() if such an element is not found.
  831. //!
  832. //! <b>Complexity</b>: Logarithmic
  833. template<typename K>
  834. iterator lower_bound(const K& x);
  835. //! <b>Requires</b>: This overload is available only if
  836. //! key_compare::is_transparent exists.
  837. //!
  838. //! <b>Returns</b>: A const iterator pointing to the first element with key not
  839. //! less than k, or a.end() if such an element is not found.
  840. //!
  841. //! <b>Complexity</b>: Logarithmic
  842. template<typename K>
  843. const_iterator lower_bound(const K& x) const;
  844. //! <b>Returns</b>: An iterator pointing to the first element with key not less
  845. //! than x, or end() if such an element is not found.
  846. //!
  847. //! <b>Complexity</b>: Logarithmic
  848. iterator upper_bound(const key_type& x);
  849. //! <b>Returns</b>: A const iterator pointing to the first element with key not
  850. //! less than x, or end() if such an element is not found.
  851. //!
  852. //! <b>Complexity</b>: Logarithmic
  853. const_iterator upper_bound(const key_type& x) const;
  854. //! <b>Requires</b>: This overload is available only if
  855. //! key_compare::is_transparent exists.
  856. //!
  857. //! <b>Returns</b>: An iterator pointing to the first element with key not less
  858. //! than x, or end() if such an element is not found.
  859. //!
  860. //! <b>Complexity</b>: Logarithmic
  861. template<typename K>
  862. iterator upper_bound(const K& x);
  863. //! <b>Requires</b>: This overload is available only if
  864. //! key_compare::is_transparent exists.
  865. //!
  866. //! <b>Returns</b>: A const iterator pointing to the first element with key not
  867. //! less than x, or end() if such an element is not found.
  868. //!
  869. //! <b>Complexity</b>: Logarithmic
  870. template<typename K>
  871. const_iterator upper_bound(const K& x) const;
  872. #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  873. //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
  874. //!
  875. //! <b>Complexity</b>: Logarithmic
  876. BOOST_CONTAINER_FORCEINLINE std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const
  877. { return this->tree_t::lower_bound_range(x); }
  878. //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
  879. //!
  880. //! <b>Complexity</b>: Logarithmic
  881. BOOST_CONTAINER_FORCEINLINE std::pair<iterator,iterator> equal_range(const key_type& x)
  882. { return this->tree_t::lower_bound_range(x); }
  883. //! <b>Requires</b>: This overload is available only if
  884. //! key_compare::is_transparent exists.
  885. //!
  886. //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
  887. //!
  888. //! <b>Complexity</b>: Logarithmic
  889. template<typename K>
  890. std::pair<iterator,iterator> equal_range(const K& x)
  891. { return this->tree_t::lower_bound_range(x); }
  892. //! <b>Requires</b>: This overload is available only if
  893. //! key_compare::is_transparent exists.
  894. //!
  895. //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
  896. //!
  897. //! <b>Complexity</b>: Logarithmic
  898. template<typename K>
  899. std::pair<const_iterator,const_iterator> equal_range(const K& x) const
  900. { return this->tree_t::lower_bound_range(x); }
  901. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  902. //! <b>Effects</b>: Returns true if x and y are equal
  903. //!
  904. //! <b>Complexity</b>: Linear to the number of elements in the container.
  905. friend bool operator==(const flat_set& x, const flat_set& y);
  906. //! <b>Effects</b>: Returns true if x and y are unequal
  907. //!
  908. //! <b>Complexity</b>: Linear to the number of elements in the container.
  909. friend bool operator!=(const flat_set& x, const flat_set& y);
  910. //! <b>Effects</b>: Returns true if x is less than y
  911. //!
  912. //! <b>Complexity</b>: Linear to the number of elements in the container.
  913. friend bool operator<(const flat_set& x, const flat_set& y);
  914. //! <b>Effects</b>: Returns true if x is greater than y
  915. //!
  916. //! <b>Complexity</b>: Linear to the number of elements in the container.
  917. friend bool operator>(const flat_set& x, const flat_set& y);
  918. //! <b>Effects</b>: Returns true if x is equal or less than y
  919. //!
  920. //! <b>Complexity</b>: Linear to the number of elements in the container.
  921. friend bool operator<=(const flat_set& x, const flat_set& y);
  922. //! <b>Effects</b>: Returns true if x is equal or greater than y
  923. //!
  924. //! <b>Complexity</b>: Linear to the number of elements in the container.
  925. friend bool operator>=(const flat_set& x, const flat_set& y);
  926. //! <b>Effects</b>: x.swap(y)
  927. //!
  928. //! <b>Complexity</b>: Constant.
  929. friend void swap(flat_set& x, flat_set& y);
  930. //! <b>Effects</b>: Extracts the internal sequence container.
  931. //!
  932. //! <b>Complexity</b>: Same as the move constructor of sequence_type, usually constant.
  933. //!
  934. //! <b>Postcondition</b>: this->empty()
  935. //!
  936. //! <b>Throws</b>: If secuence_type's move constructor throws
  937. sequence_type extract_sequence();
  938. #endif //#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
  939. //! <b>Effects</b>: Discards the internally hold sequence container and adopts the
  940. //! one passed externally using the move assignment. Erases non-unique elements.
  941. //!
  942. //! <b>Complexity</b>: Assuming O(1) move assignment, O(NlogN) with N = seq.size()
  943. //!
  944. //! <b>Throws</b>: If the comparison or the move constructor throws
  945. BOOST_CONTAINER_FORCEINLINE void adopt_sequence(BOOST_RV_REF(sequence_type) seq)
  946. { this->tree_t::adopt_sequence_unique(boost::move(seq)); }
  947. //! <b>Requires</b>: seq shall be ordered according to this->compare()
  948. //! and shall contain unique elements.
  949. //!
  950. //! <b>Effects</b>: Discards the internally hold sequence container and adopts the
  951. //! one passed externally using the move assignment.
  952. //!
  953. //! <b>Complexity</b>: Assuming O(1) move assignment, O(1)
  954. //!
  955. //! <b>Throws</b>: If the move assignment throws
  956. BOOST_CONTAINER_FORCEINLINE void adopt_sequence(ordered_unique_range_t, BOOST_RV_REF(sequence_type) seq)
  957. { this->tree_t::adopt_sequence_unique(ordered_unique_range_t(), boost::move(seq)); }
  958. #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  959. private:
  960. template<class KeyType>
  961. BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> priv_insert(BOOST_FWD_REF(KeyType) x)
  962. { return this->tree_t::insert_unique(::boost::forward<KeyType>(x)); }
  963. template<class KeyType>
  964. BOOST_CONTAINER_FORCEINLINE iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
  965. { return this->tree_t::insert_unique(p, ::boost::forward<KeyType>(x)); }
  966. #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  967. };
  968. #if __cplusplus >= 201703L
  969. template <typename InputIterator>
  970. flat_set(InputIterator, InputIterator) ->
  971. flat_set<typename iterator_traits<InputIterator>::value_type>;
  972. template <typename InputIterator, typename Allocator>
  973. flat_set(InputIterator, InputIterator, Allocator const&) ->
  974. flat_set<typename iterator_traits<InputIterator>::value_type, std::less<typename iterator_traits<InputIterator>::value_type>, Allocator>;
  975. template <typename InputIterator, typename Compare>
  976. flat_set(InputIterator, InputIterator, Compare const&) ->
  977. flat_set<typename iterator_traits<InputIterator>::value_type, Compare>;
  978. template <typename InputIterator, typename Compare, typename Allocator>
  979. flat_set(InputIterator, InputIterator, Compare const&, Allocator const&) ->
  980. flat_set<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
  981. template <typename InputIterator>
  982. flat_set(ordered_unique_range_t, InputIterator, InputIterator) ->
  983. flat_set<typename iterator_traits<InputIterator>::value_type>;
  984. template <typename InputIterator, typename Allocator>
  985. flat_set(ordered_unique_range_t, InputIterator, InputIterator, Allocator const&) ->
  986. flat_set<typename iterator_traits<InputIterator>::value_type, std::less<typename iterator_traits<InputIterator>::value_type>, Allocator>;
  987. template <typename InputIterator, typename Compare>
  988. flat_set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&) ->
  989. flat_set<typename iterator_traits<InputIterator>::value_type, Compare>;
  990. template <typename InputIterator, typename Compare, typename Allocator>
  991. flat_set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) ->
  992. flat_set<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
  993. #endif
  994. #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  995. } //namespace container {
  996. //!has_trivial_destructor_after_move<> == true_type
  997. //!specialization for optimizations
  998. template <class Key, class Compare, class AllocatorOrContainer>
  999. struct has_trivial_destructor_after_move<boost::container::flat_set<Key, Compare, AllocatorOrContainer> >
  1000. {
  1001. typedef typename ::boost::container::allocator_traits<AllocatorOrContainer>::pointer pointer;
  1002. static const bool value = ::boost::has_trivial_destructor_after_move<AllocatorOrContainer>::value &&
  1003. ::boost::has_trivial_destructor_after_move<pointer>::value &&
  1004. ::boost::has_trivial_destructor_after_move<Compare>::value;
  1005. };
  1006. namespace container {
  1007. #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  1008. //! flat_multiset is a Sorted Associative Container that stores objects of type Key and
  1009. //! can store multiple copies of the same key value.
  1010. //!
  1011. //! flat_multiset is similar to std::multiset but it's implemented by as an ordered sequence container.
  1012. //! The underlying sequence container is by default <i>vector</i> but it can also work
  1013. //! user-provided vector-like SequenceContainers (like <i>static_vector</i> or <i>small_vector</i>).
  1014. //!
  1015. //! Using vector-like sequence containers means that inserting a new element into a flat_multiset might invalidate
  1016. //! previous iterators and references (unless that sequence container is <i>stable_vector</i> or a similar
  1017. //! container that offers stable pointers and references). Similarly, erasing an element might invalidate
  1018. //! iterators and references pointing to elements that come after (their keys are bigger) the erased element.
  1019. //!
  1020. //! This container provides random-access iterators.
  1021. //!
  1022. //! \tparam Key is the type to be inserted in the multiset, which is also the key_type
  1023. //! \tparam Compare is the comparison functor used to order keys
  1024. //! \tparam AllocatorOrContainer is either:
  1025. //! - The allocator to allocate <code>value_type</code>s (e.g. <i>allocator< std::pair<Key, T> > </i>).
  1026. //! (in this case <i>sequence_type</i> will be vector<value_type, AllocatorOrContainer>)
  1027. //! - The SequenceContainer to be used as the underlying <i>sequence_type</i>. It must be a vector-like
  1028. //! sequence container with random-access iterators.
  1029. #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
  1030. template <class Key, class Compare = std::less<Key>, class AllocatorOrContainer = new_allocator<Key> >
  1031. #else
  1032. template <class Key, class Compare, class AllocatorOrContainer>
  1033. #endif
  1034. class flat_multiset
  1035. ///@cond
  1036. : public dtl::flat_tree<Key, dtl::identity<Key>, Compare, AllocatorOrContainer>
  1037. ///@endcond
  1038. {
  1039. #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  1040. private:
  1041. BOOST_COPYABLE_AND_MOVABLE(flat_multiset)
  1042. typedef dtl::flat_tree<Key, dtl::identity<Key>, Compare, AllocatorOrContainer> tree_t;
  1043. public:
  1044. tree_t &tree()
  1045. { return *this; }
  1046. const tree_t &tree() const
  1047. { return *this; }
  1048. #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  1049. public:
  1050. //////////////////////////////////////////////
  1051. //
  1052. // types
  1053. //
  1054. //////////////////////////////////////////////
  1055. typedef Key key_type;
  1056. typedef Compare key_compare;
  1057. typedef Key value_type;
  1058. typedef typename BOOST_CONTAINER_IMPDEF(tree_t::sequence_type) sequence_type;
  1059. typedef typename sequence_type::allocator_type allocator_type;
  1060. typedef ::boost::container::allocator_traits<allocator_type> allocator_traits_type;
  1061. typedef typename sequence_type::pointer pointer;
  1062. typedef typename sequence_type::const_pointer const_pointer;
  1063. typedef typename sequence_type::reference reference;
  1064. typedef typename sequence_type::const_reference const_reference;
  1065. typedef typename sequence_type::size_type size_type;
  1066. typedef typename sequence_type::difference_type difference_type;
  1067. typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type) stored_allocator_type;
  1068. typedef typename BOOST_CONTAINER_IMPDEF(tree_t::value_compare) value_compare;
  1069. typedef typename sequence_type::iterator iterator;
  1070. typedef typename sequence_type::const_iterator const_iterator;
  1071. typedef typename sequence_type::reverse_iterator reverse_iterator;
  1072. typedef typename sequence_type::const_reverse_iterator const_reverse_iterator;
  1073. //! @copydoc ::boost::container::flat_set::flat_set()
  1074. BOOST_CONTAINER_FORCEINLINE flat_multiset() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<AllocatorOrContainer>::value &&
  1075. dtl::is_nothrow_default_constructible<Compare>::value)
  1076. : tree_t()
  1077. {}
  1078. //! @copydoc ::boost::container::flat_set::flat_set(const Compare&)
  1079. BOOST_CONTAINER_FORCEINLINE explicit flat_multiset(const Compare& comp)
  1080. : tree_t(comp)
  1081. {}
  1082. //! @copydoc ::boost::container::flat_set::flat_set(const allocator_type&)
  1083. BOOST_CONTAINER_FORCEINLINE explicit flat_multiset(const allocator_type& a)
  1084. : tree_t(a)
  1085. {}
  1086. //! @copydoc ::boost::container::flat_set::flat_set(const Compare&, const allocator_type&)
  1087. BOOST_CONTAINER_FORCEINLINE flat_multiset(const Compare& comp, const allocator_type& a)
  1088. : tree_t(comp, a)
  1089. {}
  1090. //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator)
  1091. template <class InputIterator>
  1092. BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last)
  1093. : tree_t(false, first, last)
  1094. {}
  1095. //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const allocator_type&)
  1096. template <class InputIterator>
  1097. BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last, const allocator_type& a)
  1098. : tree_t(false, first, last, a)
  1099. {}
  1100. //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const Compare& comp)
  1101. template <class InputIterator>
  1102. BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last, const Compare& comp)
  1103. : tree_t(false, first, last, comp)
  1104. {}
  1105. //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const Compare& comp, const allocator_type&)
  1106. template <class InputIterator>
  1107. BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
  1108. : tree_t(false, first, last, comp, a)
  1109. {}
  1110. //! <b>Effects</b>: Constructs an empty flat_multiset and
  1111. //! inserts elements from the ordered range [first ,last ). This function
  1112. //! is more efficient than the normal range creation for ordered ranges.
  1113. //!
  1114. //! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
  1115. //!
  1116. //! <b>Complexity</b>: Linear in N.
  1117. //!
  1118. //! <b>Note</b>: Non-standard extension.
  1119. template <class InputIterator>
  1120. BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, InputIterator first, InputIterator last)
  1121. : tree_t(ordered_range, first, last)
  1122. {}
  1123. //! <b>Effects</b>: Constructs an empty flat_multiset using the specified comparison object and
  1124. //! inserts elements from the ordered range [first ,last ). This function
  1125. //! is more efficient than the normal range creation for ordered ranges.
  1126. //!
  1127. //! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
  1128. //!
  1129. //! <b>Complexity</b>: Linear in N.
  1130. //!
  1131. //! <b>Note</b>: Non-standard extension.
  1132. template <class InputIterator>
  1133. BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp)
  1134. : tree_t(ordered_range, first, last, comp)
  1135. {}
  1136. //! <b>Effects</b>: Constructs an empty flat_multiset using the specified comparison object and
  1137. //! allocator, and inserts elements from the ordered range [first, last ). This function
  1138. //! is more efficient than the normal range creation for ordered ranges.
  1139. //!
  1140. //! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
  1141. //!
  1142. //! <b>Complexity</b>: Linear in N.
  1143. //!
  1144. //! <b>Note</b>: Non-standard extension.
  1145. template <class InputIterator>
  1146. BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a)
  1147. : tree_t(ordered_range, first, last, comp, a)
  1148. {}
  1149. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  1150. //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type)
  1151. BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il)
  1152. : tree_t(false, il.begin(), il.end())
  1153. {}
  1154. //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const allocator_type&)
  1155. BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il, const allocator_type& a)
  1156. : tree_t(false, il.begin(), il.end(), a)
  1157. {}
  1158. //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const Compare& comp)
  1159. BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il, const Compare& comp)
  1160. : tree_t(false, il.begin(), il.end(), comp)
  1161. {}
  1162. //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const Compare& comp, const allocator_type&)
  1163. BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
  1164. : tree_t(false, il.begin(), il.end(), comp, a)
  1165. {}
  1166. //! <b>Effects</b>: Constructs an empty containerand
  1167. //! inserts elements from the ordered unique range [il.begin(), il.end()). This function
  1168. //! is more efficient than the normal range creation for ordered ranges.
  1169. //!
  1170. //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate.
  1171. //!
  1172. //! <b>Complexity</b>: Linear in N.
  1173. //!
  1174. //! <b>Note</b>: Non-standard extension.
  1175. BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, std::initializer_list<value_type> il)
  1176. : tree_t(ordered_range, il.begin(), il.end())
  1177. {}
  1178. //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
  1179. //! inserts elements from the ordered unique range [il.begin(), il.end()). This function
  1180. //! is more efficient than the normal range creation for ordered ranges.
  1181. //!
  1182. //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate.
  1183. //!
  1184. //! <b>Complexity</b>: Linear in N.
  1185. //!
  1186. //! <b>Note</b>: Non-standard extension.
  1187. BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp)
  1188. : tree_t(ordered_range, il.begin(), il.end(), comp)
  1189. {}
  1190. //! <b>Effects</b>: Constructs an empty container using the specified comparison object and
  1191. //! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function
  1192. //! is more efficient than the normal range creation for ordered ranges.
  1193. //!
  1194. //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate.
  1195. //!
  1196. //! <b>Complexity</b>: Linear in N.
  1197. //!
  1198. //! <b>Note</b>: Non-standard extension.
  1199. BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a)
  1200. : tree_t(ordered_range, il.begin(), il.end(), comp, a)
  1201. {}
  1202. #endif
  1203. //! @copydoc ::boost::container::flat_set::flat_set(const flat_set &)
  1204. BOOST_CONTAINER_FORCEINLINE flat_multiset(const flat_multiset& x)
  1205. : tree_t(static_cast<const tree_t&>(x))
  1206. {}
  1207. //! @copydoc ::boost::container::flat_set::flat_set(flat_set &&)
  1208. BOOST_CONTAINER_FORCEINLINE flat_multiset(BOOST_RV_REF(flat_multiset) x)
  1209. BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<Compare>::value)
  1210. : tree_t(boost::move(static_cast<tree_t&>(x)))
  1211. {}
  1212. //! @copydoc ::boost::container::flat_set::flat_set(const flat_set &, const allocator_type &)
  1213. BOOST_CONTAINER_FORCEINLINE flat_multiset(const flat_multiset& x, const allocator_type &a)
  1214. : tree_t(static_cast<const tree_t&>(x), a)
  1215. {}
  1216. //! @copydoc ::boost::container::flat_set::flat_set(flat_set &&, const allocator_type &)
  1217. BOOST_CONTAINER_FORCEINLINE flat_multiset(BOOST_RV_REF(flat_multiset) x, const allocator_type &a)
  1218. : tree_t(BOOST_MOVE_BASE(tree_t, x), a)
  1219. {}
  1220. //! @copydoc ::boost::container::flat_set::operator=(const flat_set &)
  1221. BOOST_CONTAINER_FORCEINLINE flat_multiset& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x)
  1222. { return static_cast<flat_multiset&>(this->tree_t::operator=(static_cast<const tree_t&>(x))); }
  1223. //! @copydoc ::boost::container::flat_set::operator=(flat_set &&)
  1224. BOOST_CONTAINER_FORCEINLINE flat_multiset& operator=(BOOST_RV_REF(flat_multiset) x)
  1225. BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value ||
  1226. allocator_traits_type::is_always_equal::value) &&
  1227. boost::container::dtl::is_nothrow_move_assignable<Compare>::value)
  1228. { return static_cast<flat_multiset&>(this->tree_t::operator=(BOOST_MOVE_BASE(tree_t, x))); }
  1229. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  1230. //! @copydoc ::boost::container::flat_set::operator=(std::initializer_list<value_type>)
  1231. flat_multiset& operator=(std::initializer_list<value_type> il)
  1232. {
  1233. this->clear();
  1234. this->insert(il.begin(), il.end());
  1235. return *this;
  1236. }
  1237. #endif
  1238. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  1239. //! @copydoc ::boost::container::flat_set::get_allocator()
  1240. allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW;
  1241. //! @copydoc ::boost::container::flat_set::get_stored_allocator()
  1242. stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW;
  1243. //! @copydoc ::boost::container::flat_set::get_stored_allocator() const
  1244. const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW;
  1245. //! @copydoc ::boost::container::flat_set::begin()
  1246. iterator begin() BOOST_NOEXCEPT_OR_NOTHROW;
  1247. //! @copydoc ::boost::container::flat_set::begin() const
  1248. const_iterator begin() const;
  1249. //! @copydoc ::boost::container::flat_set::cbegin() const
  1250. const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
  1251. //! @copydoc ::boost::container::flat_set::end()
  1252. iterator end() BOOST_NOEXCEPT_OR_NOTHROW;
  1253. //! @copydoc ::boost::container::flat_set::end() const
  1254. const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW;
  1255. //! @copydoc ::boost::container::flat_set::cend() const
  1256. const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW;
  1257. //! @copydoc ::boost::container::flat_set::rbegin()
  1258. reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW;
  1259. //! @copydoc ::boost::container::flat_set::rbegin() const
  1260. const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
  1261. //! @copydoc ::boost::container::flat_set::crbegin() const
  1262. const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
  1263. //! @copydoc ::boost::container::flat_set::rend()
  1264. reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW;
  1265. //! @copydoc ::boost::container::flat_set::rend() const
  1266. const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW;
  1267. //! @copydoc ::boost::container::flat_set::crend() const
  1268. const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW;
  1269. //! @copydoc ::boost::container::flat_set::empty() const
  1270. bool empty() const BOOST_NOEXCEPT_OR_NOTHROW;
  1271. //! @copydoc ::boost::container::flat_set::size() const
  1272. size_type size() const BOOST_NOEXCEPT_OR_NOTHROW;
  1273. //! @copydoc ::boost::container::flat_set::max_size() const
  1274. size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW;
  1275. //! @copydoc ::boost::container::flat_set::capacity() const
  1276. size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW;
  1277. //! @copydoc ::boost::container::flat_set::reserve(size_type)
  1278. void reserve(size_type cnt);
  1279. //! @copydoc ::boost::container::flat_set::shrink_to_fit()
  1280. void shrink_to_fit();
  1281. #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  1282. //////////////////////////////////////////////
  1283. //
  1284. // modifiers
  1285. //
  1286. //////////////////////////////////////////////
  1287. #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  1288. //! <b>Effects</b>: Inserts an object of type Key constructed with
  1289. //! std::forward<Args>(args)... and returns the iterator pointing to the
  1290. //! newly inserted element.
  1291. //!
  1292. //! <b>Complexity</b>: Logarithmic search time plus linear insertion
  1293. //! to the elements with bigger keys than x.
  1294. //!
  1295. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  1296. template <class... Args>
  1297. BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_FWD_REF(Args)... args)
  1298. { return this->tree_t::emplace_equal(boost::forward<Args>(args)...); }
  1299. //! <b>Effects</b>: Inserts an object of type Key constructed with
  1300. //! std::forward<Args>(args)... in the container.
  1301. //! p is a hint pointing to where the insert should start to search.
  1302. //!
  1303. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  1304. //! to the key of x.
  1305. //!
  1306. //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
  1307. //! right before p) plus insertion linear to the elements with bigger keys than x.
  1308. //!
  1309. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  1310. template <class... Args>
  1311. BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args)
  1312. { return this->tree_t::emplace_hint_equal(p, boost::forward<Args>(args)...); }
  1313. #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  1314. #define BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE(N) \
  1315. BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
  1316. BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_MOVE_UREF##N)\
  1317. { return this->tree_t::emplace_equal(BOOST_MOVE_FWD##N); }\
  1318. \
  1319. BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
  1320. BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
  1321. { return this->tree_t::emplace_hint_equal(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
  1322. //
  1323. BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE)
  1324. #undef BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE
  1325. #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  1326. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  1327. //! <b>Effects</b>: Inserts x and returns the iterator pointing to the
  1328. //! newly inserted element.
  1329. //!
  1330. //! <b>Complexity</b>: Logarithmic search time plus linear insertion
  1331. //! to the elements with bigger keys than x.
  1332. //!
  1333. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  1334. iterator insert(const value_type &x);
  1335. //! <b>Effects</b>: Inserts a new value_type move constructed from x
  1336. //! and returns the iterator pointing to the newly inserted element.
  1337. //!
  1338. //! <b>Complexity</b>: Logarithmic search time plus linear insertion
  1339. //! to the elements with bigger keys than x.
  1340. //!
  1341. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  1342. iterator insert(value_type &&x);
  1343. #else
  1344. BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, iterator, this->priv_insert)
  1345. #endif
  1346. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  1347. //! <b>Effects</b>: Inserts a copy of x in the container.
  1348. //! p is a hint pointing to where the insert should start to search.
  1349. //!
  1350. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  1351. //! to the key of x.
  1352. //!
  1353. //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
  1354. //! right before p) plus insertion linear to the elements with bigger keys than x.
  1355. //!
  1356. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  1357. iterator insert(const_iterator p, const value_type &x);
  1358. //! <b>Effects</b>: Inserts a new value move constructed from x in the container.
  1359. //! p is a hint pointing to where the insert should start to search.
  1360. //!
  1361. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  1362. //! to the key of x.
  1363. //!
  1364. //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted
  1365. //! right before p) plus insertion linear to the elements with bigger keys than x.
  1366. //!
  1367. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  1368. iterator insert(const_iterator p, value_type &&x);
  1369. #else
  1370. BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator)
  1371. #endif
  1372. //! <b>Requires</b>: first, last are not iterators into *this.
  1373. //!
  1374. //! <b>Effects</b>: inserts each element from the range [first,last) .
  1375. //!
  1376. //! <b>Complexity</b>: N log(N).
  1377. //!
  1378. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  1379. template <class InputIterator>
  1380. BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last)
  1381. { this->tree_t::insert_equal(first, last); }
  1382. //! <b>Requires</b>: first, last are not iterators into *this and
  1383. //! must be ordered according to the predicate.
  1384. //!
  1385. //! <b>Effects</b>: inserts each element from the range [first,last) .This function
  1386. //! is more efficient than the normal range creation for ordered ranges.
  1387. //!
  1388. //! <b>Complexity</b>: Linear.
  1389. //!
  1390. //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
  1391. template <class InputIterator>
  1392. BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, InputIterator first, InputIterator last)
  1393. { this->tree_t::insert_equal(ordered_range, first, last); }
  1394. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  1395. //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()).
  1396. //!
  1397. //! <b>Complexity</b>: N log(N).
  1398. //!
  1399. //! <b>Note</b>: If an element is inserted it might invalidate elements.
  1400. BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il)
  1401. { this->tree_t::insert_equal(il.begin(), il.end()); }
  1402. //! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate.
  1403. //!
  1404. //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()). This function
  1405. //! is more efficient than the normal range creation for ordered ranges.
  1406. //!
  1407. //! <b>Complexity</b>: Linear.
  1408. //!
  1409. //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
  1410. BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, std::initializer_list<value_type> il)
  1411. { this->tree_t::insert_equal(ordered_range, il.begin(), il.end()); }
  1412. #endif
  1413. //! @copydoc ::boost::container::flat_multimap::merge(flat_multimap<Key, T, C2, AllocatorOrContainer>&)
  1414. template<class C2>
  1415. BOOST_CONTAINER_FORCEINLINE void merge(flat_multiset<Key, C2, AllocatorOrContainer>& source)
  1416. { this->tree_t::merge_equal(source.tree()); }
  1417. //! @copydoc ::boost::container::flat_multiset::merge(flat_multiset<Key, C2, AllocatorOrContainer>&)
  1418. template<class C2>
  1419. BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multiset<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source)
  1420. { return this->merge(static_cast<flat_multiset<Key, C2, AllocatorOrContainer>&>(source)); }
  1421. //! @copydoc ::boost::container::flat_multimap::merge(flat_map<Key, T, C2, AllocatorOrContainer>&)
  1422. template<class C2>
  1423. BOOST_CONTAINER_FORCEINLINE void merge(flat_set<Key, C2, AllocatorOrContainer>& source)
  1424. { this->tree_t::merge_equal(source.tree()); }
  1425. //! @copydoc ::boost::container::flat_multiset::merge(flat_set<Key, C2, AllocatorOrContainer>&)
  1426. template<class C2>
  1427. BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_set<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source)
  1428. { return this->merge(static_cast<flat_set<Key, C2, AllocatorOrContainer>&>(source)); }
  1429. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  1430. //! @copydoc ::boost::container::flat_set::erase(const_iterator)
  1431. iterator erase(const_iterator p);
  1432. //! @copydoc ::boost::container::flat_set::erase(const key_type&)
  1433. size_type erase(const key_type& x);
  1434. //! @copydoc ::boost::container::flat_set::erase(const_iterator,const_iterator)
  1435. iterator erase(const_iterator first, const_iterator last);
  1436. //! @copydoc ::boost::container::flat_set::swap
  1437. void swap(flat_multiset& x)
  1438. BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
  1439. && boost::container::dtl::is_nothrow_swappable<Compare>::value );
  1440. //! @copydoc ::boost::container::flat_set::clear
  1441. void clear() BOOST_NOEXCEPT_OR_NOTHROW;
  1442. //! @copydoc ::boost::container::flat_set::key_comp
  1443. key_compare key_comp() const;
  1444. //! @copydoc ::boost::container::flat_set::value_comp
  1445. value_compare value_comp() const;
  1446. //! @copydoc ::boost::container::flat_set::find(const key_type& )
  1447. iterator find(const key_type& x);
  1448. //! @copydoc ::boost::container::flat_set::find(const key_type& ) const
  1449. const_iterator find(const key_type& x) const;
  1450. //! @copydoc ::boost::container::flat_set::nth(size_type)
  1451. iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW;
  1452. //! @copydoc ::boost::container::flat_set::nth(size_type) const
  1453. const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW;
  1454. //! @copydoc ::boost::container::flat_set::index_of(iterator)
  1455. size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW;
  1456. //! @copydoc ::boost::container::flat_set::index_of(const_iterator) const
  1457. size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW;
  1458. //! @copydoc ::boost::container::flat_set::count(const key_type& ) const
  1459. size_type count(const key_type& x) const;
  1460. //! @copydoc ::boost::container::flat_set::lower_bound(const key_type& )
  1461. iterator lower_bound(const key_type& x);
  1462. //! @copydoc ::boost::container::flat_set::lower_bound(const key_type& ) const
  1463. const_iterator lower_bound(const key_type& x) const;
  1464. //! @copydoc ::boost::container::flat_set::upper_bound(const key_type& )
  1465. iterator upper_bound(const key_type& x);
  1466. //! @copydoc ::boost::container::flat_set::upper_bound(const key_type& ) const
  1467. const_iterator upper_bound(const key_type& x) const;
  1468. //! @copydoc ::boost::container::flat_set::equal_range(const key_type& ) const
  1469. std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
  1470. //! @copydoc ::boost::container::flat_set::equal_range(const key_type& )
  1471. std::pair<iterator,iterator> equal_range(const key_type& x);
  1472. //! <b>Effects</b>: Returns true if x and y are equal
  1473. //!
  1474. //! <b>Complexity</b>: Linear to the number of elements in the container.
  1475. friend bool operator==(const flat_multiset& x, const flat_multiset& y);
  1476. //! <b>Effects</b>: Returns true if x and y are unequal
  1477. //!
  1478. //! <b>Complexity</b>: Linear to the number of elements in the container.
  1479. friend bool operator!=(const flat_multiset& x, const flat_multiset& y);
  1480. //! <b>Effects</b>: Returns true if x is less than y
  1481. //!
  1482. //! <b>Complexity</b>: Linear to the number of elements in the container.
  1483. friend bool operator<(const flat_multiset& x, const flat_multiset& y);
  1484. //! <b>Effects</b>: Returns true if x is greater than y
  1485. //!
  1486. //! <b>Complexity</b>: Linear to the number of elements in the container.
  1487. friend bool operator>(const flat_multiset& x, const flat_multiset& y);
  1488. //! <b>Effects</b>: Returns true if x is equal or less than y
  1489. //!
  1490. //! <b>Complexity</b>: Linear to the number of elements in the container.
  1491. friend bool operator<=(const flat_multiset& x, const flat_multiset& y);
  1492. //! <b>Effects</b>: Returns true if x is equal or greater than y
  1493. //!
  1494. //! <b>Complexity</b>: Linear to the number of elements in the container.
  1495. friend bool operator>=(const flat_multiset& x, const flat_multiset& y);
  1496. //! <b>Effects</b>: x.swap(y)
  1497. //!
  1498. //! <b>Complexity</b>: Constant.
  1499. friend void swap(flat_multiset& x, flat_multiset& y);
  1500. //! <b>Effects</b>: Extracts the internal sequence container.
  1501. //!
  1502. //! <b>Complexity</b>: Same as the move constructor of sequence_type, usually constant.
  1503. //!
  1504. //! <b>Postcondition</b>: this->empty()
  1505. //!
  1506. //! <b>Throws</b>: If secuence_type's move constructor throws
  1507. sequence_type extract_sequence();
  1508. #endif //#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
  1509. //! <b>Effects</b>: Discards the internally hold sequence container and adopts the
  1510. //! one passed externally using the move assignment.
  1511. //!
  1512. //! <b>Complexity</b>: Assuming O(1) move assignment, O(NlogN) with N = seq.size()
  1513. //!
  1514. //! <b>Throws</b>: If the comparison or the move constructor throws
  1515. BOOST_CONTAINER_FORCEINLINE void adopt_sequence(BOOST_RV_REF(sequence_type) seq)
  1516. { this->tree_t::adopt_sequence_equal(boost::move(seq)); }
  1517. //! <b>Requires</b>: seq shall be ordered according to this->compare()
  1518. //!
  1519. //! <b>Effects</b>: Discards the internally hold sequence container and adopts the
  1520. //! one passed externally using the move assignment.
  1521. //!
  1522. //! <b>Complexity</b>: Assuming O(1) move assignment, O(1)
  1523. //!
  1524. //! <b>Throws</b>: If the move assignment throws
  1525. BOOST_CONTAINER_FORCEINLINE void adopt_sequence(ordered_range_t, BOOST_RV_REF(sequence_type) seq)
  1526. { this->tree_t::adopt_sequence_equal(ordered_range_t(), boost::move(seq)); }
  1527. #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  1528. private:
  1529. template <class KeyType>
  1530. BOOST_CONTAINER_FORCEINLINE iterator priv_insert(BOOST_FWD_REF(KeyType) x)
  1531. { return this->tree_t::insert_equal(::boost::forward<KeyType>(x)); }
  1532. template <class KeyType>
  1533. BOOST_CONTAINER_FORCEINLINE iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
  1534. { return this->tree_t::insert_equal(p, ::boost::forward<KeyType>(x)); }
  1535. #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  1536. };
  1537. #if __cplusplus >= 201703L
  1538. template <typename InputIterator>
  1539. flat_multiset(InputIterator, InputIterator) ->
  1540. flat_multiset<typename iterator_traits<InputIterator>::value_type>;
  1541. template <typename InputIterator, typename Allocator>
  1542. flat_multiset(InputIterator, InputIterator, Allocator const&) ->
  1543. flat_multiset< typename iterator_traits<InputIterator>::value_type
  1544. , std::less<typename iterator_traits<InputIterator>::value_type>
  1545. , Allocator>;
  1546. template <typename InputIterator, typename Compare>
  1547. flat_multiset(InputIterator, InputIterator, Compare const&) ->
  1548. flat_multiset<typename iterator_traits<InputIterator>::value_type, Compare>;
  1549. template <typename InputIterator, typename Compare, typename Allocator>
  1550. flat_multiset(InputIterator, InputIterator, Compare const&, Allocator const&) ->
  1551. flat_multiset<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
  1552. template <typename InputIterator>
  1553. flat_multiset(ordered_range_t, InputIterator, InputIterator) ->
  1554. flat_multiset<typename iterator_traits<InputIterator>::value_type>;
  1555. template <typename InputIterator, typename Allocator>
  1556. flat_multiset(ordered_range_t, InputIterator, InputIterator, Allocator const&) ->
  1557. flat_multiset< typename iterator_traits<InputIterator>::value_type
  1558. , std::less<typename iterator_traits<InputIterator>::value_type>
  1559. , Allocator>;
  1560. template <typename InputIterator, typename Compare>
  1561. flat_multiset(ordered_range_t, InputIterator, InputIterator, Compare const&) ->
  1562. flat_multiset< typename iterator_traits<InputIterator>::value_type, Compare>;
  1563. template <typename InputIterator, typename Compare, typename Allocator>
  1564. flat_multiset(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) ->
  1565. flat_multiset<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
  1566. #endif
  1567. #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  1568. } //namespace container {
  1569. //!has_trivial_destructor_after_move<> == true_type
  1570. //!specialization for optimizations
  1571. template <class Key, class Compare, class AllocatorOrContainer>
  1572. struct has_trivial_destructor_after_move<boost::container::flat_multiset<Key, Compare, AllocatorOrContainer> >
  1573. {
  1574. typedef typename ::boost::container::allocator_traits<AllocatorOrContainer>::pointer pointer;
  1575. static const bool value = ::boost::has_trivial_destructor_after_move<AllocatorOrContainer>::value &&
  1576. ::boost::has_trivial_destructor_after_move<pointer>::value &&
  1577. ::boost::has_trivial_destructor_after_move<Compare>::value;
  1578. };
  1579. namespace container {
  1580. #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  1581. }}
  1582. #include <boost/container/detail/config_end.hpp>
  1583. #endif // BOOST_CONTAINER_FLAT_SET_HPP