flat_set.hpp 81 KB

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