map.hpp 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478
  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_MAP_HPP
  11. #define BOOST_CONTAINER_MAP_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/container_fwd.hpp>
  22. #include <boost/container/new_allocator.hpp> //new_allocator
  23. #include <boost/container/throw_exception.hpp>
  24. // container/detail
  25. #include <boost/container/detail/mpl.hpp>
  26. #include <boost/container/detail/tree.hpp>
  27. #include <boost/container/detail/type_traits.hpp>
  28. #include <boost/container/detail/value_init.hpp>
  29. #include <boost/container/detail/pair.hpp>
  30. // move
  31. #include <boost/move/traits.hpp>
  32. #include <boost/move/utility_core.hpp>
  33. // move/detail
  34. #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  35. #include <boost/move/detail/fwd_macros.hpp>
  36. #endif
  37. #include <boost/move/detail/move_helpers.hpp>
  38. // intrusive/detail
  39. #include <boost/intrusive/detail/minimal_pair_header.hpp> //pair
  40. #include <boost/intrusive/detail/minimal_less_equal_header.hpp>//less, equal
  41. // other
  42. #include <boost/static_assert.hpp>
  43. #include <boost/core/no_exceptions_support.hpp>
  44. // std
  45. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  46. #include <initializer_list>
  47. #endif
  48. namespace boost {
  49. namespace container {
  50. #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
  51. //! A map is a kind of associative container that supports unique keys (contains at
  52. //! most one of each key value) and provides for fast retrieval of values of another
  53. //! type T based on the keys. The map class supports bidirectional iterators.
  54. //!
  55. //! A map satisfies all of the requirements of a container and of a reversible
  56. //! container and of an associative container. The <code>value_type</code> stored
  57. //! by this container is the value_type is std::pair<const Key, T>.
  58. //!
  59. //! \tparam Key is the key_type of the map
  60. //! \tparam T is the <code>mapped_type</code>
  61. //! \tparam Compare is the ordering function for Keys (e.g. <i>std::less<Key></i>).
  62. //! \tparam Allocator is the allocator to allocate the <code>value_type</code>s
  63. //! (e.g. <i>allocator< std::pair<const Key, T> > </i>).
  64. //! \tparam MapOptions is an packed option type generated using using boost::container::tree_assoc_options.
  65. template < class Key, class T, class Compare = std::less<Key>
  66. , class Allocator = new_allocator< std::pair< const Key, T> >, class MapOptions = tree_assoc_defaults >
  67. #else
  68. template <class Key, class T, class Compare, class Allocator, class MapOptions>
  69. #endif
  70. class map
  71. ///@cond
  72. : public container_detail::tree
  73. < Key, std::pair<const Key, T>
  74. , container_detail::select1st< std::pair<const Key, T> >
  75. , Compare, Allocator, MapOptions>
  76. ///@endcond
  77. {
  78. #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  79. private:
  80. BOOST_COPYABLE_AND_MOVABLE(map)
  81. typedef std::pair<const Key, T> value_type_impl;
  82. typedef container_detail::tree
  83. <Key, value_type_impl, container_detail::select1st<value_type_impl>, Compare, Allocator, MapOptions> base_t;
  84. typedef container_detail::pair <Key, T> movable_value_type_impl;
  85. typedef container_detail::tree_value_compare
  86. < Key, value_type_impl, Compare, container_detail::select1st<value_type_impl>
  87. > value_compare_impl;
  88. #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  89. public:
  90. //////////////////////////////////////////////
  91. //
  92. // types
  93. //
  94. //////////////////////////////////////////////
  95. typedef Key key_type;
  96. typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type;
  97. typedef T mapped_type;
  98. typedef std::pair<const Key, T> value_type;
  99. typedef typename boost::container::allocator_traits<Allocator>::pointer pointer;
  100. typedef typename boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
  101. typedef typename boost::container::allocator_traits<Allocator>::reference reference;
  102. typedef typename boost::container::allocator_traits<Allocator>::const_reference const_reference;
  103. typedef typename boost::container::allocator_traits<Allocator>::size_type size_type;
  104. typedef typename boost::container::allocator_traits<Allocator>::difference_type difference_type;
  105. typedef Allocator allocator_type;
  106. typedef typename BOOST_CONTAINER_IMPDEF(base_t::stored_allocator_type) stored_allocator_type;
  107. typedef BOOST_CONTAINER_IMPDEF(value_compare_impl) value_compare;
  108. typedef Compare key_compare;
  109. typedef typename BOOST_CONTAINER_IMPDEF(base_t::iterator) iterator;
  110. typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_iterator) const_iterator;
  111. typedef typename BOOST_CONTAINER_IMPDEF(base_t::reverse_iterator) reverse_iterator;
  112. typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator;
  113. typedef std::pair<key_type, mapped_type> nonconst_value_type;
  114. typedef BOOST_CONTAINER_IMPDEF(movable_value_type_impl) movable_value_type;
  115. //////////////////////////////////////////////
  116. //
  117. // construct/copy/destroy
  118. //
  119. //////////////////////////////////////////////
  120. //! <b>Effects</b>: Default constructs an empty map.
  121. //!
  122. //! <b>Complexity</b>: Constant.
  123. map()
  124. : base_t()
  125. {
  126. //A type must be std::pair<CONST Key, T>
  127. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  128. }
  129. //! <b>Effects</b>: Constructs an empty map using the specified comparison object
  130. //! and allocator.
  131. //!
  132. //! <b>Complexity</b>: Constant.
  133. explicit map(const Compare& comp, const allocator_type& a = allocator_type())
  134. : base_t(comp, a)
  135. {
  136. //A type must be std::pair<CONST Key, T>
  137. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  138. }
  139. //! <b>Effects</b>: Constructs an empty map using the specified allocator.
  140. //!
  141. //! <b>Complexity</b>: Constant.
  142. explicit map(const allocator_type& a)
  143. : base_t(a)
  144. {
  145. //A type must be std::pair<CONST Key, T>
  146. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  147. }
  148. //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
  149. //! allocator, and inserts elements from the range [first ,last ).
  150. //!
  151. //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
  152. //! comp and otherwise N logN, where N is last - first.
  153. template <class InputIterator>
  154. map(InputIterator first, InputIterator last, const Compare& comp = Compare(),
  155. const allocator_type& a = allocator_type())
  156. : base_t(true, first, last, comp, a)
  157. {
  158. //A type must be std::pair<CONST Key, T>
  159. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  160. }
  161. //! <b>Effects</b>: Constructs an empty map using the specified
  162. //! allocator, and inserts elements from the range [first ,last ).
  163. //!
  164. //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
  165. //! comp and otherwise N logN, where N is last - first.
  166. template <class InputIterator>
  167. map(InputIterator first, InputIterator last, const allocator_type& a)
  168. : base_t(true, first, last, Compare(), a)
  169. {
  170. //A type must be std::pair<CONST Key, T>
  171. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  172. }
  173. //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
  174. //! allocator, and inserts elements from the ordered unique range [first ,last). This function
  175. //! is more efficient than the normal range creation for ordered ranges.
  176. //!
  177. //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
  178. //! unique values.
  179. //!
  180. //! <b>Complexity</b>: Linear in N.
  181. //!
  182. //! <b>Note</b>: Non-standard extension.
  183. template <class InputIterator>
  184. map( ordered_unique_range_t, InputIterator first, InputIterator last
  185. , const Compare& comp = Compare(), const allocator_type& a = allocator_type())
  186. : base_t(ordered_range, first, last, comp, a)
  187. {
  188. //A type must be std::pair<CONST Key, T>
  189. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  190. }
  191. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  192. //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
  193. //! allocator, and inserts elements from the range [il.begin(), il.end()).
  194. //!
  195. //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
  196. //! comp and otherwise N logN, where N is il.first() - il.end().
  197. map(std::initializer_list<value_type> il, const Compare& comp = Compare(), const allocator_type& a = allocator_type())
  198. : base_t(true, il.begin(), il.end(), comp, a)
  199. {
  200. //A type must be std::pair<CONST Key, T>
  201. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  202. }
  203. //! <b>Effects</b>: Constructs an empty map using the specified
  204. //! allocator, and inserts elements from the range [il.begin(), il.end()).
  205. //!
  206. //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
  207. //! comp and otherwise N logN, where N is il.first() - il.end().
  208. map(std::initializer_list<value_type> il, const allocator_type& a)
  209. : base_t(true, il.begin(), il.end(), Compare(), a)
  210. {
  211. //A type must be std::pair<CONST Key, T>
  212. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  213. }
  214. //! <b>Effects</b>: Constructs an empty set using the specified comparison object and
  215. //! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function
  216. //! is more efficient than the normal range creation for ordered ranges.
  217. //!
  218. //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be
  219. //! unique values.
  220. //!
  221. //! <b>Complexity</b>: Linear in N.
  222. //!
  223. //! <b>Note</b>: Non-standard extension.
  224. map(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp = Compare(),
  225. const allocator_type& a = allocator_type())
  226. : base_t(ordered_range, il.begin(), il.end(), comp, a)
  227. {
  228. //A type must be std::pair<CONST Key, T>
  229. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  230. }
  231. #endif
  232. //! <b>Effects</b>: Copy constructs a map.
  233. //!
  234. //! <b>Complexity</b>: Linear in x.size().
  235. map(const map& x)
  236. : base_t(static_cast<const base_t&>(x))
  237. {
  238. //A type must be std::pair<CONST Key, T>
  239. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  240. }
  241. //! <b>Effects</b>: Move constructs a map. Constructs *this using x's resources.
  242. //!
  243. //! <b>Complexity</b>: Constant.
  244. //!
  245. //! <b>Postcondition</b>: x is emptied.
  246. map(BOOST_RV_REF(map) x)
  247. : base_t(BOOST_MOVE_BASE(base_t, x))
  248. {
  249. //A type must be std::pair<CONST Key, T>
  250. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  251. }
  252. //! <b>Effects</b>: Copy constructs a map using the specified allocator.
  253. //!
  254. //! <b>Complexity</b>: Linear in x.size().
  255. map(const map& x, const allocator_type &a)
  256. : base_t(static_cast<const base_t&>(x), a)
  257. {
  258. //A type must be std::pair<CONST Key, T>
  259. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  260. }
  261. //! <b>Effects</b>: Move constructs a map using the specified allocator.
  262. //! Constructs *this using x's resources.
  263. //!
  264. //! <b>Complexity</b>: Constant if x == x.get_allocator(), linear otherwise.
  265. //!
  266. //! <b>Postcondition</b>: x is emptied.
  267. map(BOOST_RV_REF(map) x, const allocator_type &a)
  268. : base_t(BOOST_MOVE_BASE(base_t, x), a)
  269. {
  270. //A type must be std::pair<CONST Key, T>
  271. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  272. }
  273. //! <b>Effects</b>: Makes *this a copy of x.
  274. //!
  275. //! <b>Complexity</b>: Linear in x.size().
  276. map& operator=(BOOST_COPY_ASSIGN_REF(map) x)
  277. { return static_cast<map&>(this->base_t::operator=(static_cast<const base_t&>(x))); }
  278. //! <b>Effects</b>: this->swap(x.get()).
  279. //!
  280. //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment
  281. //! is false and (allocation throws or value_type's move constructor throws)
  282. //!
  283. //! <b>Complexity</b>: Constant if allocator_traits_type::
  284. //! propagate_on_container_move_assignment is true or
  285. //! this->get>allocator() == x.get_allocator(). Linear otherwise.
  286. map& operator=(BOOST_RV_REF(map) x)
  287. BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
  288. && boost::container::container_detail::is_nothrow_move_assignable<Compare>::value )
  289. { return static_cast<map&>(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); }
  290. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  291. //! <b>Effects</b>: Assign content of il to *this.
  292. //!
  293. map& operator=(std::initializer_list<value_type> il)
  294. {
  295. this->clear();
  296. insert(il.begin(), il.end());
  297. return *this;
  298. }
  299. #endif
  300. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  301. //! <b>Effects</b>: Returns a copy of the allocator that
  302. //! was passed to the object's constructor.
  303. //!
  304. //! <b>Complexity</b>: Constant.
  305. allocator_type get_allocator() const;
  306. //! <b>Effects</b>: Returns a reference to the internal allocator.
  307. //!
  308. //! <b>Throws</b>: Nothing
  309. //!
  310. //! <b>Complexity</b>: Constant.
  311. //!
  312. //! <b>Note</b>: Non-standard extension.
  313. stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW;
  314. //! <b>Effects</b>: Returns a reference to the internal allocator.
  315. //!
  316. //! <b>Throws</b>: Nothing
  317. //!
  318. //! <b>Complexity</b>: Constant.
  319. //!
  320. //! <b>Note</b>: Non-standard extension.
  321. const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW;
  322. //! <b>Effects</b>: Returns an iterator to the first element contained in the container.
  323. //!
  324. //! <b>Throws</b>: Nothing.
  325. //!
  326. //! <b>Complexity</b>: Constant.
  327. iterator begin() BOOST_NOEXCEPT_OR_NOTHROW;
  328. //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
  329. //!
  330. //! <b>Throws</b>: Nothing.
  331. //!
  332. //! <b>Complexity</b>: Constant.
  333. const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW;
  334. //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
  335. //!
  336. //! <b>Throws</b>: Nothing.
  337. //!
  338. //! <b>Complexity</b>: Constant.
  339. const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
  340. //! <b>Effects</b>: Returns an iterator to the end of the container.
  341. //!
  342. //! <b>Throws</b>: Nothing.
  343. //!
  344. //! <b>Complexity</b>: Constant.
  345. iterator end() BOOST_NOEXCEPT_OR_NOTHROW;
  346. //! <b>Effects</b>: Returns a const_iterator to the end of the container.
  347. //!
  348. //! <b>Throws</b>: Nothing.
  349. //!
  350. //! <b>Complexity</b>: Constant.
  351. const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW;
  352. //! <b>Effects</b>: Returns a const_iterator to the end of the container.
  353. //!
  354. //! <b>Throws</b>: Nothing.
  355. //!
  356. //! <b>Complexity</b>: Constant.
  357. const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW;
  358. //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
  359. //! of the reversed container.
  360. //!
  361. //! <b>Throws</b>: Nothing.
  362. //!
  363. //! <b>Complexity</b>: Constant.
  364. reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW;
  365. //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
  366. //! of the reversed container.
  367. //!
  368. //! <b>Throws</b>: Nothing.
  369. //!
  370. //! <b>Complexity</b>: Constant.
  371. const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
  372. //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
  373. //! of the reversed container.
  374. //!
  375. //! <b>Throws</b>: Nothing.
  376. //!
  377. //! <b>Complexity</b>: Constant.
  378. const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
  379. //! <b>Effects</b>: Returns a reverse_iterator pointing to the end
  380. //! of the reversed container.
  381. //!
  382. //! <b>Throws</b>: Nothing.
  383. //!
  384. //! <b>Complexity</b>: Constant.
  385. reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW;
  386. //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
  387. //! of the reversed container.
  388. //!
  389. //! <b>Throws</b>: Nothing.
  390. //!
  391. //! <b>Complexity</b>: Constant.
  392. const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW;
  393. //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
  394. //! of the reversed container.
  395. //!
  396. //! <b>Throws</b>: Nothing.
  397. //!
  398. //! <b>Complexity</b>: Constant.
  399. const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW;
  400. //! <b>Effects</b>: Returns true if the container contains no elements.
  401. //!
  402. //! <b>Throws</b>: Nothing.
  403. //!
  404. //! <b>Complexity</b>: Constant.
  405. bool empty() const BOOST_NOEXCEPT_OR_NOTHROW;
  406. //! <b>Effects</b>: Returns the number of the elements contained in the container.
  407. //!
  408. //! <b>Throws</b>: Nothing.
  409. //!
  410. //! <b>Complexity</b>: Constant.
  411. size_type size() const BOOST_NOEXCEPT_OR_NOTHROW;
  412. //! <b>Effects</b>: Returns the largest possible size of the container.
  413. //!
  414. //! <b>Throws</b>: Nothing.
  415. //!
  416. //! <b>Complexity</b>: Constant.
  417. size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW;
  418. #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  419. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  420. //! Effects: If there is no key equivalent to x in the map, inserts
  421. //! value_type(x, T()) into the map.
  422. //!
  423. //! Returns: A reference to the mapped_type corresponding to x in *this.
  424. //!
  425. //! Complexity: Logarithmic.
  426. mapped_type& operator[](const key_type &k);
  427. //! Effects: If there is no key equivalent to x in the map, inserts
  428. //! value_type(boost::move(x), T()) into the map (the key is move-constructed)
  429. //!
  430. //! Returns: A reference to the mapped_type corresponding to x in *this.
  431. //!
  432. //! Complexity: Logarithmic.
  433. mapped_type& operator[](key_type &&k);
  434. #elif defined(BOOST_MOVE_HELPERS_RETURN_SFINAE_BROKEN)
  435. //in compilers like GCC 3.4, we can't catch temporaries
  436. mapped_type& operator[](const key_type &k) { return this->priv_subscript(k); }
  437. mapped_type& operator[](BOOST_RV_REF(key_type) k) { return this->priv_subscript(::boost::move(k)); }
  438. #else
  439. BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, this->priv_subscript)
  440. #endif
  441. //! Returns: A reference to the element whose key is equivalent to x.
  442. //! Throws: An exception object of type out_of_range if no such element is present.
  443. //! Complexity: logarithmic.
  444. T& at(const key_type& k)
  445. {
  446. iterator i = this->find(k);
  447. if(i == this->end()){
  448. throw_out_of_range("map::at key not found");
  449. }
  450. return i->second;
  451. }
  452. //! Returns: A reference to the element whose key is equivalent to x.
  453. //! Throws: An exception object of type out_of_range if no such element is present.
  454. //! Complexity: logarithmic.
  455. const T& at(const key_type& k) const
  456. {
  457. const_iterator i = this->find(k);
  458. if(i == this->end()){
  459. throw_out_of_range("map::at key not found");
  460. }
  461. return i->second;
  462. }
  463. //////////////////////////////////////////////
  464. //
  465. // modifiers
  466. //
  467. //////////////////////////////////////////////
  468. //! <b>Effects</b>: Inserts x if and only if there is no element in the container
  469. //! with key equivalent to the key of x.
  470. //!
  471. //! <b>Returns</b>: The bool component of the returned pair is true if and only
  472. //! if the insertion takes place, and the iterator component of the pair
  473. //! points to the element with key equivalent to the key of x.
  474. //!
  475. //! <b>Complexity</b>: Logarithmic.
  476. std::pair<iterator,bool> insert(const value_type& x)
  477. { return this->base_t::insert_unique(x); }
  478. //! <b>Effects</b>: Inserts a new value_type created from the pair if and only if
  479. //! there is no element in the container with key equivalent to the key of x.
  480. //!
  481. //! <b>Returns</b>: The bool component of the returned pair is true if and only
  482. //! if the insertion takes place, and the iterator component of the pair
  483. //! points to the element with key equivalent to the key of x.
  484. //!
  485. //! <b>Complexity</b>: Logarithmic.
  486. std::pair<iterator,bool> insert(const nonconst_value_type& x)
  487. { return this->base_t::insert_unique(x); }
  488. //! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
  489. //! only if there is no element in the container with key equivalent to the key of x.
  490. //!
  491. //! <b>Returns</b>: The bool component of the returned pair is true if and only
  492. //! if the insertion takes place, and the iterator component of the pair
  493. //! points to the element with key equivalent to the key of x.
  494. //!
  495. //! <b>Complexity</b>: Logarithmic.
  496. std::pair<iterator,bool> insert(BOOST_RV_REF(nonconst_value_type) x)
  497. { return this->base_t::insert_unique(boost::move(x)); }
  498. //! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
  499. //! only if there is no element in the container with key equivalent to the key of x.
  500. //!
  501. //! <b>Returns</b>: The bool component of the returned pair is true if and only
  502. //! if the insertion takes place, and the iterator component of the pair
  503. //! points to the element with key equivalent to the key of x.
  504. //!
  505. //! <b>Complexity</b>: Logarithmic.
  506. std::pair<iterator,bool> insert(BOOST_RV_REF(movable_value_type) x)
  507. { return this->base_t::insert_unique(boost::move(x)); }
  508. //! <b>Effects</b>: Move constructs a new value from x if and only if there is
  509. //! no element in the container with key equivalent to the key of x.
  510. //!
  511. //! <b>Returns</b>: The bool component of the returned pair is true if and only
  512. //! if the insertion takes place, and the iterator component of the pair
  513. //! points to the element with key equivalent to the key of x.
  514. //!
  515. //! <b>Complexity</b>: Logarithmic.
  516. std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
  517. { return this->base_t::insert_unique(boost::move(x)); }
  518. //! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
  519. //! no element in the container with key equivalent to the key of x.
  520. //! p is a hint pointing to where the insert should start to search.
  521. //!
  522. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  523. //! to the key of x.
  524. //!
  525. //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
  526. //! is inserted right before p.
  527. iterator insert(const_iterator p, const value_type& x)
  528. { return this->base_t::insert_unique(p, x); }
  529. //! <b>Effects</b>: Move constructs a new value from x if and only if there is
  530. //! no element in the container with key equivalent to the key of x.
  531. //! p is a hint pointing to where the insert should start to search.
  532. //!
  533. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  534. //! to the key of x.
  535. //!
  536. //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
  537. //! is inserted right before p.
  538. iterator insert(const_iterator p, BOOST_RV_REF(nonconst_value_type) x)
  539. { return this->base_t::insert_unique_convertible(p, boost::move(x)); }
  540. //! <b>Effects</b>: Move constructs a new value from x if and only if there is
  541. //! no element in the container with key equivalent to the key of x.
  542. //! p is a hint pointing to where the insert should start to search.
  543. //!
  544. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  545. //! to the key of x.
  546. //!
  547. //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
  548. //! is inserted right before p.
  549. iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x)
  550. { return this->base_t::insert_unique_convertible(p, boost::move(x)); }
  551. //! <b>Effects</b>: Inserts a copy of x in the container.
  552. //! p is a hint pointing to where the insert should start to search.
  553. //!
  554. //! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
  555. //!
  556. //! <b>Complexity</b>: Logarithmic.
  557. iterator insert(const_iterator p, const nonconst_value_type& x)
  558. { return this->base_t::insert_unique_convertible(p, x); }
  559. //! <b>Effects</b>: Inserts an element move constructed from x in the container.
  560. //! p is a hint pointing to where the insert should start to search.
  561. //!
  562. //! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
  563. //!
  564. //! <b>Complexity</b>: Logarithmic.
  565. iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
  566. { return this->base_t::insert_unique(p, boost::move(x)); }
  567. //! <b>Requires</b>: first, last are not iterators into *this.
  568. //!
  569. //! <b>Effects</b>: inserts each element from the range [first,last) if and only
  570. //! if there is no element with key equivalent to the key of that element.
  571. //!
  572. //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
  573. template <class InputIterator>
  574. void insert(InputIterator first, InputIterator last)
  575. { this->base_t::insert_unique(first, last); }
  576. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  577. //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) if and only
  578. //! if there is no element with key equivalent to the key of that element.
  579. //!
  580. //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from il.begin() to il.end())
  581. void insert(std::initializer_list<value_type> il)
  582. { this->base_t::insert_unique(il.begin(), il.end()); }
  583. #endif
  584. #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  585. //! <b>Effects</b>: Inserts an object x of type T constructed with
  586. //! std::forward<Args>(args)... in the container if and only if there is
  587. //! no element in the container with an equivalent key.
  588. //! p is a hint pointing to where the insert should start to search.
  589. //!
  590. //! <b>Returns</b>: The bool component of the returned pair is true if and only
  591. //! if the insertion takes place, and the iterator component of the pair
  592. //! points to the element with key equivalent to the key of x.
  593. //!
  594. //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
  595. //! is inserted right before p.
  596. template <class... Args>
  597. std::pair<iterator,bool> emplace(BOOST_FWD_REF(Args)... args)
  598. { return this->base_t::emplace_unique(boost::forward<Args>(args)...); }
  599. //! <b>Effects</b>: Inserts an object of type T constructed with
  600. //! std::forward<Args>(args)... in the container if and only if there is
  601. //! no element in the container with an equivalent key.
  602. //! p is a hint pointing to where the insert should start to search.
  603. //!
  604. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  605. //! to the key of x.
  606. //!
  607. //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
  608. //! is inserted right before p.
  609. template <class... Args>
  610. iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args)
  611. { return this->base_t::emplace_hint_unique(p, boost::forward<Args>(args)...); }
  612. #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  613. #define BOOST_CONTAINER_MAP_EMPLACE_CODE(N) \
  614. BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
  615. std::pair<iterator,bool> emplace(BOOST_MOVE_UREF##N)\
  616. { return this->base_t::emplace_unique(BOOST_MOVE_FWD##N); }\
  617. \
  618. BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
  619. iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
  620. { return this->base_t::emplace_hint_unique(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
  621. //
  622. BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_MAP_EMPLACE_CODE)
  623. #undef BOOST_CONTAINER_MAP_EMPLACE_CODE
  624. #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  625. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  626. //! <b>Effects</b>: Erases the element pointed to by p.
  627. //!
  628. //! <b>Returns</b>: Returns an iterator pointing to the element immediately
  629. //! following q prior to the element being erased. If no such element exists,
  630. //! returns end().
  631. //!
  632. //! <b>Complexity</b>: Amortized constant time
  633. iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW;
  634. //! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
  635. //!
  636. //! <b>Returns</b>: Returns the number of erased elements.
  637. //!
  638. //! <b>Complexity</b>: log(size()) + count(k)
  639. size_type erase(const key_type& x) BOOST_NOEXCEPT_OR_NOTHROW;
  640. //! <b>Effects</b>: Erases all the elements in the range [first, last).
  641. //!
  642. //! <b>Returns</b>: Returns last.
  643. //!
  644. //! <b>Complexity</b>: log(size())+N where N is the distance from first to last.
  645. iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW;
  646. //! <b>Effects</b>: Swaps the contents of *this and x.
  647. //!
  648. //! <b>Throws</b>: Nothing.
  649. //!
  650. //! <b>Complexity</b>: Constant.
  651. void swap(map& x)
  652. BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
  653. && boost::container::container_detail::is_nothrow_swappable<Compare>::value )
  654. //! <b>Effects</b>: erase(a.begin(),a.end()).
  655. //!
  656. //! <b>Postcondition</b>: size() == 0.
  657. //!
  658. //! <b>Complexity</b>: linear in size().
  659. void clear() BOOST_NOEXCEPT_OR_NOTHROW;
  660. //! <b>Effects</b>: Returns the comparison object out
  661. //! of which a was constructed.
  662. //!
  663. //! <b>Complexity</b>: Constant.
  664. key_compare key_comp() const;
  665. //! <b>Effects</b>: Returns an object of value_compare constructed out
  666. //! of the comparison object.
  667. //!
  668. //! <b>Complexity</b>: Constant.
  669. value_compare value_comp() const;
  670. //! <b>Returns</b>: An iterator pointing to an element with the key
  671. //! equivalent to x, or end() if such an element is not found.
  672. //!
  673. //! <b>Complexity</b>: Logarithmic.
  674. iterator find(const key_type& x);
  675. //! <b>Returns</b>: A const_iterator pointing to an element with the key
  676. //! equivalent to x, or end() if such an element is not found.
  677. //!
  678. //! <b>Complexity</b>: Logarithmic.
  679. const_iterator find(const key_type& x) const;
  680. #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  681. //! <b>Returns</b>: The number of elements with key equivalent to x.
  682. //!
  683. //! <b>Complexity</b>: log(size())+count(k)
  684. size_type count(const key_type& x) const
  685. { return static_cast<size_type>(this->find(x) != this->cend()); }
  686. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  687. //! <b>Returns</b>: An iterator pointing to the first element with key not less
  688. //! than k, or a.end() if such an element is not found.
  689. //!
  690. //! <b>Complexity</b>: Logarithmic
  691. iterator lower_bound(const key_type& x);
  692. //! <b>Returns</b>: A const iterator pointing to the first element with key not
  693. //! less than k, or a.end() if such an element is not found.
  694. //!
  695. //! <b>Complexity</b>: Logarithmic
  696. const_iterator lower_bound(const key_type& x) const;
  697. //! <b>Returns</b>: An iterator pointing to the first element with key not less
  698. //! than x, or end() if such an element is not found.
  699. //!
  700. //! <b>Complexity</b>: Logarithmic
  701. iterator upper_bound(const key_type& x);
  702. //! <b>Returns</b>: A const iterator pointing to the first element with key not
  703. //! less than x, or end() if such an element is not found.
  704. //!
  705. //! <b>Complexity</b>: Logarithmic
  706. const_iterator upper_bound(const key_type& x) const;
  707. //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
  708. //!
  709. //! <b>Complexity</b>: Logarithmic
  710. std::pair<iterator,iterator> equal_range(const key_type& x);
  711. //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
  712. //!
  713. //! <b>Complexity</b>: Logarithmic
  714. std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const;
  715. //! <b>Effects</b>: Rebalances the tree. It's a no-op for Red-Black and AVL trees.
  716. //!
  717. //! <b>Complexity</b>: Linear
  718. void rebalance();
  719. //! <b>Effects</b>: Returns true if x and y are equal
  720. //!
  721. //! <b>Complexity</b>: Linear to the number of elements in the container.
  722. friend bool operator==(const map& x, const map& y);
  723. //! <b>Effects</b>: Returns true if x and y are unequal
  724. //!
  725. //! <b>Complexity</b>: Linear to the number of elements in the container.
  726. friend bool operator!=(const map& x, const map& y);
  727. //! <b>Effects</b>: Returns true if x is less than y
  728. //!
  729. //! <b>Complexity</b>: Linear to the number of elements in the container.
  730. friend bool operator<(const map& x, const map& y);
  731. //! <b>Effects</b>: Returns true if x is greater than y
  732. //!
  733. //! <b>Complexity</b>: Linear to the number of elements in the container.
  734. friend bool operator>(const map& x, const map& y);
  735. //! <b>Effects</b>: Returns true if x is equal or less than y
  736. //!
  737. //! <b>Complexity</b>: Linear to the number of elements in the container.
  738. friend bool operator<=(const map& x, const map& y);
  739. //! <b>Effects</b>: Returns true if x is equal or greater than y
  740. //!
  741. //! <b>Complexity</b>: Linear to the number of elements in the container.
  742. friend bool operator>=(const map& x, const map& y);
  743. //! <b>Effects</b>: x.swap(y)
  744. //!
  745. //! <b>Complexity</b>: Constant.
  746. friend void swap(map& x, map& y);
  747. #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  748. #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  749. private:
  750. template<class KeyConvertible>
  751. mapped_type& priv_subscript(BOOST_FWD_REF(KeyConvertible) k)
  752. {
  753. return this->insert_from_key(boost::forward<KeyConvertible>(k))->second;
  754. }
  755. #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  756. };
  757. #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  758. } //namespace container {
  759. //!has_trivial_destructor_after_move<> == true_type
  760. //!specialization for optimizations
  761. template <class Key, class T, class Compare, class Allocator>
  762. struct has_trivial_destructor_after_move<boost::container::map<Key, T, Compare, Allocator> >
  763. {
  764. typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
  765. static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
  766. ::boost::has_trivial_destructor_after_move<pointer>::value &&
  767. ::boost::has_trivial_destructor_after_move<Compare>::value;
  768. };
  769. namespace container {
  770. #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  771. #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
  772. //! A multimap is a kind of associative container that supports equivalent keys
  773. //! (possibly containing multiple copies of the same key value) and provides for
  774. //! fast retrieval of values of another type T based on the keys. The multimap class
  775. //! supports bidirectional iterators.
  776. //!
  777. //! A multimap satisfies all of the requirements of a container and of a reversible
  778. //! container and of an associative container. The <code>value_type</code> stored
  779. //! by this container is the value_type is std::pair<const Key, T>.
  780. //!
  781. //! \tparam Key is the key_type of the map
  782. //! \tparam Value is the <code>mapped_type</code>
  783. //! \tparam Compare is the ordering function for Keys (e.g. <i>std::less<Key></i>).
  784. //! \tparam Allocator is the allocator to allocate the <code>value_type</code>s
  785. //! (e.g. <i>allocator< std::pair<const Key, T> > </i>).
  786. //! \tparam MultiMapOptions is an packed option type generated using using boost::container::tree_assoc_options.
  787. template < class Key, class T, class Compare = std::less<Key>
  788. , class Allocator = new_allocator< std::pair< const Key, T> >, class MultiMapOptions = tree_assoc_defaults>
  789. #else
  790. template <class Key, class T, class Compare, class Allocator, class MultiMapOptions>
  791. #endif
  792. class multimap
  793. ///@cond
  794. : public container_detail::tree
  795. < Key, std::pair<const Key, T>
  796. , container_detail::select1st< std::pair<const Key, T> >
  797. , Compare, Allocator, MultiMapOptions>
  798. ///@endcond
  799. {
  800. #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  801. private:
  802. BOOST_COPYABLE_AND_MOVABLE(multimap)
  803. typedef std::pair<const Key, T> value_type_impl;
  804. typedef container_detail::tree
  805. <Key, value_type_impl, container_detail::select1st<value_type_impl>, Compare, Allocator, MultiMapOptions> base_t;
  806. typedef container_detail::pair <Key, T> movable_value_type_impl;
  807. typedef container_detail::tree_value_compare
  808. < Key, value_type_impl, Compare, container_detail::select1st<value_type_impl>
  809. > value_compare_impl;
  810. #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  811. typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type;
  812. public:
  813. //////////////////////////////////////////////
  814. //
  815. // types
  816. //
  817. //////////////////////////////////////////////
  818. typedef Key key_type;
  819. typedef T mapped_type;
  820. typedef std::pair<const Key, T> value_type;
  821. typedef typename boost::container::allocator_traits<Allocator>::pointer pointer;
  822. typedef typename boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
  823. typedef typename boost::container::allocator_traits<Allocator>::reference reference;
  824. typedef typename boost::container::allocator_traits<Allocator>::const_reference const_reference;
  825. typedef typename boost::container::allocator_traits<Allocator>::size_type size_type;
  826. typedef typename boost::container::allocator_traits<Allocator>::difference_type difference_type;
  827. typedef Allocator allocator_type;
  828. typedef typename BOOST_CONTAINER_IMPDEF(base_t::stored_allocator_type) stored_allocator_type;
  829. typedef BOOST_CONTAINER_IMPDEF(value_compare_impl) value_compare;
  830. typedef Compare key_compare;
  831. typedef typename BOOST_CONTAINER_IMPDEF(base_t::iterator) iterator;
  832. typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_iterator) const_iterator;
  833. typedef typename BOOST_CONTAINER_IMPDEF(base_t::reverse_iterator) reverse_iterator;
  834. typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_reverse_iterator) const_reverse_iterator;
  835. typedef std::pair<key_type, mapped_type> nonconst_value_type;
  836. typedef BOOST_CONTAINER_IMPDEF(movable_value_type_impl) movable_value_type;
  837. //////////////////////////////////////////////
  838. //
  839. // construct/copy/destroy
  840. //
  841. //////////////////////////////////////////////
  842. //! <b>Effects</b>: Default constructs an empty multimap.
  843. //!
  844. //! <b>Complexity</b>: Constant.
  845. multimap()
  846. : base_t()
  847. {
  848. //A type must be std::pair<CONST Key, T>
  849. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  850. }
  851. //! <b>Effects</b>: Constructs an empty multimap using the specified allocator.
  852. //!
  853. //! <b>Complexity</b>: Constant.
  854. explicit multimap(const Compare& comp, const allocator_type& a = allocator_type())
  855. : base_t(comp, a)
  856. {
  857. //A type must be std::pair<CONST Key, T>
  858. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  859. }
  860. //! <b>Effects</b>: Constructs an empty multimap using the specified comparison
  861. //! object and allocator.
  862. //!
  863. //! <b>Complexity</b>: Constant.
  864. explicit multimap(const allocator_type& a)
  865. : base_t(a)
  866. {
  867. //A type must be std::pair<CONST Key, T>
  868. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  869. }
  870. //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object
  871. //! and allocator, and inserts elements from the range [first ,last ).
  872. //!
  873. //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
  874. //! comp and otherwise N logN, where N is last - first.
  875. template <class InputIterator>
  876. multimap(InputIterator first, InputIterator last,
  877. const Compare& comp = Compare(),
  878. const allocator_type& a = allocator_type())
  879. : base_t(false, first, last, comp, a)
  880. {
  881. //A type must be std::pair<CONST Key, T>
  882. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  883. }
  884. //! <b>Effects</b>: Constructs an empty multimap using the specified
  885. //! allocator, and inserts elements from the range [first ,last ).
  886. //!
  887. //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
  888. //! comp and otherwise N logN, where N is last - first.
  889. template <class InputIterator>
  890. multimap(InputIterator first, InputIterator last, const allocator_type& a)
  891. : base_t(false, first, last, Compare(), a)
  892. {
  893. //A type must be std::pair<CONST Key, T>
  894. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  895. }
  896. //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
  897. //! allocator, and inserts elements from the ordered range [first ,last). This function
  898. //! is more efficient than the normal range creation for ordered ranges.
  899. //!
  900. //! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
  901. //!
  902. //! <b>Complexity</b>: Linear in N.
  903. //!
  904. //! <b>Note</b>: Non-standard extension.
  905. template <class InputIterator>
  906. multimap(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp = Compare(),
  907. const allocator_type& a = allocator_type())
  908. : base_t(ordered_range, first, last, comp, a)
  909. {}
  910. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  911. //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
  912. //! allocator, and inserts elements from the range [il.begin(), il.end()).
  913. //!
  914. //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
  915. //! comp and otherwise N logN, where N is il.first() - il.end().
  916. multimap(std::initializer_list<value_type> il, const Compare& comp = Compare(),
  917. const allocator_type& a = allocator_type())
  918. : base_t(false, il.begin(), il.end(), comp, a)
  919. {
  920. //A type must be std::pair<CONST Key, T>
  921. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  922. }
  923. //! <b>Effects</b>: Constructs an empty multimap using the specified
  924. //! allocator, and inserts elements from the range [il.begin(), il.end()).
  925. //!
  926. //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
  927. //! comp and otherwise N logN, where N is il.first() - il.end().
  928. multimap(std::initializer_list<value_type> il, const allocator_type& a)
  929. : base_t(false, il.begin(), il.end(), Compare(), a)
  930. {
  931. //A type must be std::pair<CONST Key, T>
  932. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  933. }
  934. //! <b>Effects</b>: Constructs an empty set using the specified comparison object and
  935. //! allocator, and inserts elements from the ordered range [il.begin(), il.end()). This function
  936. //! is more efficient than the normal range creation for ordered ranges.
  937. //!
  938. //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate.
  939. //!
  940. //! <b>Complexity</b>: Linear in N.
  941. //!
  942. //! <b>Note</b>: Non-standard extension.
  943. multimap(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp = Compare(),
  944. const allocator_type& a = allocator_type())
  945. : base_t(ordered_range, il.begin(), il.end(), comp, a)
  946. {
  947. //A type must be std::pair<CONST Key, T>
  948. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  949. }
  950. #endif
  951. //! <b>Effects</b>: Copy constructs a multimap.
  952. //!
  953. //! <b>Complexity</b>: Linear in x.size().
  954. multimap(const multimap& x)
  955. : base_t(static_cast<const base_t&>(x))
  956. {
  957. //A type must be std::pair<CONST Key, T>
  958. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  959. }
  960. //! <b>Effects</b>: Move constructs a multimap. Constructs *this using x's resources.
  961. //!
  962. //! <b>Complexity</b>: Constant.
  963. //!
  964. //! <b>Postcondition</b>: x is emptied.
  965. multimap(BOOST_RV_REF(multimap) x)
  966. : base_t(BOOST_MOVE_BASE(base_t, x))
  967. {
  968. //A type must be std::pair<CONST Key, T>
  969. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  970. }
  971. //! <b>Effects</b>: Copy constructs a multimap.
  972. //!
  973. //! <b>Complexity</b>: Linear in x.size().
  974. multimap(const multimap& x, const allocator_type &a)
  975. : base_t(static_cast<const base_t&>(x), a)
  976. {
  977. //A type must be std::pair<CONST Key, T>
  978. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  979. }
  980. //! <b>Effects</b>: Move constructs a multimap using the specified allocator.
  981. //! Constructs *this using x's resources.
  982. //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise.
  983. //!
  984. //! <b>Postcondition</b>: x is emptied.
  985. multimap(BOOST_RV_REF(multimap) x, const allocator_type &a)
  986. : base_t(BOOST_MOVE_BASE(base_t, x), a)
  987. {
  988. //A type must be std::pair<CONST Key, T>
  989. BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
  990. }
  991. //! <b>Effects</b>: Makes *this a copy of x.
  992. //!
  993. //! <b>Complexity</b>: Linear in x.size().
  994. multimap& operator=(BOOST_COPY_ASSIGN_REF(multimap) x)
  995. { return static_cast<multimap&>(this->base_t::operator=(static_cast<const base_t&>(x))); }
  996. //! <b>Effects</b>: this->swap(x.get()).
  997. //!
  998. //! <b>Complexity</b>: Constant.
  999. multimap& operator=(BOOST_RV_REF(multimap) x)
  1000. BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
  1001. && boost::container::container_detail::is_nothrow_move_assignable<Compare>::value )
  1002. { return static_cast<multimap&>(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); }
  1003. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  1004. //! <b>Effects</b>: Assign content of il to *this.
  1005. //!
  1006. multimap& operator=(std::initializer_list<value_type> il)
  1007. {
  1008. this->clear();
  1009. insert(il.begin(), il.end());
  1010. return *this;
  1011. }
  1012. #endif
  1013. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  1014. //! @copydoc ::boost::container::set::get_allocator()
  1015. allocator_type get_allocator() const;
  1016. //! @copydoc ::boost::container::set::get_stored_allocator()
  1017. stored_allocator_type &get_stored_allocator();
  1018. //! @copydoc ::boost::container::set::get_stored_allocator() const
  1019. const stored_allocator_type &get_stored_allocator() const;
  1020. //! @copydoc ::boost::container::set::begin()
  1021. iterator begin();
  1022. //! @copydoc ::boost::container::set::begin() const
  1023. const_iterator begin() const;
  1024. //! @copydoc ::boost::container::set::cbegin() const
  1025. const_iterator cbegin() const;
  1026. //! @copydoc ::boost::container::set::end()
  1027. iterator end() BOOST_NOEXCEPT_OR_NOTHROW;
  1028. //! @copydoc ::boost::container::set::end() const
  1029. const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW;
  1030. //! @copydoc ::boost::container::set::cend() const
  1031. const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW;
  1032. //! @copydoc ::boost::container::set::rbegin()
  1033. reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW;
  1034. //! @copydoc ::boost::container::set::rbegin() const
  1035. const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
  1036. //! @copydoc ::boost::container::set::crbegin() const
  1037. const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW;
  1038. //! @copydoc ::boost::container::set::rend()
  1039. reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW;
  1040. //! @copydoc ::boost::container::set::rend() const
  1041. const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW;
  1042. //! @copydoc ::boost::container::set::crend() const
  1043. const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW;
  1044. //! @copydoc ::boost::container::set::empty() const
  1045. bool empty() const;
  1046. //! @copydoc ::boost::container::set::size() const
  1047. size_type size() const;
  1048. //! @copydoc ::boost::container::set::max_size() const
  1049. size_type max_size() const;
  1050. #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  1051. #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  1052. //! <b>Effects</b>: Inserts an object of type T constructed with
  1053. //! std::forward<Args>(args)... in the container.
  1054. //! p is a hint pointing to where the insert should start to search.
  1055. //!
  1056. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  1057. //! to the key of x.
  1058. //!
  1059. //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
  1060. //! is inserted right before p.
  1061. template <class... Args>
  1062. iterator emplace(BOOST_FWD_REF(Args)... args)
  1063. { return this->base_t::emplace_equal(boost::forward<Args>(args)...); }
  1064. //! <b>Effects</b>: Inserts an object of type T constructed with
  1065. //! std::forward<Args>(args)... in the container.
  1066. //! p is a hint pointing to where the insert should start to search.
  1067. //!
  1068. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  1069. //! to the key of x.
  1070. //!
  1071. //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
  1072. //! is inserted right before p.
  1073. template <class... Args>
  1074. iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args)
  1075. { return this->base_t::emplace_hint_equal(p, boost::forward<Args>(args)...); }
  1076. #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  1077. #define BOOST_CONTAINER_MULTIMAP_EMPLACE_CODE(N) \
  1078. BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
  1079. iterator emplace(BOOST_MOVE_UREF##N)\
  1080. { return this->base_t::emplace_equal(BOOST_MOVE_FWD##N); }\
  1081. \
  1082. BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
  1083. iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
  1084. { return this->base_t::emplace_hint_equal(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\
  1085. //
  1086. BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_MULTIMAP_EMPLACE_CODE)
  1087. #undef BOOST_CONTAINER_MULTIMAP_EMPLACE_CODE
  1088. #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
  1089. //! <b>Effects</b>: Inserts x and returns the iterator pointing to the
  1090. //! newly inserted element.
  1091. //!
  1092. //! <b>Complexity</b>: Logarithmic.
  1093. iterator insert(const value_type& x)
  1094. { return this->base_t::insert_equal(x); }
  1095. //! <b>Effects</b>: Inserts a new value constructed from x and returns
  1096. //! the iterator pointing to the newly inserted element.
  1097. //!
  1098. //! <b>Complexity</b>: Logarithmic.
  1099. iterator insert(const nonconst_value_type& x)
  1100. { return this->base_t::insert_equal(x); }
  1101. //! <b>Effects</b>: Inserts a new value move-constructed from x and returns
  1102. //! the iterator pointing to the newly inserted element.
  1103. //!
  1104. //! <b>Complexity</b>: Logarithmic.
  1105. iterator insert(BOOST_RV_REF(nonconst_value_type) x)
  1106. { return this->base_t::insert_equal(boost::move(x)); }
  1107. //! <b>Effects</b>: Inserts a new value move-constructed from x and returns
  1108. //! the iterator pointing to the newly inserted element.
  1109. //!
  1110. //! <b>Complexity</b>: Logarithmic.
  1111. iterator insert(BOOST_RV_REF(movable_value_type) x)
  1112. { return this->base_t::insert_equal(boost::move(x)); }
  1113. //! <b>Effects</b>: Inserts a copy of x in the container.
  1114. //! p is a hint pointing to where the insert should start to search.
  1115. //!
  1116. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  1117. //! to the key of x.
  1118. //!
  1119. //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
  1120. //! is inserted right before p.
  1121. iterator insert(const_iterator p, const value_type& x)
  1122. { return this->base_t::insert_equal(p, x); }
  1123. //! <b>Effects</b>: Inserts a new value constructed from x in the container.
  1124. //! p is a hint pointing to where the insert should start to search.
  1125. //!
  1126. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  1127. //! to the key of x.
  1128. //!
  1129. //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
  1130. //! is inserted right before p.
  1131. iterator insert(const_iterator p, const nonconst_value_type& x)
  1132. { return this->base_t::insert_equal_convertible(p, x); }
  1133. //! <b>Effects</b>: Inserts a new value move constructed from x in the container.
  1134. //! p is a hint pointing to where the insert should start to search.
  1135. //!
  1136. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  1137. //! to the key of x.
  1138. //!
  1139. //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
  1140. //! is inserted right before p.
  1141. iterator insert(const_iterator p, BOOST_RV_REF(nonconst_value_type) x)
  1142. { return this->base_t::insert_equal_convertible(p, boost::move(x)); }
  1143. //! <b>Effects</b>: Inserts a new value move constructed from x in the container.
  1144. //! p is a hint pointing to where the insert should start to search.
  1145. //!
  1146. //! <b>Returns</b>: An iterator pointing to the element with key equivalent
  1147. //! to the key of x.
  1148. //!
  1149. //! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
  1150. //! is inserted right before p.
  1151. iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x)
  1152. { return this->base_t::insert_equal_convertible(p, boost::move(x)); }
  1153. //! <b>Requires</b>: first, last are not iterators into *this.
  1154. //!
  1155. //! <b>Effects</b>: inserts each element from the range [first,last) .
  1156. //!
  1157. //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
  1158. template <class InputIterator>
  1159. void insert(InputIterator first, InputIterator last)
  1160. { this->base_t::insert_equal(first, last); }
  1161. #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
  1162. //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end().
  1163. //!
  1164. //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from il.begin() to il.end())
  1165. void insert(std::initializer_list<value_type> il)
  1166. { this->base_t::insert_equal(il.begin(), il.end()); }
  1167. #endif
  1168. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  1169. //! @copydoc ::boost::container::set::erase(const_iterator)
  1170. iterator erase(const_iterator p);
  1171. //! @copydoc ::boost::container::set::erase(const key_type&)
  1172. size_type erase(const key_type& x);
  1173. //! @copydoc ::boost::container::set::erase(const_iterator,const_iterator)
  1174. iterator erase(const_iterator first, const_iterator last);
  1175. //! @copydoc ::boost::container::set::swap
  1176. void swap(multiset& x)
  1177. BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
  1178. && boost::container::container_detail::is_nothrow_swappable<Compare>::value );
  1179. //! @copydoc ::boost::container::set::clear
  1180. void clear() BOOST_NOEXCEPT_OR_NOTHROW;
  1181. //! @copydoc ::boost::container::set::key_comp
  1182. key_compare key_comp() const;
  1183. //! @copydoc ::boost::container::set::value_comp
  1184. value_compare value_comp() const;
  1185. //! <b>Returns</b>: An iterator pointing to an element with the key
  1186. //! equivalent to x, or end() if such an element is not found.
  1187. //!
  1188. //! <b>Complexity</b>: Logarithmic.
  1189. iterator find(const key_type& x);
  1190. //! <b>Returns</b>: A const iterator pointing to an element with the key
  1191. //! equivalent to x, or end() if such an element is not found.
  1192. //!
  1193. //! <b>Complexity</b>: Logarithmic.
  1194. const_iterator find(const key_type& x) const;
  1195. //! <b>Returns</b>: The number of elements with key equivalent to x.
  1196. //!
  1197. //! <b>Complexity</b>: log(size())+count(k)
  1198. size_type count(const key_type& x) const;
  1199. //! <b>Returns</b>: An iterator pointing to the first element with key not less
  1200. //! than k, or a.end() if such an element is not found.
  1201. //!
  1202. //! <b>Complexity</b>: Logarithmic
  1203. iterator lower_bound(const key_type& x);
  1204. //! <b>Returns</b>: A const iterator pointing to the first element with key not
  1205. //! less than k, or a.end() if such an element is not found.
  1206. //!
  1207. //! <b>Complexity</b>: Logarithmic
  1208. const_iterator lower_bound(const key_type& x) const;
  1209. //! <b>Returns</b>: An iterator pointing to the first element with key not less
  1210. //! than x, or end() if such an element is not found.
  1211. //!
  1212. //! <b>Complexity</b>: Logarithmic
  1213. iterator upper_bound(const key_type& x);
  1214. //! <b>Returns</b>: A const iterator pointing to the first element with key not
  1215. //! less than x, or end() if such an element is not found.
  1216. //!
  1217. //! <b>Complexity</b>: Logarithmic
  1218. const_iterator upper_bound(const key_type& x) const;
  1219. //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
  1220. //!
  1221. //! <b>Complexity</b>: Logarithmic
  1222. std::pair<iterator,iterator> equal_range(const key_type& x);
  1223. //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
  1224. //!
  1225. //! <b>Complexity</b>: Logarithmic
  1226. std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const;
  1227. //! <b>Effects</b>: Rebalances the tree. It's a no-op for Red-Black and AVL trees.
  1228. //!
  1229. //! <b>Complexity</b>: Linear
  1230. void rebalance();
  1231. //! <b>Effects</b>: Returns true if x and y are equal
  1232. //!
  1233. //! <b>Complexity</b>: Linear to the number of elements in the container.
  1234. friend bool operator==(const multimap& x, const multimap& y);
  1235. //! <b>Effects</b>: Returns true if x and y are unequal
  1236. //!
  1237. //! <b>Complexity</b>: Linear to the number of elements in the container.
  1238. friend bool operator!=(const multimap& x, const multimap& y);
  1239. //! <b>Effects</b>: Returns true if x is less than y
  1240. //!
  1241. //! <b>Complexity</b>: Linear to the number of elements in the container.
  1242. friend bool operator<(const multimap& x, const multimap& y);
  1243. //! <b>Effects</b>: Returns true if x is greater than y
  1244. //!
  1245. //! <b>Complexity</b>: Linear to the number of elements in the container.
  1246. friend bool operator>(const multimap& x, const multimap& y);
  1247. //! <b>Effects</b>: Returns true if x is equal or less than y
  1248. //!
  1249. //! <b>Complexity</b>: Linear to the number of elements in the container.
  1250. friend bool operator<=(const multimap& x, const multimap& y);
  1251. //! <b>Effects</b>: Returns true if x is equal or greater than y
  1252. //!
  1253. //! <b>Complexity</b>: Linear to the number of elements in the container.
  1254. friend bool operator>=(const multimap& x, const multimap& y);
  1255. //! <b>Effects</b>: x.swap(y)
  1256. //!
  1257. //! <b>Complexity</b>: Constant.
  1258. friend void swap(multimap& x, multimap& y);
  1259. #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
  1260. };
  1261. #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  1262. } //namespace container {
  1263. //!has_trivial_destructor_after_move<> == true_type
  1264. //!specialization for optimizations
  1265. template <class Key, class T, class Compare, class Allocator>
  1266. struct has_trivial_destructor_after_move<boost::container::multimap<Key, T, Compare, Allocator> >
  1267. {
  1268. typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
  1269. static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
  1270. ::boost::has_trivial_destructor_after_move<pointer>::value &&
  1271. ::boost::has_trivial_destructor_after_move<Compare>::value;
  1272. };
  1273. namespace container {
  1274. #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
  1275. }}
  1276. #include <boost/container/detail/config_end.hpp>
  1277. #endif // BOOST_CONTAINER_MAP_HPP