autodoc.xml 280 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176
  1. <?xml version="1.0" standalone="yes"?>
  2. <library-reference id="boost_circular_buffer_c___reference"><title>Boost.Circular_buffer C++ Reference</title><header name="boost/circular_buffer.hpp">
  3. <para>Includes &lt;boost/circular_buffer/base.hpp&gt; </para><macro name="BOOST_CB_ENABLE_DEBUG"><description><para>Debug support control. </para></description></macro>
  4. </header>
  5. <header name="boost/circular_buffer/base.hpp">
  6. <namespace name="boost">
  7. <class name="circular_buffer"><template>
  8. <template-type-parameter name="T"><purpose><para>The type of the elements stored in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para></purpose></template-type-parameter>
  9. <template-type-parameter name="Alloc"><purpose><para>The allocator type used for all internal memory management. </para></purpose></template-type-parameter>
  10. </template><inherit access="private">empty_value&lt; Alloc &gt;</inherit><purpose>Circular buffer - a STL compliant container. </purpose><description><para>
  11. <formalpara><title>Type Requirements T</title><para>The <computeroutput>T</computeroutput> has to be <ulink url="https://www.boost.org/sgi/stl/Assignable.html">SGIAssignable</ulink> (SGI STL defined combination of <ulink url="../../../utility/Assignable.html">Assignable</ulink> and <ulink url="../../../utility/CopyConstructible.html">CopyConstructible</ulink>). Moreover <computeroutput>T</computeroutput> has to be <ulink url="https://www.boost.org/sgi/stl/DefaultConstructible.html">DefaultConstructible</ulink> if supplied as a default parameter when invoking some of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>'s methods e.g. <computeroutput>insert(iterator pos, const value_type&amp; item = value_type())</computeroutput>. And <ulink url="https://www.boost.org/sgi/stl/EqualityComparable.html">EqualityComparable</ulink> and/or <ulink url="../../../utility/LessThanComparable.html">LessThanComparable</ulink> if the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be compared with another container. </para>
  12. </formalpara>
  13. <formalpara><title>Type Requirements Alloc</title><para>The <computeroutput>Alloc</computeroutput> has to meet the allocator requirements imposed by STL. </para>
  14. </formalpara>
  15. <formalpara><title>Default Alloc</title><para>std::allocator&lt;T&gt;</para>
  16. </formalpara>
  17. For detailed documentation of the <classname alt="boost::circular_buffer">circular_buffer</classname> visit: <ulink url="http://www.boost.org/libs/circular_buffer/doc/circular_buffer.html">http://www.boost.org/libs/circular_buffer/doc/circular_buffer.html</ulink> </para></description><typedef name="this_type"><purpose>The type of this <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;</type></typedef>
  18. <typedef name="value_type"><purpose>The type of elements stored in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><type>cb_details::allocator_traits&lt; Alloc &gt;::value_type</type></typedef>
  19. <typedef name="pointer"><purpose>A pointer to an element. </purpose><type>cb_details::allocator_traits&lt; Alloc &gt;::pointer</type></typedef>
  20. <typedef name="const_pointer"><purpose>A const pointer to the element. </purpose><type>cb_details::allocator_traits&lt; Alloc &gt;::const_pointer</type></typedef>
  21. <typedef name="reference"><purpose>A reference to an element. </purpose><type>value_type &amp;</type></typedef>
  22. <typedef name="const_reference"><purpose>A const reference to an element. </purpose><type>const value_type &amp;</type></typedef>
  23. <typedef name="difference_type"><purpose>The distance type. </purpose><description><para>(A signed integral type used to represent the distance between two iterators.) </para></description><type>cb_details::allocator_traits&lt; Alloc &gt;::difference_type</type></typedef>
  24. <typedef name="size_type"><purpose>The size type. </purpose><description><para>(An unsigned integral type that can represent any non-negative value of the container's distance type.) </para></description><type>cb_details::allocator_traits&lt; Alloc &gt;::size_type</type></typedef>
  25. <typedef name="allocator_type"><purpose>The type of an allocator used in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><type>Alloc</type></typedef>
  26. <typedef name="const_iterator"><purpose>A const (random access) iterator used to iterate through the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><type>cb_details::iterator&lt; <classname>circular_buffer</classname>&lt; T, Alloc &gt;, cb_details::const_traits&lt; cb_details::allocator_traits&lt; Alloc &gt; &gt; &gt;</type></typedef>
  27. <typedef name="iterator"><purpose>A (random access) iterator used to iterate through the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><type>cb_details::iterator&lt; <classname>circular_buffer</classname>&lt; T, Alloc &gt;, cb_details::nonconst_traits&lt; cb_details::allocator_traits&lt; Alloc &gt; &gt; &gt;</type></typedef>
  28. <typedef name="const_reverse_iterator"><purpose>A const iterator used to iterate backwards through a <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><type>std::reverse_iterator&lt; const_iterator &gt;</type></typedef>
  29. <typedef name="reverse_iterator"><purpose>An iterator used to iterate backwards through a <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><type>std::reverse_iterator&lt; iterator &gt;</type></typedef>
  30. <typedef name="array_range"><purpose>An array range. </purpose><description><para>(A typedef for the <ulink url="https://www.boost.org/sgi/stl/pair.html"><computeroutput>std::pair</computeroutput></ulink> where its first element is a pointer to a beginning of an array and its second element represents a size of the array.) </para></description><type>std::pair&lt; pointer, size_type &gt;</type></typedef>
  31. <typedef name="const_array_range"><purpose>A range of a const array. </purpose><description><para>(A typedef for the <ulink url="https://www.boost.org/sgi/stl/pair.html"><computeroutput>std::pair</computeroutput></ulink> where its first element is a pointer to a beginning of a const array and its second element represents a size of the const array.) </para></description><type>std::pair&lt; const_pointer, size_type &gt;</type></typedef>
  32. <typedef name="capacity_type"><purpose>The capacity type. </purpose><description><para>(Same as <computeroutput>size_type</computeroutput> - defined for consistency with the __cbso class. </para></description><type>size_type</type></typedef>
  33. <typedef name="param_value_type"><purpose>A type representing the "best" way to pass the value_type to a method. </purpose><type>const value_type &amp;</type></typedef>
  34. <typedef name="rvalue_type"><description><para>A type representing rvalue from param type. On compilers without rvalue references support this type is the Boost.Moves type used for emulation. </para></description><type>value_type &amp;&amp;</type></typedef>
  35. <method-group name="public member functions">
  36. <method name="get_allocator" cv="const noexcept"><type>allocator_type</type><purpose>Get the allocator. </purpose><description><para>
  37. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  38. </formalpara>
  39. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  40. </formalpara>
  41. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  42. </formalpara>
  43. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>get_allocator()</computeroutput> for obtaining an allocator reference. </para>
  44. </para>
  45. </para></description><returns><para>The allocator. </para>
  46. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  47. <method name="get_allocator" cv="noexcept"><type>allocator_type &amp;</type><purpose>Get the allocator reference. </purpose><description><para>
  48. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  49. </formalpara>
  50. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  51. </formalpara>
  52. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  53. </formalpara>
  54. <note><para>This method was added in order to optimize obtaining of the allocator with a state, although use of stateful allocators in STL is discouraged. </para>
  55. </note>
  56. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>get_allocator() const</computeroutput> </para>
  57. </para>
  58. </para></description><returns><para>A reference to the allocator. </para>
  59. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  60. <method name="begin" cv="noexcept"><type>iterator</type><purpose>Get the iterator pointing to the beginning of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  61. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  62. </formalpara>
  63. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  64. </formalpara>
  65. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  66. </formalpara>
  67. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>end()</computeroutput>, <computeroutput>rbegin()</computeroutput>, <computeroutput>rend()</computeroutput> </para>
  68. </para>
  69. </para></description><returns><para>A random access iterator pointing to the first element of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is empty it returns an iterator equal to the one returned by <computeroutput>end()</computeroutput>. </para>
  70. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  71. <method name="end" cv="noexcept"><type>iterator</type><purpose>Get the iterator pointing to the end of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  72. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  73. </formalpara>
  74. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  75. </formalpara>
  76. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  77. </formalpara>
  78. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>begin()</computeroutput>, <computeroutput>rbegin()</computeroutput>, <computeroutput>rend()</computeroutput> </para>
  79. </para>
  80. </para></description><returns><para>A random access iterator pointing to the element "one behind" the last element of the <computeroutput> <classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is empty it returns an iterator equal to the one returned by <computeroutput>begin()</computeroutput>. </para>
  81. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  82. <method name="begin" cv="const noexcept"><type>const_iterator</type><purpose>Get the const iterator pointing to the beginning of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  83. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  84. </formalpara>
  85. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  86. </formalpara>
  87. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  88. </formalpara>
  89. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>end() const</computeroutput>, <computeroutput>rbegin() const</computeroutput>, <computeroutput>rend() const</computeroutput> </para>
  90. </para>
  91. </para></description><returns><para>A const random access iterator pointing to the first element of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is empty it returns an iterator equal to the one returned by <computeroutput>end() const</computeroutput>. </para>
  92. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  93. <method name="end" cv="const noexcept"><type>const_iterator</type><purpose>Get the const iterator pointing to the end of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  94. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  95. </formalpara>
  96. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  97. </formalpara>
  98. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  99. </formalpara>
  100. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>begin() const</computeroutput>, <computeroutput>rbegin() const</computeroutput>, <computeroutput>rend() const</computeroutput> </para>
  101. </para>
  102. </para></description><returns><para>A const random access iterator pointing to the element "one behind" the last element of the <computeroutput> <classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is empty it returns an iterator equal to the one returned by <computeroutput>begin() const</computeroutput> const. </para>
  103. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  104. <method name="rbegin" cv="noexcept"><type>reverse_iterator</type><purpose>Get the iterator pointing to the beginning of the "reversed" <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  105. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  106. </formalpara>
  107. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  108. </formalpara>
  109. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  110. </formalpara>
  111. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rend()</computeroutput>, <computeroutput>begin()</computeroutput>, <computeroutput>end()</computeroutput> </para>
  112. </para>
  113. </para></description><returns><para>A reverse random access iterator pointing to the last element of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is empty it returns an iterator equal to the one returned by <computeroutput>rend()</computeroutput>. </para>
  114. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  115. <method name="rend" cv="noexcept"><type>reverse_iterator</type><purpose>Get the iterator pointing to the end of the "reversed" <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  116. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  117. </formalpara>
  118. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  119. </formalpara>
  120. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  121. </formalpara>
  122. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rbegin()</computeroutput>, <computeroutput>begin()</computeroutput>, <computeroutput>end()</computeroutput> </para>
  123. </para>
  124. </para></description><returns><para>A reverse random access iterator pointing to the element "one before" the first element of the <computeroutput> <classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is empty it returns an iterator equal to the one returned by <computeroutput>rbegin()</computeroutput>. </para>
  125. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  126. <method name="rbegin" cv="const noexcept"><type>const_reverse_iterator</type><purpose>Get the const iterator pointing to the beginning of the "reversed" <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  127. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  128. </formalpara>
  129. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  130. </formalpara>
  131. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  132. </formalpara>
  133. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rend() const</computeroutput>, <computeroutput>begin() const</computeroutput>, <computeroutput>end() const</computeroutput> </para>
  134. </para>
  135. </para></description><returns><para>A const reverse random access iterator pointing to the last element of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is empty it returns an iterator equal to the one returned by <computeroutput>rend() const</computeroutput>. </para>
  136. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  137. <method name="rend" cv="const noexcept"><type>const_reverse_iterator</type><purpose>Get the const iterator pointing to the end of the "reversed" <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  138. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  139. </formalpara>
  140. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  141. </formalpara>
  142. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  143. </formalpara>
  144. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rbegin() const</computeroutput>, <computeroutput>begin() const</computeroutput>, <computeroutput>end() const</computeroutput> </para>
  145. </para>
  146. </para></description><returns><para>A const reverse random access iterator pointing to the element "one before" the first element of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is empty it returns an iterator equal to the one returned by <computeroutput>rbegin() const</computeroutput>. </para>
  147. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  148. <method name="operator []"><type>reference</type><parameter name="index"><paramtype>size_type</paramtype><description><para>The position of the element. </para></description></parameter><purpose>Get the element at the <computeroutput>index</computeroutput> position. </purpose><description><para>
  149. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  150. </formalpara>
  151. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  152. </formalpara>
  153. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  154. </formalpara>
  155. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>at()</computeroutput> </para>
  156. </para>
  157. </para></description><requires><para><computeroutput>0 &lt;= index &amp;&amp; index &lt; size()</computeroutput> </para>
  158. </requires><returns><para>A reference to the element at the <computeroutput>index</computeroutput> position. </para>
  159. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  160. <method name="operator []" cv="const"><type>const_reference</type><parameter name="index"><paramtype>size_type</paramtype><description><para>The position of the element. </para></description></parameter><purpose>Get the element at the <computeroutput>index</computeroutput> position. </purpose><description><para>
  161. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  162. </formalpara>
  163. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  164. </formalpara>
  165. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  166. </formalpara>
  167. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>at() const </computeroutput> </para>
  168. </para>
  169. </para></description><requires><para><computeroutput>0 &lt;= index &amp;&amp; index &lt; size()</computeroutput> </para>
  170. </requires><returns><para>A const reference to the element at the <computeroutput>index</computeroutput> position. </para>
  171. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  172. <method name="at"><type>reference</type><parameter name="index"><paramtype>size_type</paramtype><description><para>The position of the element. </para></description></parameter><purpose>Get the element at the <computeroutput>index</computeroutput> position. </purpose><description><para>
  173. <formalpara><title>Exception Safety</title><para>Strong. </para>
  174. </formalpara>
  175. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  176. </formalpara>
  177. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  178. </formalpara>
  179. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>operator[] </computeroutput> </para>
  180. </para>
  181. </para></description><returns><para>A reference to the element at the <computeroutput>index</computeroutput> position. </para>
  182. </returns><throws><simpara><classname>&lt;code&gt;std::out_of_range&lt;/code&gt;</classname> when the <computeroutput>index</computeroutput> is invalid (when <computeroutput>index &gt;= size()</computeroutput>). </simpara></throws></method>
  183. <method name="at" cv="const"><type>const_reference</type><parameter name="index"><paramtype>size_type</paramtype><description><para>The position of the element. </para></description></parameter><purpose>Get the element at the <computeroutput>index</computeroutput> position. </purpose><description><para>
  184. <formalpara><title>Exception Safety</title><para>Strong. </para>
  185. </formalpara>
  186. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  187. </formalpara>
  188. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  189. </formalpara>
  190. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>operator[] const </computeroutput> </para>
  191. </para>
  192. </para></description><returns><para>A const reference to the element at the <computeroutput>index</computeroutput> position. </para>
  193. </returns><throws><simpara><classname>&lt;code&gt;std::out_of_range&lt;/code&gt;</classname> when the <computeroutput>index</computeroutput> is invalid (when <computeroutput>index &gt;= size()</computeroutput>). </simpara></throws></method>
  194. <method name="front"><type>reference</type><purpose>Get the first element. </purpose><description><para>
  195. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  196. </formalpara>
  197. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  198. </formalpara>
  199. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  200. </formalpara>
  201. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>back()</computeroutput> </para>
  202. </para>
  203. </para></description><requires><para><computeroutput>!empty()</computeroutput> </para>
  204. </requires><returns><para>A reference to the first element of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para>
  205. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  206. <method name="back"><type>reference</type><purpose>Get the last element. </purpose><description><para>
  207. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  208. </formalpara>
  209. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  210. </formalpara>
  211. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  212. </formalpara>
  213. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>front()</computeroutput> </para>
  214. </para>
  215. </para></description><requires><para><computeroutput>!empty()</computeroutput> </para>
  216. </requires><returns><para>A reference to the last element of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para>
  217. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  218. <method name="front" cv="const"><type>const_reference</type><purpose>Get the first element. </purpose><description><para>
  219. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  220. </formalpara>
  221. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  222. </formalpara>
  223. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  224. </formalpara>
  225. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>back() const</computeroutput> </para>
  226. </para>
  227. </para></description><requires><para><computeroutput>!empty()</computeroutput> </para>
  228. </requires><returns><para>A const reference to the first element of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para>
  229. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  230. <method name="back" cv="const"><type>const_reference</type><purpose>Get the last element. </purpose><description><para>
  231. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  232. </formalpara>
  233. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  234. </formalpara>
  235. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  236. </formalpara>
  237. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>front() const</computeroutput> </para>
  238. </para>
  239. </para></description><requires><para><computeroutput>!empty()</computeroutput> </para>
  240. </requires><returns><para>A const reference to the last element of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para>
  241. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  242. <method name="array_one"><type>array_range</type><purpose>Get the first continuous array of the internal buffer. </purpose><description><para>This method in combination with <computeroutput>array_two()</computeroutput> can be useful when passing the stored data into a legacy C API as an array. Suppose there is a <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> of capacity 10, containing 7 characters <computeroutput>'a', 'b', ..., 'g'</computeroutput> where <computeroutput>buff[0] == 'a'</computeroutput>, <computeroutput>buff[1] == 'b'</computeroutput>, ... and <computeroutput>buff[6] == 'g'</computeroutput>:<sbr/>
  243. <sbr/>
  244. <computeroutput>circular_buffer&lt;char&gt; buff(10);</computeroutput><sbr/>
  245. <sbr/>
  246. The internal representation is often not linear and the state of the internal buffer may look like this:<sbr/>
  247. <sbr/>
  248. <computeroutput> |e|f|g| | | |a|b|c|d|<sbr/>
  249. end ___^<sbr/>
  250. begin _______^</computeroutput><sbr/>
  251. <sbr/>
  252. </para><para>where <computeroutput>|a|b|c|d|</computeroutput> represents the "array one", <computeroutput>|e|f|g|</computeroutput> represents the "array two" and <computeroutput>| | | |</computeroutput> is a free space.<sbr/>
  253. Now consider a typical C style function for writing data into a file:<sbr/>
  254. <sbr/>
  255. <computeroutput>int write(int file_desc, char* buff, int num_bytes);</computeroutput><sbr/>
  256. <sbr/>
  257. There are two ways how to write the content of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> into a file. Either relying on <computeroutput>array_one()</computeroutput> and <computeroutput>array_two()</computeroutput> methods and calling the write function twice:<sbr/>
  258. <sbr/>
  259. <computeroutput>array_range ar = buff.array_one();<sbr/>
  260. write(file_desc, ar.first, ar.second);<sbr/>
  261. ar = buff.array_two();<sbr/>
  262. write(file_desc, ar.first, ar.second);</computeroutput><sbr/>
  263. <sbr/>
  264. Or relying on the <computeroutput>linearize()</computeroutput> method:<sbr/>
  265. <sbr/>
  266. <computeroutput> write(file_desc, buff.linearize(), buff.size());</computeroutput><sbr/>
  267. <sbr/>
  268. Since the complexity of <computeroutput>array_one()</computeroutput> and <computeroutput>array_two()</computeroutput> methods is constant the first option is suitable when calling the write method is "cheap". On the other hand the second option is more suitable when calling the write method is more "expensive" than calling the <computeroutput>linearize()</computeroutput> method whose complexity is linear.
  269. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  270. </formalpara>
  271. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  272. </formalpara>
  273. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  274. </formalpara>
  275. <warning><para>In general invoking any method which modifies the internal state of the <classname alt="boost::circular_buffer">circular_buffer</classname> may delinearize the internal buffer and invalidate the array ranges returned by <computeroutput>array_one()</computeroutput> and <computeroutput>array_two()</computeroutput> (and their const versions). </para>
  276. </warning>
  277. <note><para>In the case the internal buffer is linear e.g. <computeroutput>|a|b|c|d|e|f|g| | | |</computeroutput> the "array one" is represented by <computeroutput>|a|b|c|d|e|f|g|</computeroutput> and the "array two" does not exist (the <computeroutput>array_two()</computeroutput> method returns an array with the size <computeroutput>0</computeroutput>). </para>
  278. </note>
  279. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>array_two()</computeroutput>, <computeroutput>linearize()</computeroutput> </para>
  280. </para>
  281. </para></description><returns><para>The array range of the first continuous array of the internal buffer. In the case the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is empty the size of the returned array is <computeroutput>0</computeroutput>. </para>
  282. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  283. <method name="array_two"><type>array_range</type><purpose>Get the second continuous array of the internal buffer. </purpose><description><para>This method in combination with <computeroutput>array_one()</computeroutput> can be useful when passing the stored data into a legacy C API as an array.
  284. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  285. </formalpara>
  286. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  287. </formalpara>
  288. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  289. </formalpara>
  290. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>array_one()</computeroutput> </para>
  291. </para>
  292. </para></description><returns><para>The array range of the second continuous array of the internal buffer. In the case the internal buffer is linear or the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is empty the size of the returned array is <computeroutput>0</computeroutput>. </para>
  293. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  294. <method name="array_one" cv="const"><type>const_array_range</type><purpose>Get the first continuous array of the internal buffer. </purpose><description><para>This method in combination with <computeroutput>array_two() const</computeroutput> can be useful when passing the stored data into a legacy C API as an array.
  295. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  296. </formalpara>
  297. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  298. </formalpara>
  299. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  300. </formalpara>
  301. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>array_two() const</computeroutput>; <computeroutput>array_one()</computeroutput> for more details how to pass data into a legacy C API. </para>
  302. </para>
  303. </para></description><returns><para>The array range of the first continuous array of the internal buffer. In the case the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is empty the size of the returned array is <computeroutput>0</computeroutput>. </para>
  304. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  305. <method name="array_two" cv="const"><type>const_array_range</type><purpose>Get the second continuous array of the internal buffer. </purpose><description><para>This method in combination with <computeroutput>array_one() const</computeroutput> can be useful when passing the stored data into a legacy C API as an array.
  306. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  307. </formalpara>
  308. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  309. </formalpara>
  310. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  311. </formalpara>
  312. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>array_one() const</computeroutput> </para>
  313. </para>
  314. </para></description><returns><para>The array range of the second continuous array of the internal buffer. In the case the internal buffer is linear or the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is empty the size of the returned array is <computeroutput>0</computeroutput>. </para>
  315. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  316. <method name="linearize"><type>pointer</type><purpose>Linearize the internal buffer into a continuous array. </purpose><description><para>This method can be useful when passing the stored data into a legacy C API as an array.
  317. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operations in the <emphasis>Throws</emphasis> section do not throw anything. </para>
  318. </formalpara>
  319. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>); does not invalidate any iterators if the postcondition (the <emphasis>Effect</emphasis>) is already met prior calling this method. </para>
  320. </formalpara>
  321. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>); constant if the postcondition (the <emphasis>Effect</emphasis>) is already met. </para>
  322. </formalpara>
  323. <warning><para>In general invoking any method which modifies the internal state of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> may delinearize the internal buffer and invalidate the returned pointer. </para>
  324. </warning>
  325. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>array_one()</computeroutput> and <computeroutput>array_two()</computeroutput> for the other option how to pass data into a legacy C API; <computeroutput>is_linearized()</computeroutput>, <computeroutput>rotate(const_iterator)</computeroutput> </para>
  326. </para>
  327. </para></description><postconditions><para><computeroutput>&amp;(*this)[0] &lt; &amp;(*this)[1] &lt; ... &lt; &amp;(*this)[size() - 1]</computeroutput> </para>
  328. </postconditions><returns><para>A pointer to the beginning of the array or <computeroutput>0</computeroutput> if empty. </para>
  329. </returns><throws><simpara><classname>&lt;a</classname> href="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t"&gt;Exceptions of move_if_noexcept(T&amp;). </simpara></throws></method>
  330. <method name="is_linearized" cv="const noexcept"><type>bool</type><purpose>Is the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> linearized? </purpose><description><para>
  331. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  332. </formalpara>
  333. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  334. </formalpara>
  335. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  336. </formalpara>
  337. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>linearize()</computeroutput>, <computeroutput>array_one()</computeroutput>, <computeroutput>array_two()</computeroutput> </para>
  338. </para>
  339. </para></description><returns><para><computeroutput>true</computeroutput> if the internal buffer is linearized into a continuous array (i.e. the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> meets a condition <computeroutput>&amp;(*this)[0] &lt; &amp;(*this)[1] &lt; ... &lt; &amp;(*this)[size() - 1]</computeroutput>); <computeroutput>false</computeroutput> otherwise. </para>
  340. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  341. <method name="rotate"><type>void</type><parameter name="new_begin"><paramtype>const_iterator</paramtype><description><para>The new beginning. </para></description></parameter><purpose>Rotate elements in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>A more effective implementation of <computeroutput><ulink url="https://www.boost.org/sgi/stl/rotate.html">std::rotate</ulink></computeroutput>.
  342. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full or <computeroutput>new_begin</computeroutput> points to <computeroutput>begin()</computeroutput> or if the operations in the <emphasis>Throws</emphasis> section do not throw anything. </para>
  343. </formalpara>
  344. <formalpara><title>Iterator Invalidation</title><para>If <computeroutput>m &lt; n</computeroutput> invalidates iterators pointing to the last <computeroutput>m</computeroutput> elements (<emphasis role="bold">including</emphasis> <computeroutput>new_begin</computeroutput>, but not iterators equal to <computeroutput>end()</computeroutput>) else invalidates iterators pointing to the first <computeroutput>n</computeroutput> elements; does not invalidate any iterators if the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full. </para>
  345. </formalpara>
  346. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>(std::min)(m, n)</computeroutput>); constant if the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full. </para>
  347. </formalpara>
  348. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput><ulink url="https://www.boost.org/sgi/stl/rotate.html">std::rotate</ulink></computeroutput> </para>
  349. </para>
  350. </para></description><requires><para><computeroutput>new_begin</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> <emphasis role="bold">except</emphasis> its end. </para>
  351. </requires><postconditions><para>Before calling the method suppose:<sbr/>
  352. <sbr/>
  353. <computeroutput>m == std::distance(new_begin, end())</computeroutput><sbr/>
  354. <computeroutput>n == std::distance(begin(), new_begin)</computeroutput> <sbr/>
  355. <computeroutput>val_0 == *new_begin, val_1 == *(new_begin + 1), ... val_m == *(new_begin + m)</computeroutput><sbr/>
  356. <computeroutput>val_r1 == *(new_begin - 1), val_r2 == *(new_begin - 2), ... val_rn == *(new_begin - n)</computeroutput><sbr/>
  357. <sbr/>
  358. then after call to the method:<sbr/>
  359. <sbr/>
  360. <computeroutput>val_0 == (*this)[0] &amp;&amp; val_1 == (*this)[1] &amp;&amp; ... &amp;&amp; val_m == (*this)[m - 1] &amp;&amp; val_r1 == (*this)[m + n - 1] &amp;&amp; val_r2 == (*this)[m + n - 2] &amp;&amp; ... &amp;&amp; val_rn == (*this)[m]</computeroutput> </para>
  361. </postconditions><throws><simpara><classname>See</classname> <ulink url="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&amp;)</ulink>. </simpara></throws></method>
  362. <method name="size" cv="const noexcept"><type>size_type</type><purpose>Get the number of elements currently stored in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  363. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  364. </formalpara>
  365. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  366. </formalpara>
  367. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  368. </formalpara>
  369. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>capacity()</computeroutput>, <computeroutput>max_size()</computeroutput>, <computeroutput>reserve()</computeroutput>, <computeroutput>resize(size_type, const_reference)</computeroutput> </para>
  370. </para>
  371. </para></description><returns><para>The number of elements stored in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para>
  372. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  373. <method name="max_size" cv="const noexcept"><type>size_type</type><purpose>Get the largest possible size or capacity of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. (It depends on allocator's max_size()). </purpose><description><para>
  374. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  375. </formalpara>
  376. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  377. </formalpara>
  378. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  379. </formalpara>
  380. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>size()</computeroutput>, <computeroutput>capacity()</computeroutput>, <computeroutput>reserve()</computeroutput> </para>
  381. </para>
  382. </para></description><returns><para>The maximum size/capacity the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> can be set to. </para>
  383. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  384. <method name="empty" cv="const noexcept"><type>bool</type><purpose>Is the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> empty? </purpose><description><para>
  385. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  386. </formalpara>
  387. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  388. </formalpara>
  389. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  390. </formalpara>
  391. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>full()</computeroutput> </para>
  392. </para>
  393. </para></description><returns><para><computeroutput>true</computeroutput> if there are no elements stored in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>; <computeroutput>false</computeroutput> otherwise. </para>
  394. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  395. <method name="full" cv="const noexcept"><type>bool</type><purpose>Is the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> full? </purpose><description><para>
  396. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  397. </formalpara>
  398. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  399. </formalpara>
  400. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  401. </formalpara>
  402. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>empty()</computeroutput> </para>
  403. </para>
  404. </para></description><returns><para><computeroutput>true</computeroutput> if the number of elements stored in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> equals the capacity of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>; <computeroutput>false</computeroutput> otherwise. </para>
  405. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  406. <method name="reserve" cv="const noexcept"><type>size_type</type><purpose>Get the maximum number of elements which can be inserted into the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> without overwriting any of already stored elements. </purpose><description><para>
  407. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  408. </formalpara>
  409. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  410. </formalpara>
  411. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  412. </formalpara>
  413. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>capacity()</computeroutput>, <computeroutput>size()</computeroutput>, <computeroutput>max_size()</computeroutput> </para>
  414. </para>
  415. </para></description><returns><para><computeroutput>capacity() - size()</computeroutput> </para>
  416. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  417. <method name="capacity" cv="const noexcept"><type>capacity_type</type><purpose>Get the capacity of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  418. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  419. </formalpara>
  420. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  421. </formalpara>
  422. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  423. </formalpara>
  424. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>reserve()</computeroutput>, <computeroutput>size()</computeroutput>, <computeroutput>max_size()</computeroutput>, <computeroutput>set_capacity(capacity_type)</computeroutput> </para>
  425. </para>
  426. </para></description><returns><para>The maximum number of elements which can be stored in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para>
  427. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  428. <method name="set_capacity"><type>void</type><parameter name="new_capacity"><paramtype>capacity_type</paramtype><description><para>The new capacity. </para></description></parameter><purpose>Change the capacity of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  429. <formalpara><title>Exception Safety</title><para>Strong. </para>
  430. </formalpara>
  431. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>) if the new capacity is different from the original. </para>
  432. </formalpara>
  433. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>min[size(), new_capacity]</computeroutput>). </para>
  434. </formalpara>
  435. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rset_capacity(capacity_type)</computeroutput>, <computeroutput>resize(size_type, const_reference)</computeroutput> </para>
  436. </para>
  437. </para></description><requires><para>If <computeroutput>T</computeroutput> is a move only type, then compiler shall support <computeroutput>noexcept</computeroutput> modifiers and move constructor of <computeroutput>T</computeroutput> must be marked with it (must not throw exceptions). </para>
  438. </requires><postconditions><para><computeroutput>capacity() == new_capacity &amp;&amp; size() &lt;= new_capacity</computeroutput><sbr/>
  439. <sbr/>
  440. If the current number of elements stored in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is greater than the desired new capacity then number of <computeroutput>[size() - new_capacity]</computeroutput> <emphasis role="bold">last</emphasis> elements will be removed and the new size will be equal to <computeroutput>new_capacity</computeroutput>. </para>
  441. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted, (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  442. <method name="resize"><type>void</type><parameter name="new_size"><paramtype>size_type</paramtype><description><para>The new size. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><default>value_type()</default><description><para>The element the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be filled with in order to gain the requested size. (See the <emphasis>Effect</emphasis>.) </para></description></parameter><purpose>Change the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  443. <formalpara><title>Exception Safety</title><para>Basic. </para>
  444. </formalpara>
  445. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>) if the new size is greater than the current capacity. Invalidates iterators pointing to the removed elements if the new size is lower that the original size. Otherwise it does not invalidate any iterator. </para>
  446. </formalpara>
  447. <formalpara><title>Complexity</title><para>Linear (in the new size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  448. </formalpara>
  449. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rresize(size_type, const_reference)</computeroutput>, <computeroutput>set_capacity(capacity_type)</computeroutput> </para>
  450. </para>
  451. </para></description><postconditions><para><computeroutput>size() == new_size &amp;&amp; capacity() &gt;= new_size</computeroutput><sbr/>
  452. <sbr/>
  453. If the new size is greater than the current size, copies of <computeroutput>item</computeroutput> will be inserted at the <emphasis role="bold">back</emphasis> of the of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> in order to achieve the desired size. In the case the resulting size exceeds the current capacity the capacity will be set to <computeroutput>new_size</computeroutput>.<sbr/>
  454. If the current number of elements stored in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is greater than the desired new size then number of <computeroutput>[size() - new_size]</computeroutput> <emphasis role="bold">last</emphasis> elements will be removed. (The capacity will remain unchanged.) </para>
  455. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  456. <method name="rset_capacity"><type>void</type><parameter name="new_capacity"><paramtype>capacity_type</paramtype><description><para>The new capacity. </para></description></parameter><purpose>Change the capacity of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  457. <formalpara><title>Exception Safety</title><para>Strong. </para>
  458. </formalpara>
  459. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>) if the new capacity is different from the original. </para>
  460. </formalpara>
  461. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>min[size(), new_capacity]</computeroutput>). </para>
  462. </formalpara>
  463. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>set_capacity(capacity_type)</computeroutput>, <computeroutput>rresize(size_type, const_reference)</computeroutput> </para>
  464. </para>
  465. </para></description><requires><para>If <computeroutput>T</computeroutput> is a move only type, then compiler shall support <computeroutput>noexcept</computeroutput> modifiers and move constructor of <computeroutput>T</computeroutput> must be marked with it (must not throw exceptions). </para>
  466. </requires><postconditions><para><computeroutput>capacity() == new_capacity &amp;&amp; size() &lt;= new_capacity</computeroutput><sbr/>
  467. <sbr/>
  468. If the current number of elements stored in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is greater than the desired new capacity then number of <computeroutput>[size() - new_capacity]</computeroutput> <emphasis role="bold">first</emphasis> elements will be removed and the new size will be equal to <computeroutput>new_capacity</computeroutput>. </para>
  469. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  470. <method name="rresize"><type>void</type><parameter name="new_size"><paramtype>size_type</paramtype><description><para>The new size. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><default>value_type()</default><description><para>The element the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be filled with in order to gain the requested size. (See the <emphasis>Effect</emphasis>.) </para></description></parameter><purpose>Change the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  471. <formalpara><title>Exception Safety</title><para>Basic. </para>
  472. </formalpara>
  473. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>) if the new size is greater than the current capacity. Invalidates iterators pointing to the removed elements if the new size is lower that the original size. Otherwise it does not invalidate any iterator. </para>
  474. </formalpara>
  475. <formalpara><title>Complexity</title><para>Linear (in the new size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  476. </formalpara>
  477. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>resize(size_type, const_reference)</computeroutput>, <computeroutput>rset_capacity(capacity_type)</computeroutput> </para>
  478. </para>
  479. </para></description><postconditions><para><computeroutput>size() == new_size &amp;&amp; capacity() &gt;= new_size</computeroutput><sbr/>
  480. <sbr/>
  481. If the new size is greater than the current size, copies of <computeroutput>item</computeroutput> will be inserted at the <emphasis role="bold">front</emphasis> of the of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> in order to achieve the desired size. In the case the resulting size exceeds the current capacity the capacity will be set to <computeroutput>new_size</computeroutput>.<sbr/>
  482. If the current number of elements stored in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is greater than the desired new size then number of <computeroutput>[size() - new_size]</computeroutput> <emphasis role="bold">first</emphasis> elements will be removed. (The capacity will remain unchanged.) </para>
  483. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  484. <method name="assign"><type>void</type><parameter name="n"><paramtype>size_type</paramtype><description><para>The number of elements the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be filled with. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be filled with. </para></description></parameter><purpose>Assign <computeroutput>n</computeroutput> items into the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>The content of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be removed and replaced with <computeroutput>n</computeroutput> copies of the <computeroutput>item</computeroutput>.
  485. <formalpara><title>Exception Safety</title><para>Basic. </para>
  486. </formalpara>
  487. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  488. </formalpara>
  489. <formalpara><title>Complexity</title><para>Linear (in the <computeroutput>n</computeroutput>). </para>
  490. </formalpara>
  491. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>operator=</computeroutput>, <computeroutput>assign(capacity_type, size_type, const_reference)</computeroutput>, <computeroutput>assign(InputIterator, InputIterator)</computeroutput>, <computeroutput>assign(capacity_type, InputIterator, InputIterator)</computeroutput> </para>
  492. </para>
  493. </para></description><postconditions><para><computeroutput>capacity() == n &amp;&amp; size() == n &amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this) [n - 1] == item</computeroutput> </para>
  494. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></method>
  495. <method name="assign"><type>void</type><parameter name="buffer_capacity"><paramtype>capacity_type</paramtype><description><para>The new capacity. </para></description></parameter><parameter name="n"><paramtype>size_type</paramtype><description><para>The number of elements the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be filled with. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be filled with. </para></description></parameter><purpose>Assign <computeroutput>n</computeroutput> items into the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> specifying the capacity. </purpose><description><para>The capacity of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be set to the specified value and the content of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be removed and replaced with <computeroutput>n</computeroutput> copies of the <computeroutput>item</computeroutput>.
  496. <formalpara><title>Exception Safety</title><para>Basic. </para>
  497. </formalpara>
  498. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  499. </formalpara>
  500. <formalpara><title>Complexity</title><para>Linear (in the <computeroutput>n</computeroutput>). </para>
  501. </formalpara>
  502. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>operator=</computeroutput>, <computeroutput>assign(size_type, const_reference)</computeroutput>, <computeroutput>assign(InputIterator, InputIterator)</computeroutput>, <computeroutput>assign(capacity_type, InputIterator, InputIterator)</computeroutput> </para>
  503. </para>
  504. </para></description><requires><para><computeroutput>capacity &gt;= n</computeroutput> </para>
  505. </requires><postconditions><para><computeroutput>capacity() == buffer_capacity &amp;&amp; size() == n &amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this) [n - 1] == item </computeroutput> </para>
  506. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></method>
  507. <method name="assign"><type>void</type><template>
  508. <template-type-parameter name="InputIterator"/>
  509. </template><parameter name="first"><paramtype>InputIterator</paramtype><description><para>The beginning of the range to be copied. </para></description></parameter><parameter name="last"><paramtype>InputIterator</paramtype><description><para>The end of the range to be copied. </para></description></parameter><purpose>Assign a copy of the range into the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>The content of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be removed and replaced with copies of elements from the specified range.
  510. <formalpara><title>Exception Safety</title><para>Basic. </para>
  511. </formalpara>
  512. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  513. </formalpara>
  514. <formalpara><title>Complexity</title><para>Linear (in the <computeroutput>std::distance(first, last)</computeroutput>). </para>
  515. </formalpara>
  516. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>operator=</computeroutput>, <computeroutput>assign(size_type, const_reference)</computeroutput>, <computeroutput>assign(capacity_type, size_type, const_reference)</computeroutput>, <computeroutput>assign(capacity_type, InputIterator, InputIterator)</computeroutput> </para>
  517. </para>
  518. </para></description><requires><para>Valid range <computeroutput>[first, last)</computeroutput>.<sbr/>
  519. <computeroutput>first</computeroutput> and <computeroutput>last</computeroutput> have to meet the requirements of <ulink url="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</ulink>. </para>
  520. </requires><postconditions><para><computeroutput>capacity() == std::distance(first, last) &amp;&amp; size() == std::distance(first, last) &amp;&amp; (*this)[0]== *first &amp;&amp; (*this)[1] == *(first + 1) &amp;&amp; ... &amp;&amp; (*this)[std::distance(first, last) - 1] == *(last - 1)</computeroutput> </para>
  521. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></method>
  522. <method name="assign"><type>void</type><template>
  523. <template-type-parameter name="InputIterator"/>
  524. </template><parameter name="buffer_capacity"><paramtype>capacity_type</paramtype><description><para>The new capacity. </para></description></parameter><parameter name="first"><paramtype>InputIterator</paramtype><description><para>The beginning of the range to be copied. </para></description></parameter><parameter name="last"><paramtype>InputIterator</paramtype><description><para>The end of the range to be copied. </para></description></parameter><purpose>Assign a copy of the range into the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> specifying the capacity. </purpose><description><para>The capacity of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be set to the specified value and the content of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be removed and replaced with copies of elements from the specified range.
  525. <formalpara><title>Exception Safety</title><para>Basic. </para>
  526. </formalpara>
  527. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  528. </formalpara>
  529. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>std::distance(first, last)</computeroutput>; in <computeroutput>min[capacity, std::distance(first, last)]</computeroutput> if the <computeroutput>InputIterator</computeroutput> is a <ulink url="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</ulink>). </para>
  530. </formalpara>
  531. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>operator=</computeroutput>, <computeroutput>assign(size_type, const_reference)</computeroutput>, <computeroutput>assign(capacity_type, size_type, const_reference)</computeroutput>, <computeroutput>assign(InputIterator, InputIterator)</computeroutput> </para>
  532. </para>
  533. </para></description><requires><para>Valid range <computeroutput>[first, last)</computeroutput>.<sbr/>
  534. <computeroutput>first</computeroutput> and <computeroutput>last</computeroutput> have to meet the requirements of <ulink url="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</ulink>. </para>
  535. </requires><postconditions><para><computeroutput>capacity() == buffer_capacity &amp;&amp; size() &lt;= std::distance(first, last) &amp;&amp; (*this)[0]== *(last - buffer_capacity) &amp;&amp; (*this)[1] == *(last - buffer_capacity + 1) &amp;&amp; ... &amp;&amp; (*this)[buffer_capacity - 1] == *(last - 1)</computeroutput><sbr/>
  536. <sbr/>
  537. If the number of items to be copied from the range <computeroutput>[first, last)</computeroutput> is greater than the specified <computeroutput>buffer_capacity</computeroutput> then only elements from the range <computeroutput>[last - buffer_capacity, last)</computeroutput> will be copied. </para>
  538. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></method>
  539. <method name="swap" cv="noexcept"><type>void</type><parameter name="cb"><paramtype><classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> whose content will be swapped. </para></description></parameter><purpose>Swap the contents of two <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s. </purpose><description><para>
  540. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  541. </formalpara>
  542. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators of both <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s. (On the other hand the iterators still point to the same elements but within another container. If you want to rely on this feature you have to turn the <ulink url="#debug">Debug Support</ulink> off otherwise an assertion will report an error if such invalidated iterator is used.) </para>
  543. </formalpara>
  544. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  545. </formalpara>
  546. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>swap(circular_buffer&lt;T, Alloc&gt;&amp;, circular_buffer&lt;T, Alloc&gt;&amp;)</computeroutput> </para>
  547. </para>
  548. </para></description><postconditions><para><computeroutput>this</computeroutput> contains elements of <computeroutput>cb</computeroutput> and vice versa; the capacity of <computeroutput>this</computeroutput> equals to the capacity of <computeroutput>cb</computeroutput> and vice versa. </para>
  549. </postconditions><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  550. <method name="push_back"><type>void</type><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert a new element at the end of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  551. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. </para>
  552. </formalpara>
  553. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators with the exception of iterators pointing to the overwritten element. </para>
  554. </formalpara>
  555. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  556. </formalpara>
  557. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>push_front(const_reference)</computeroutput>, <computeroutput>pop_back()</computeroutput>, <computeroutput>pop_front()</computeroutput> </para>
  558. </para>
  559. </para></description><postconditions><para>if <computeroutput>capacity() &gt; 0</computeroutput> then <computeroutput>back() == item</computeroutput><sbr/>
  560. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full, the first element will be removed. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted. </para>
  561. </postconditions><throws><simpara><classname>Whatever</classname> <computeroutput>T::T(const T&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws. </simpara></throws></method>
  562. <method name="push_back"><type>void</type><parameter name="item"><paramtype>rvalue_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert a new element at the end of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> using rvalue references or rvalues references emulation. </purpose><description><para>
  563. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. </para>
  564. </formalpara>
  565. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators with the exception of iterators pointing to the overwritten element. </para>
  566. </formalpara>
  567. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  568. </formalpara>
  569. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>push_front(const_reference)</computeroutput>, <computeroutput>pop_back()</computeroutput>, <computeroutput>pop_front()</computeroutput> </para>
  570. </para>
  571. </para></description><postconditions><para>if <computeroutput>capacity() &gt; 0</computeroutput> then <computeroutput>back() == item</computeroutput><sbr/>
  572. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full, the first element will be removed. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted. </para>
  573. </postconditions><throws><simpara><classname>Whatever</classname> <computeroutput>T::T(T&amp;&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (T&amp;&amp;)</computeroutput> throws. </simpara></throws></method>
  574. <method name="push_back"><type>void</type><purpose>Insert a new default-constructed element at the end of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  575. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. </para>
  576. </formalpara>
  577. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators with the exception of iterators pointing to the overwritten element. </para>
  578. </formalpara>
  579. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  580. </formalpara>
  581. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>push_front(const_reference)</computeroutput>, <computeroutput>pop_back()</computeroutput>, <computeroutput>pop_front()</computeroutput> </para>
  582. </para>
  583. </para></description><postconditions><para>if <computeroutput>capacity() &gt; 0</computeroutput> then <computeroutput>back() == item</computeroutput><sbr/>
  584. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full, the first element will be removed. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted. </para>
  585. </postconditions><throws><simpara><classname>Whatever</classname> <computeroutput>T::T()</computeroutput> throws. Whatever <computeroutput>T::T(T&amp;&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (T&amp;&amp;)</computeroutput> throws. </simpara></throws></method>
  586. <method name="push_front"><type>void</type><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert a new element at the beginning of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  587. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. </para>
  588. </formalpara>
  589. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators with the exception of iterators pointing to the overwritten element. </para>
  590. </formalpara>
  591. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  592. </formalpara>
  593. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>push_back(const_reference)</computeroutput>, <computeroutput>pop_back()</computeroutput>, <computeroutput>pop_front()</computeroutput> </para>
  594. </para>
  595. </para></description><postconditions><para>if <computeroutput>capacity() &gt; 0</computeroutput> then <computeroutput>front() == item</computeroutput><sbr/>
  596. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full, the last element will be removed. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted. </para>
  597. </postconditions><throws><simpara><classname>Whatever</classname> <computeroutput>T::T(const T&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws. </simpara></throws></method>
  598. <method name="push_front"><type>void</type><parameter name="item"><paramtype>rvalue_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert a new element at the beginning of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> using rvalue references or rvalues references emulation. </purpose><description><para>
  599. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. </para>
  600. </formalpara>
  601. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators with the exception of iterators pointing to the overwritten element. </para>
  602. </formalpara>
  603. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  604. </formalpara>
  605. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>push_back(const_reference)</computeroutput>, <computeroutput>pop_back()</computeroutput>, <computeroutput>pop_front()</computeroutput> </para>
  606. </para>
  607. </para></description><postconditions><para>if <computeroutput>capacity() &gt; 0</computeroutput> then <computeroutput>front() == item</computeroutput><sbr/>
  608. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full, the last element will be removed. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted. </para>
  609. </postconditions><throws><simpara><classname>Whatever</classname> <computeroutput>T::T(T&amp;&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (T&amp;&amp;)</computeroutput> throws. </simpara></throws></method>
  610. <method name="push_front"><type>void</type><purpose>Insert a new default-constructed element at the beginning of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  611. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. </para>
  612. </formalpara>
  613. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators with the exception of iterators pointing to the overwritten element. </para>
  614. </formalpara>
  615. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  616. </formalpara>
  617. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>push_back(const_reference)</computeroutput>, <computeroutput>pop_back()</computeroutput>, <computeroutput>pop_front()</computeroutput> </para>
  618. </para>
  619. </para></description><postconditions><para>if <computeroutput>capacity() &gt; 0</computeroutput> then <computeroutput>front() == item</computeroutput><sbr/>
  620. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full, the last element will be removed. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted. </para>
  621. </postconditions><throws><simpara><classname>Whatever</classname> <computeroutput>T::T()</computeroutput> throws. Whatever <computeroutput>T::T(T&amp;&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (T&amp;&amp;)</computeroutput> throws. </simpara></throws></method>
  622. <method name="pop_back"><type>void</type><purpose>Remove the last element from the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  623. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  624. </formalpara>
  625. <formalpara><title>Iterator Invalidation</title><para>Invalidates only iterators pointing to the removed element. </para>
  626. </formalpara>
  627. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  628. </formalpara>
  629. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>pop_front()</computeroutput>, <computeroutput>push_back(const_reference)</computeroutput>, <computeroutput>push_front(const_reference)</computeroutput> </para>
  630. </para>
  631. </para></description><requires><para><computeroutput>!empty()</computeroutput> </para>
  632. </requires><postconditions><para>The last element is removed from the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para>
  633. </postconditions><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  634. <method name="pop_front"><type>void</type><purpose>Remove the first element from the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  635. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  636. </formalpara>
  637. <formalpara><title>Iterator Invalidation</title><para>Invalidates only iterators pointing to the removed element. </para>
  638. </formalpara>
  639. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>). </para>
  640. </formalpara>
  641. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>pop_back()</computeroutput>, <computeroutput>push_back(const_reference)</computeroutput>, <computeroutput>push_front(const_reference)</computeroutput> </para>
  642. </para>
  643. </para></description><requires><para><computeroutput>!empty()</computeroutput> </para>
  644. </requires><postconditions><para>The first element is removed from the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para>
  645. </postconditions><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  646. <method name="insert"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position where the <computeroutput>item</computeroutput> will be inserted. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert an element at the specified position. </purpose><description><para>
  647. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. </para>
  648. </formalpara>
  649. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the elements at the insertion point (including <computeroutput>pos</computeroutput>) and iterators behind the insertion point (towards the end; except iterators equal to <computeroutput>end()</computeroutput>). It also invalidates iterators pointing to the overwritten element. </para>
  650. </formalpara>
  651. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>std::distance(pos, end())</computeroutput>). </para>
  652. </formalpara>
  653. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>rinsert(iterator, value_type)</computeroutput>, <computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  654. </para>
  655. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> or its end. </para>
  656. </requires><postconditions><para>The <computeroutput>item</computeroutput> will be inserted at the position <computeroutput>pos</computeroutput>.<sbr/>
  657. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full, the first element will be overwritten. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full and the <computeroutput>pos</computeroutput> points to <computeroutput>begin()</computeroutput>, then the <computeroutput>item</computeroutput> will not be inserted. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted. </para>
  658. </postconditions><returns><para>Iterator to the inserted element or <computeroutput>begin()</computeroutput> if the <computeroutput>item</computeroutput> is not inserted. (See the <emphasis>Effect</emphasis>.) </para>
  659. </returns><throws><simpara><classname>Whatever</classname> <computeroutput>T::T(const T&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws. <ulink url="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&amp;)</ulink>.</simpara></throws></method>
  660. <method name="insert"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position where the <computeroutput>item</computeroutput> will be inserted. </para></description></parameter><parameter name="item"><paramtype>rvalue_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert an element at the specified position. </purpose><description><para>
  661. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. </para>
  662. </formalpara>
  663. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the elements at the insertion point (including <computeroutput>pos</computeroutput>) and iterators behind the insertion point (towards the end; except iterators equal to <computeroutput>end()</computeroutput>). It also invalidates iterators pointing to the overwritten element. </para>
  664. </formalpara>
  665. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>std::distance(pos, end())</computeroutput>). </para>
  666. </formalpara>
  667. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>rinsert(iterator, value_type)</computeroutput>, <computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  668. </para>
  669. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> or its end. </para>
  670. </requires><postconditions><para>The <computeroutput>item</computeroutput> will be inserted at the position <computeroutput>pos</computeroutput>.<sbr/>
  671. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full, the first element will be overwritten. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full and the <computeroutput>pos</computeroutput> points to <computeroutput>begin()</computeroutput>, then the <computeroutput>item</computeroutput> will not be inserted. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted. </para>
  672. </postconditions><returns><para>Iterator to the inserted element or <computeroutput>begin()</computeroutput> if the <computeroutput>item</computeroutput> is not inserted. (See the <emphasis>Effect</emphasis>.) </para>
  673. </returns><throws><simpara><classname>Whatever</classname> <computeroutput>T::T(T&amp;&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (T&amp;&amp;)</computeroutput> throws. <ulink url="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&amp;)</ulink>. </simpara></throws></method>
  674. <method name="insert"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position where the <computeroutput>item</computeroutput> will be inserted. </para></description></parameter><purpose>Insert a default-constructed element at the specified position. </purpose><description><para>
  675. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. </para>
  676. </formalpara>
  677. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the elements at the insertion point (including <computeroutput>pos</computeroutput>) and iterators behind the insertion point (towards the end; except iterators equal to <computeroutput>end()</computeroutput>). It also invalidates iterators pointing to the overwritten element. </para>
  678. </formalpara>
  679. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>std::distance(pos, end())</computeroutput>). </para>
  680. </formalpara>
  681. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>rinsert(iterator, value_type)</computeroutput>, <computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  682. </para>
  683. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> or its end. </para>
  684. </requires><postconditions><para>The <computeroutput>item</computeroutput> will be inserted at the position <computeroutput>pos</computeroutput>.<sbr/>
  685. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full, the first element will be overwritten. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full and the <computeroutput>pos</computeroutput> points to <computeroutput>begin()</computeroutput>, then the <computeroutput>item</computeroutput> will not be inserted. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted. </para>
  686. </postconditions><returns><para>Iterator to the inserted element or <computeroutput>begin()</computeroutput> if the <computeroutput>item</computeroutput> is not inserted. (See the <emphasis>Effect</emphasis>.) </para>
  687. </returns><throws><simpara><classname>Whatever</classname> <computeroutput>T::T()</computeroutput> throws. Whatever <computeroutput>T::T(T&amp;&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (T&amp;&amp;)</computeroutput> throws. <ulink url="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&amp;)</ulink>. </simpara></throws></method>
  688. <method name="insert"><type>void</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position where the <computeroutput>item</computeroutput>s will be inserted. </para></description></parameter><parameter name="n"><paramtype>size_type</paramtype><description><para>The number of <computeroutput>item</computeroutput>s the to be inserted. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element whose copies will be inserted. </para></description></parameter><purpose>Insert <computeroutput>n</computeroutput> copies of the <computeroutput>item</computeroutput> at the specified position. </purpose><description><para>
  689. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operations in the <emphasis>Throws</emphasis> section do not throw anything. </para>
  690. </formalpara>
  691. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the elements at the insertion point (including <computeroutput>pos</computeroutput>) and iterators behind the insertion point (towards the end; except iterators equal to <computeroutput>end()</computeroutput>). It also invalidates iterators pointing to the overwritten elements. </para>
  692. </formalpara>
  693. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>min[capacity(), std::distance(pos, end()) + n]</computeroutput>). </para>
  694. </formalpara>
  695. <formalpara><title>Example</title><para>Consider a <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.<sbr/>
  696. <sbr/>
  697. <computeroutput>|1|2|3|4| | |</computeroutput><sbr/>
  698. <computeroutput>p ___^</computeroutput><sbr/>
  699. <sbr/>
  700. After inserting 5 elements at the position <computeroutput>p</computeroutput>:<sbr/>
  701. <sbr/>
  702. <computeroutput>insert(p, (size_t)5, 0);</computeroutput><sbr/>
  703. <sbr/>
  704. actually only 4 elements get inserted and elements <computeroutput>1</computeroutput> and <computeroutput>2</computeroutput> are overwritten. This is due to the fact the insert operation preserves the capacity. After insertion the internal buffer looks like this:<sbr/>
  705. <sbr/>
  706. <computeroutput>|0|0|0|0|3|4|</computeroutput><sbr/>
  707. <sbr/>
  708. For comparison if the capacity would not be preserved the internal buffer would then result in <computeroutput>|1|2|0|0|0|0|0|3|4|</computeroutput>. </para>
  709. </formalpara>
  710. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>insert(iterator, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>rinsert(iterator, value_type)</computeroutput>, <computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  711. </para>
  712. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> or its end. </para>
  713. </requires><postconditions><para>The number of <computeroutput>min[n, (pos - begin()) + reserve()]</computeroutput> elements will be inserted at the position <computeroutput>pos</computeroutput>.<sbr/>
  714. The number of <computeroutput>min[pos - begin(), max[0, n - reserve()]]</computeroutput> elements will be overwritten at the beginning of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>.<sbr/>
  715. (See <emphasis>Example</emphasis> for the explanation.) </para>
  716. </postconditions><throws><simpara><classname>Whatever</classname> <computeroutput>T::T(const T&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws. <ulink url="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&amp;)</ulink>. </simpara></throws></method>
  717. <method name="insert"><type>void</type><template>
  718. <template-type-parameter name="InputIterator"/>
  719. </template><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position where the range will be inserted. </para></description></parameter><parameter name="first"><paramtype>InputIterator</paramtype><description><para>The beginning of the range to be inserted. </para></description></parameter><parameter name="last"><paramtype>InputIterator</paramtype><description><para>The end of the range to be inserted. </para></description></parameter><purpose>Insert the range <computeroutput>[first, last)</computeroutput> at the specified position. </purpose><description><para>
  720. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operations in the <emphasis>Throws</emphasis> section do not throw anything. </para>
  721. </formalpara>
  722. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the elements at the insertion point (including <computeroutput>pos</computeroutput>) and iterators behind the insertion point (towards the end; except iterators equal to <computeroutput>end()</computeroutput>). It also invalidates iterators pointing to the overwritten elements. </para>
  723. </formalpara>
  724. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>[std::distance(pos, end()) + std::distance(first, last)]</computeroutput>; in <computeroutput>min[capacity(), std::distance(pos, end()) + std::distance(first, last)]</computeroutput> if the <computeroutput>InputIterator</computeroutput> is a <ulink url="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</ulink>). </para>
  725. </formalpara>
  726. <formalpara><title>Example</title><para>Consider a <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.<sbr/>
  727. <sbr/>
  728. <computeroutput>|1|2|3|4| | |</computeroutput><sbr/>
  729. <computeroutput>p ___^</computeroutput><sbr/>
  730. <sbr/>
  731. After inserting a range of elements at the position <computeroutput>p</computeroutput>:<sbr/>
  732. <sbr/>
  733. <computeroutput>int array[] = { 5, 6, 7, 8, 9 };</computeroutput><sbr/>
  734. <computeroutput>insert(p, array, array + 5);</computeroutput><sbr/>
  735. <sbr/>
  736. actually only elements <computeroutput>6</computeroutput>, <computeroutput>7</computeroutput>, <computeroutput>8</computeroutput> and <computeroutput>9</computeroutput> from the specified range get inserted and elements <computeroutput>1</computeroutput> and <computeroutput>2</computeroutput> are overwritten. This is due to the fact the insert operation preserves the capacity. After insertion the internal buffer looks like this:<sbr/>
  737. <sbr/>
  738. <computeroutput>|6|7|8|9|3|4|</computeroutput><sbr/>
  739. <sbr/>
  740. For comparison if the capacity would not be preserved the internal buffer would then result in <computeroutput>|1|2|5|6|7|8|9|3|4|</computeroutput>. </para>
  741. </formalpara>
  742. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>insert(iterator, value_type)</computeroutput>, <computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, value_type)</computeroutput>, <computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  743. </para>
  744. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> or its end.<sbr/>
  745. Valid range <computeroutput>[first, last)</computeroutput> where <computeroutput>first</computeroutput> and <computeroutput>last</computeroutput> meet the requirements of an <ulink url="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</ulink>. </para>
  746. </requires><postconditions><para>Elements from the range <computeroutput>[first + max[0, distance(first, last) - (pos - begin()) - reserve()], last)</computeroutput> will be inserted at the position <computeroutput>pos</computeroutput>.<sbr/>
  747. The number of <computeroutput>min[pos - begin(), max[0, distance(first, last) - reserve()]]</computeroutput> elements will be overwritten at the beginning of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>.<sbr/>
  748. (See <emphasis>Example</emphasis> for the explanation.) </para>
  749. </postconditions><throws><simpara><classname>Whatever</classname> <computeroutput>T::T(const T&amp;)</computeroutput> throws if the <computeroutput>InputIterator</computeroutput> is not a move iterator. Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws if the <computeroutput>InputIterator</computeroutput> is not a move iterator. Whatever <computeroutput>T::T(T&amp;&amp;)</computeroutput> throws if the <computeroutput>InputIterator</computeroutput> is a move iterator. Whatever <computeroutput>T::operator = (T&amp;&amp;)</computeroutput> throws if the <computeroutput>InputIterator</computeroutput> is a move iterator. </simpara></throws></method>
  750. <method name="rinsert"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position before which the <computeroutput>item</computeroutput> will be inserted. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert an element before the specified position. </purpose><description><para>
  751. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operations in the <emphasis>Throws</emphasis> section do not throw anything. </para>
  752. </formalpara>
  753. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the elements before the insertion point (towards the beginning and excluding <computeroutput>pos</computeroutput>). It also invalidates iterators pointing to the overwritten element. </para>
  754. </formalpara>
  755. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>std::distance(begin(), pos)</computeroutput>). </para>
  756. </formalpara>
  757. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>insert(iterator, value_type)</computeroutput>, <computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  758. </para>
  759. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> or its end. </para>
  760. </requires><postconditions><para>The <computeroutput>item</computeroutput> will be inserted before the position <computeroutput>pos</computeroutput>.<sbr/>
  761. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full, the last element will be overwritten. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full and the <computeroutput>pos</computeroutput> points to <computeroutput>end()</computeroutput>, then the <computeroutput>item</computeroutput> will not be inserted. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted. </para>
  762. </postconditions><returns><para>Iterator to the inserted element or <computeroutput>end()</computeroutput> if the <computeroutput>item</computeroutput> is not inserted. (See the <emphasis>Effect</emphasis>.) </para>
  763. </returns><throws><simpara><classname>Whatever</classname> <computeroutput>T::T(const T&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws. <ulink url="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&amp;)</ulink>. </simpara></throws></method>
  764. <method name="rinsert"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position before which the <computeroutput>item</computeroutput> will be inserted. </para></description></parameter><parameter name="item"><paramtype>rvalue_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert an element before the specified position. </purpose><description><para>
  765. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operations in the <emphasis>Throws</emphasis> section do not throw anything. </para>
  766. </formalpara>
  767. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the elements before the insertion point (towards the beginning and excluding <computeroutput>pos</computeroutput>). It also invalidates iterators pointing to the overwritten element. </para>
  768. </formalpara>
  769. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>std::distance(begin(), pos)</computeroutput>). </para>
  770. </formalpara>
  771. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>insert(iterator, value_type)</computeroutput>, <computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  772. </para>
  773. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> or its end. </para>
  774. </requires><postconditions><para>The <computeroutput>item</computeroutput> will be inserted before the position <computeroutput>pos</computeroutput>.<sbr/>
  775. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full, the last element will be overwritten. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full and the <computeroutput>pos</computeroutput> points to <computeroutput>end()</computeroutput>, then the <computeroutput>item</computeroutput> will not be inserted. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted. </para>
  776. </postconditions><returns><para>Iterator to the inserted element or <computeroutput>end()</computeroutput> if the <computeroutput>item</computeroutput> is not inserted. (See the <emphasis>Effect</emphasis>.) </para>
  777. </returns><throws><simpara><classname>Whatever</classname> <computeroutput>T::T(T&amp;&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (T&amp;&amp;)</computeroutput> throws. <ulink url="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&amp;)</ulink>. </simpara></throws></method>
  778. <method name="rinsert"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position before which the <computeroutput>item</computeroutput> will be inserted. </para></description></parameter><purpose>Insert an element before the specified position. </purpose><description><para>
  779. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operations in the <emphasis>Throws</emphasis> section do not throw anything. </para>
  780. </formalpara>
  781. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the elements before the insertion point (towards the beginning and excluding <computeroutput>pos</computeroutput>). It also invalidates iterators pointing to the overwritten element. </para>
  782. </formalpara>
  783. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>std::distance(begin(), pos)</computeroutput>). </para>
  784. </formalpara>
  785. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>insert(iterator, value_type)</computeroutput>, <computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  786. </para>
  787. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> or its end. </para>
  788. </requires><postconditions><para>The <computeroutput>item</computeroutput> will be inserted before the position <computeroutput>pos</computeroutput>.<sbr/>
  789. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full, the last element will be overwritten. If the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> is full and the <computeroutput>pos</computeroutput> points to <computeroutput>end()</computeroutput>, then the <computeroutput>item</computeroutput> will not be inserted. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted. </para>
  790. </postconditions><returns><para>Iterator to the inserted element or <computeroutput>end()</computeroutput> if the <computeroutput>item</computeroutput> is not inserted. (See the <emphasis>Effect</emphasis>.) </para>
  791. </returns><throws><simpara><classname>Whatever</classname> <computeroutput>T::T()</computeroutput> throws. Whatever <computeroutput>T::T(T&amp;&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (T&amp;&amp;)</computeroutput> throws. <ulink url="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&amp;)</ulink>. </simpara></throws></method>
  792. <method name="rinsert"><type>void</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position where the <computeroutput>item</computeroutput>s will be inserted. </para></description></parameter><parameter name="n"><paramtype>size_type</paramtype><description><para>The number of <computeroutput>item</computeroutput>s the to be inserted. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element whose copies will be inserted. </para></description></parameter><purpose>Insert <computeroutput>n</computeroutput> copies of the <computeroutput>item</computeroutput> before the specified position. </purpose><description><para>
  793. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operations in the <emphasis>Throws</emphasis> section do not throw anything. </para>
  794. </formalpara>
  795. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the elements before the insertion point (towards the beginning and excluding <computeroutput>pos</computeroutput>). It also invalidates iterators pointing to the overwritten elements. </para>
  796. </formalpara>
  797. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>min[capacity(), std::distance(begin(), pos) + n]</computeroutput>). </para>
  798. </formalpara>
  799. <formalpara><title>Example</title><para>Consider a <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.<sbr/>
  800. <sbr/>
  801. <computeroutput>|1|2|3|4| | |</computeroutput><sbr/>
  802. <computeroutput>p ___^</computeroutput><sbr/>
  803. <sbr/>
  804. After inserting 5 elements before the position <computeroutput>p</computeroutput>:<sbr/>
  805. <sbr/>
  806. <computeroutput>rinsert(p, (size_t)5, 0);</computeroutput><sbr/>
  807. <sbr/>
  808. actually only 4 elements get inserted and elements <computeroutput>3</computeroutput> and <computeroutput>4</computeroutput> are overwritten. This is due to the fact the rinsert operation preserves the capacity. After insertion the internal buffer looks like this:<sbr/>
  809. <sbr/>
  810. <computeroutput>|1|2|0|0|0|0|</computeroutput><sbr/>
  811. <sbr/>
  812. For comparison if the capacity would not be preserved the internal buffer would then result in <computeroutput>|1|2|0|0|0|0|0|3|4|</computeroutput>. </para>
  813. </formalpara>
  814. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rinsert(iterator, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>insert(iterator, value_type)</computeroutput>, <computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  815. </para>
  816. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> or its end. </para>
  817. </requires><postconditions><para>The number of <computeroutput>min[n, (end() - pos) + reserve()]</computeroutput> elements will be inserted before the position <computeroutput>pos</computeroutput>.<sbr/>
  818. The number of <computeroutput>min[end() - pos, max[0, n - reserve()]]</computeroutput> elements will be overwritten at the end of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>.<sbr/>
  819. (See <emphasis>Example</emphasis> for the explanation.) </para>
  820. </postconditions><throws><simpara><classname>Whatever</classname> <computeroutput>T::T(const T&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws. <ulink url="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t">Exceptions of move_if_noexcept(T&amp;)</ulink>. </simpara></throws></method>
  821. <method name="rinsert"><type>void</type><template>
  822. <template-type-parameter name="InputIterator"/>
  823. </template><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position where the range will be inserted. </para></description></parameter><parameter name="first"><paramtype>InputIterator</paramtype><description><para>The beginning of the range to be inserted. </para></description></parameter><parameter name="last"><paramtype>InputIterator</paramtype><description><para>The end of the range to be inserted. </para></description></parameter><purpose>Insert the range <computeroutput>[first, last)</computeroutput> before the specified position. </purpose><description><para>
  824. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operations in the <emphasis>Throws</emphasis> section do not throw anything. </para>
  825. </formalpara>
  826. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the elements before the insertion point (towards the beginning and excluding <computeroutput>pos</computeroutput>). It also invalidates iterators pointing to the overwritten elements. </para>
  827. </formalpara>
  828. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>[std::distance(begin(), pos) + std::distance(first, last)]</computeroutput>; in <computeroutput>min[capacity(), std::distance(begin(), pos) + std::distance(first, last)]</computeroutput> if the <computeroutput>InputIterator</computeroutput> is a <ulink url="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</ulink>). </para>
  829. </formalpara>
  830. <formalpara><title>Example</title><para>Consider a <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.<sbr/>
  831. <sbr/>
  832. <computeroutput>|1|2|3|4| | |</computeroutput><sbr/>
  833. <computeroutput>p ___^</computeroutput><sbr/>
  834. <sbr/>
  835. After inserting a range of elements before the position <computeroutput>p</computeroutput>:<sbr/>
  836. <sbr/>
  837. <computeroutput>int array[] = { 5, 6, 7, 8, 9 };</computeroutput><sbr/>
  838. <computeroutput>insert(p, array, array + 5);</computeroutput><sbr/>
  839. <sbr/>
  840. actually only elements <computeroutput>5</computeroutput>, <computeroutput>6</computeroutput>, <computeroutput>7</computeroutput> and <computeroutput>8</computeroutput> from the specified range get inserted and elements <computeroutput>3</computeroutput> and <computeroutput>4</computeroutput> are overwritten. This is due to the fact the rinsert operation preserves the capacity. After insertion the internal buffer looks like this:<sbr/>
  841. <sbr/>
  842. <computeroutput>|1|2|5|6|7|8|</computeroutput><sbr/>
  843. <sbr/>
  844. For comparison if the capacity would not be preserved the internal buffer would then result in <computeroutput>|1|2|5|6|7|8|9|3|4|</computeroutput>. </para>
  845. </formalpara>
  846. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rinsert(iterator, value_type)</computeroutput>, <computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, value_type)</computeroutput>, <computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  847. </para>
  848. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> or its end.<sbr/>
  849. Valid range <computeroutput>[first, last)</computeroutput> where <computeroutput>first</computeroutput> and <computeroutput>last</computeroutput> meet the requirements of an <ulink url="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</ulink>. </para>
  850. </requires><postconditions><para>Elements from the range <computeroutput>[first, last - max[0, distance(first, last) - (end() - pos) - reserve()])</computeroutput> will be inserted before the position <computeroutput>pos</computeroutput>.<sbr/>
  851. The number of <computeroutput>min[end() - pos, max[0, distance(first, last) - reserve()]]</computeroutput> elements will be overwritten at the end of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>.<sbr/>
  852. (See <emphasis>Example</emphasis> for the explanation.) </para>
  853. </postconditions><throws><simpara><classname>Whatever</classname> <computeroutput>T::T(const T&amp;)</computeroutput> throws if the <computeroutput>InputIterator</computeroutput> is not a move iterator. Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws if the <computeroutput>InputIterator</computeroutput> is not a move iterator. Whatever <computeroutput>T::T(T&amp;&amp;)</computeroutput> throws if the <computeroutput>InputIterator</computeroutput> is a move iterator. Whatever <computeroutput>T::operator = (T&amp;&amp;)</computeroutput> throws if the <computeroutput>InputIterator</computeroutput> is a move iterator. </simpara></throws></method>
  854. <method name="erase"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator pointing at the element to be removed. </para></description></parameter><purpose>Remove an element at the specified position. </purpose><description><para>
  855. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. </para>
  856. </formalpara>
  857. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the erased element and iterators pointing to the elements behind the erased element (towards the end; except iterators equal to <computeroutput>end()</computeroutput>). </para>
  858. </formalpara>
  859. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>std::distance(pos, end())</computeroutput>). </para>
  860. </formalpara>
  861. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>erase(iterator, iterator)</computeroutput>, <computeroutput>rerase(iterator)</computeroutput>, <computeroutput>rerase(iterator, iterator)</computeroutput>, <computeroutput>erase_begin(size_type)</computeroutput>, <computeroutput>erase_end(size_type)</computeroutput>, <computeroutput>clear()</computeroutput> </para>
  862. </para>
  863. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> (but not an <computeroutput>end()</computeroutput>). </para>
  864. </requires><postconditions><para>The element at the position <computeroutput>pos</computeroutput> is removed. </para>
  865. </postconditions><returns><para>Iterator to the first element remaining beyond the removed element or <computeroutput>end()</computeroutput> if no such element exists. </para>
  866. </returns><throws><simpara><classname>&lt;a</classname> href="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t"&gt;Exceptions of move_if_noexcept(T&amp;). </simpara></throws></method>
  867. <method name="erase"><type>iterator</type><parameter name="first"><paramtype>iterator</paramtype><description><para>The beginning of the range to be removed. </para></description></parameter><parameter name="last"><paramtype>iterator</paramtype><description><para>The end of the range to be removed. </para></description></parameter><purpose>Erase the range <computeroutput>[first, last)</computeroutput>. </purpose><description><para>
  868. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. </para>
  869. </formalpara>
  870. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the erased elements and iterators pointing to the elements behind the erased range (towards the end; except iterators equal to <computeroutput>end()</computeroutput>). </para>
  871. </formalpara>
  872. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>std::distance(first, end())</computeroutput>). </para>
  873. </formalpara>
  874. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>erase(iterator)</computeroutput>, <computeroutput>rerase(iterator)</computeroutput>, <computeroutput>rerase(iterator, iterator)</computeroutput>, <computeroutput>erase_begin(size_type)</computeroutput>, <computeroutput>erase_end(size_type)</computeroutput>, <computeroutput>clear()</computeroutput> </para>
  875. </para>
  876. </para></description><requires><para>Valid range <computeroutput>[first, last)</computeroutput>. </para>
  877. </requires><postconditions><para>The elements from the range <computeroutput>[first, last)</computeroutput> are removed. (If <computeroutput>first == last</computeroutput> nothing is removed.) </para>
  878. </postconditions><returns><para>Iterator to the first element remaining beyond the removed elements or <computeroutput>end()</computeroutput> if no such element exists. </para>
  879. </returns><throws><simpara><classname>&lt;a</classname> href="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t"&gt;Exceptions of move_if_noexcept(T&amp;). </simpara></throws></method>
  880. <method name="rerase"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator pointing at the element to be removed. </para></description></parameter><purpose>Remove an element at the specified position. </purpose><description><para>
  881. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. </para>
  882. </formalpara>
  883. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the erased element and iterators pointing to the elements in front of the erased element (towards the beginning). </para>
  884. </formalpara>
  885. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>std::distance(begin(), pos)</computeroutput>). </para>
  886. </formalpara>
  887. <note><para>This method is symmetric to the <computeroutput>erase(iterator)</computeroutput> method and is more effective than <computeroutput>erase(iterator)</computeroutput> if the iterator <computeroutput>pos</computeroutput> is close to the beginning of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. (See the <emphasis>Complexity</emphasis>.) </para>
  888. </note>
  889. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>erase(iterator)</computeroutput>, <computeroutput>erase(iterator, iterator)</computeroutput>, <computeroutput>rerase(iterator, iterator)</computeroutput>, <computeroutput>erase_begin(size_type)</computeroutput>, <computeroutput>erase_end(size_type)</computeroutput>, <computeroutput>clear()</computeroutput> </para>
  890. </para>
  891. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> (but not an <computeroutput>end()</computeroutput>). </para>
  892. </requires><postconditions><para>The element at the position <computeroutput>pos</computeroutput> is removed. </para>
  893. </postconditions><returns><para>Iterator to the first element remaining in front of the removed element or <computeroutput>begin()</computeroutput> if no such element exists. </para>
  894. </returns><throws><simpara><classname>&lt;a</classname> href="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t"&gt;Exceptions of move_if_noexcept(T&amp;). </simpara></throws></method>
  895. <method name="rerase"><type>iterator</type><parameter name="first"><paramtype>iterator</paramtype><description><para>The beginning of the range to be removed. </para></description></parameter><parameter name="last"><paramtype>iterator</paramtype><description><para>The end of the range to be removed. </para></description></parameter><purpose>Erase the range <computeroutput>[first, last)</computeroutput>. </purpose><description><para>
  896. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. </para>
  897. </formalpara>
  898. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the erased elements and iterators pointing to the elements in front of the erased range (towards the beginning). </para>
  899. </formalpara>
  900. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>std::distance(begin(), last)</computeroutput>). </para>
  901. </formalpara>
  902. <note><para>This method is symmetric to the <computeroutput>erase(iterator, iterator)</computeroutput> method and is more effective than <computeroutput>erase(iterator, iterator)</computeroutput> if <computeroutput>std::distance(begin(), first)</computeroutput> is lower that <computeroutput>std::distance(last, end())</computeroutput>. </para>
  903. </note>
  904. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>erase(iterator)</computeroutput>, <computeroutput>erase(iterator, iterator)</computeroutput>, <computeroutput>rerase(iterator)</computeroutput>, <computeroutput>erase_begin(size_type)</computeroutput>, <computeroutput>erase_end(size_type)</computeroutput>, <computeroutput>clear()</computeroutput> </para>
  905. </para>
  906. </para></description><requires><para>Valid range <computeroutput>[first, last)</computeroutput>. </para>
  907. </requires><postconditions><para>The elements from the range <computeroutput>[first, last)</computeroutput> are removed. (If <computeroutput>first == last</computeroutput> nothing is removed.) </para>
  908. </postconditions><returns><para>Iterator to the first element remaining in front of the removed elements or <computeroutput>begin()</computeroutput> if no such element exists. </para>
  909. </returns><throws><simpara><classname>&lt;a</classname> href="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t"&gt;Exceptions of move_if_noexcept(T&amp;). </simpara></throws></method>
  910. <method name="erase_begin"><type>void</type><parameter name="n"><paramtype>size_type</paramtype><description><para>The number of elements to be removed. </para></description></parameter><purpose>Remove first <computeroutput>n</computeroutput> elements (with constant complexity for scalar types). </purpose><description><para>
  911. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. (I.e. no throw in case of scalars.) </para>
  912. </formalpara>
  913. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the first <computeroutput>n</computeroutput> erased elements. </para>
  914. </formalpara>
  915. <formalpara><title>Complexity</title><para>Constant (in <computeroutput>n</computeroutput>) for scalar types; linear for other types. </para>
  916. </formalpara>
  917. <note><para>This method has been specially designed for types which do not require an explicit destructruction (e.g. integer, float or a pointer). For these scalar types a call to a destructor is not required which makes it possible to implement the "erase from beginning" operation with a constant complexity. For non-sacalar types the complexity is linear (hence the explicit destruction is needed) and the implementation is actually equivalent to <computeroutput>rerase(begin(), begin() + n)</computeroutput>. </para>
  918. </note>
  919. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>erase(iterator)</computeroutput>, <computeroutput>erase(iterator, iterator)</computeroutput>, <computeroutput>rerase(iterator)</computeroutput>, <computeroutput>rerase(iterator, iterator)</computeroutput>, <computeroutput>erase_end(size_type)</computeroutput>, <computeroutput>clear()</computeroutput> </para>
  920. </para>
  921. </para></description><requires><para><computeroutput>n &lt;= size()</computeroutput> </para>
  922. </requires><postconditions><para>The <computeroutput>n</computeroutput> elements at the beginning of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be removed. </para>
  923. </postconditions><throws><simpara><classname>&lt;a</classname> href="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t"&gt;Exceptions of move_if_noexcept(T&amp;). </simpara></throws></method>
  924. <method name="erase_end"><type>void</type><parameter name="n"><paramtype>size_type</paramtype><description><para>The number of elements to be removed. </para></description></parameter><purpose>Remove last <computeroutput>n</computeroutput> elements (with constant complexity for scalar types). </purpose><description><para>
  925. <formalpara><title>Exception Safety</title><para>Basic; no-throw if the operation in the <emphasis>Throws</emphasis> section does not throw anything. (I.e. no throw in case of scalars.) </para>
  926. </formalpara>
  927. <formalpara><title>Iterator Invalidation</title><para>Invalidates iterators pointing to the last <computeroutput>n</computeroutput> erased elements. </para>
  928. </formalpara>
  929. <formalpara><title>Complexity</title><para>Constant (in <computeroutput>n</computeroutput>) for scalar types; linear for other types. </para>
  930. </formalpara>
  931. <note><para>This method has been specially designed for types which do not require an explicit destructruction (e.g. integer, float or a pointer). For these scalar types a call to a destructor is not required which makes it possible to implement the "erase from end" operation with a constant complexity. For non-sacalar types the complexity is linear (hence the explicit destruction is needed) and the implementation is actually equivalent to <computeroutput>erase(end() - n, end())</computeroutput>. </para>
  932. </note>
  933. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>erase(iterator)</computeroutput>, <computeroutput>erase(iterator, iterator)</computeroutput>, <computeroutput>rerase(iterator)</computeroutput>, <computeroutput>rerase(iterator, iterator)</computeroutput>, <computeroutput>erase_begin(size_type)</computeroutput>, <computeroutput>clear()</computeroutput> </para>
  934. </para>
  935. </para></description><requires><para><computeroutput>n &lt;= size()</computeroutput> </para>
  936. </requires><postconditions><para>The <computeroutput>n</computeroutput> elements at the end of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be removed. </para>
  937. </postconditions><throws><simpara><classname>&lt;a</classname> href="circular_buffer/implementation.html#circular_buffer.implementation.exceptions_of_move_if_noexcept_t"&gt;Exceptions of move_if_noexcept(T&amp;). </simpara></throws></method>
  938. <method name="clear" cv="noexcept"><type>void</type><purpose>Remove all stored elements from the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </purpose><description><para>
  939. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  940. </formalpara>
  941. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  942. </formalpara>
  943. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>) for scalar types; linear for other types. </para>
  944. </formalpara>
  945. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>~circular_buffer()</computeroutput>, <computeroutput>erase(iterator)</computeroutput>, <computeroutput>erase(iterator, iterator)</computeroutput>, <computeroutput>rerase(iterator)</computeroutput>, <computeroutput>rerase(iterator, iterator)</computeroutput>, <computeroutput>erase_begin(size_type)</computeroutput>, <computeroutput>erase_end(size_type)</computeroutput> </para>
  946. </para>
  947. </para></description><postconditions><para><computeroutput>size() == 0</computeroutput> </para>
  948. </postconditions><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  949. </method-group>
  950. <constructor specifiers="explicit" cv="noexcept"><parameter name="alloc"><paramtype>const allocator_type &amp;</paramtype><default>allocator_type()</default><description><para>The allocator. </para></description></parameter><purpose>Create an empty <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> with zero capacity. </purpose><description><para>
  951. <formalpara><title>Complexity</title><para>Constant. </para>
  952. </formalpara>
  953. <warning><para>Since Boost version 1.36 the behaviour of this constructor has changed. Now the constructor does not allocate any memory and both capacity and size are set to zero. Also note when inserting an element into a <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> with zero capacity (e.g. by <computeroutput>push_back(const_reference)</computeroutput> or <computeroutput>insert(iterator, value_type)</computeroutput>) nothing will be inserted and the size (as well as capacity) remains zero. </para>
  954. </warning>
  955. <note><para>You can explicitly set the capacity by calling the <computeroutput>set_capacity(capacity_type)</computeroutput> method or you can use the other constructor with the capacity specified. </para>
  956. </note>
  957. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>circular_buffer(capacity_type, const allocator_type&amp; alloc)</computeroutput>, <computeroutput>set_capacity(capacity_type)</computeroutput> </para>
  958. </para>
  959. </para></description><postconditions><para><computeroutput>capacity() == 0 &amp;&amp; size() == 0</computeroutput> </para>
  960. </postconditions><throws><simpara><classname>Nothing.</classname> </simpara></throws></constructor>
  961. <constructor specifiers="explicit"><parameter name="buffer_capacity"><paramtype>capacity_type</paramtype><description><para>The maximum number of elements which can be stored in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para></description></parameter><parameter name="alloc"><paramtype>const allocator_type &amp;</paramtype><default>allocator_type()</default><description><para>The allocator. </para></description></parameter><purpose>Create an empty <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> with the specified capacity. </purpose><description><para>
  962. <formalpara><title>Complexity</title><para>Constant. </para>
  963. </formalpara>
  964. </para></description><postconditions><para><computeroutput>capacity() == buffer_capacity &amp;&amp; size() == 0</computeroutput> </para>
  965. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). </simpara></throws></constructor>
  966. <constructor><parameter name="n"><paramtype>size_type</paramtype><description><para>The number of elements the created <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be filled with. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element the created <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be filled with. </para></description></parameter><parameter name="alloc"><paramtype>const allocator_type &amp;</paramtype><default>allocator_type()</default><description><para>The allocator. </para></description></parameter><purpose>Create a full <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> with the specified capacity and filled with <computeroutput>n</computeroutput> copies of <computeroutput>item</computeroutput>. </purpose><description><para>
  967. <formalpara><title>Complexity</title><para>Linear (in the <computeroutput>n</computeroutput>). </para>
  968. </formalpara>
  969. </para></description><postconditions><para><computeroutput>capacity() == n &amp;&amp; full() &amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this)[n - 1] == item </computeroutput> </para>
  970. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></constructor>
  971. <constructor><parameter name="buffer_capacity"><paramtype>capacity_type</paramtype><description><para>The capacity of the created <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para></description></parameter><parameter name="n"><paramtype>size_type</paramtype><description><para>The number of elements the created <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be filled with. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element the created <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> will be filled with. </para></description></parameter><parameter name="alloc"><paramtype>const allocator_type &amp;</paramtype><default>allocator_type()</default><description><para>The allocator. </para></description></parameter><purpose>Create a <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> with the specified capacity and filled with <computeroutput>n</computeroutput> copies of <computeroutput>item</computeroutput>. </purpose><description><para>
  972. <formalpara><title>Complexity</title><para>Linear (in the <computeroutput>n</computeroutput>). </para>
  973. </formalpara>
  974. </para></description><requires><para><computeroutput>buffer_capacity &gt;= n</computeroutput> </para>
  975. </requires><postconditions><para><computeroutput>capacity() == buffer_capacity &amp;&amp; size() == n &amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this)[n - 1] == item</computeroutput> </para>
  976. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></constructor>
  977. <constructor><parameter name="cb"><paramtype>const <classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to be copied. </para></description></parameter><purpose>The copy constructor. </purpose><description><para>Creates a copy of the specified <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>.
  978. <formalpara><title>Complexity</title><para>Linear (in the size of <computeroutput>cb</computeroutput>). </para>
  979. </formalpara>
  980. </para></description><postconditions><para><computeroutput>*this == cb</computeroutput> </para>
  981. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></constructor>
  982. <constructor cv="noexcept"><parameter name="cb"><paramtype><classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;&amp;</paramtype><description><para><computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to 'steal' value from. </para></description></parameter><purpose>The move constructor. </purpose><description><para>Move constructs a <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> from <computeroutput>cb</computeroutput>, leaving <computeroutput>cb</computeroutput> empty.
  983. <formalpara><title>Constant.</title><para/>
  984. </formalpara>
  985. </para></description><requires><para>C++ compiler with rvalue references support. </para>
  986. </requires><postconditions><para><computeroutput>cb.empty()</computeroutput> </para>
  987. </postconditions><throws><simpara><classname>Nothing.</classname> </simpara></throws></constructor>
  988. <constructor><template>
  989. <template-type-parameter name="InputIterator"/>
  990. </template><parameter name="first"><paramtype>InputIterator</paramtype><description><para>The beginning of the range to be copied. </para></description></parameter><parameter name="last"><paramtype>InputIterator</paramtype><description><para>The end of the range to be copied. </para></description></parameter><parameter name="alloc"><paramtype>const allocator_type &amp;</paramtype><default>allocator_type()</default><description><para>The allocator. </para></description></parameter><purpose>Create a full <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> filled with a copy of the range. </purpose><description><para>
  991. <formalpara><title>Complexity</title><para>Linear (in the <computeroutput>std::distance(first, last)</computeroutput>). </para>
  992. </formalpara>
  993. </para></description><requires><para>Valid range <computeroutput>[first, last)</computeroutput>.<sbr/>
  994. <computeroutput>first</computeroutput> and <computeroutput>last</computeroutput> have to meet the requirements of <ulink url="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</ulink>. </para>
  995. </requires><postconditions><para><computeroutput>capacity() == std::distance(first, last) &amp;&amp; full() &amp;&amp; (*this)[0]== *first &amp;&amp; (*this)[1] == *(first + 1) &amp;&amp; ... &amp;&amp; (*this)[std::distance(first, last) - 1] == *(last - 1)</computeroutput> </para>
  996. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></constructor>
  997. <constructor><template>
  998. <template-type-parameter name="InputIterator"/>
  999. </template><parameter name="buffer_capacity"><paramtype>capacity_type</paramtype><description><para>The capacity of the created <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para></description></parameter><parameter name="first"><paramtype>InputIterator</paramtype><description><para>The beginning of the range to be copied. </para></description></parameter><parameter name="last"><paramtype>InputIterator</paramtype><description><para>The end of the range to be copied. </para></description></parameter><parameter name="alloc"><paramtype>const allocator_type &amp;</paramtype><default>allocator_type()</default><description><para>The allocator. </para></description></parameter><purpose>Create a <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> with the specified capacity and filled with a copy of the range. </purpose><description><para>
  1000. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>std::distance(first, last)</computeroutput>; in <computeroutput>min[capacity, std::distance(first, last)]</computeroutput> if the <computeroutput>InputIterator</computeroutput> is a <ulink url="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</ulink>). </para>
  1001. </formalpara>
  1002. </para></description><requires><para>Valid range <computeroutput>[first, last)</computeroutput>.<sbr/>
  1003. <computeroutput>first</computeroutput> and <computeroutput>last</computeroutput> have to meet the requirements of <ulink url="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</ulink>. </para>
  1004. </requires><postconditions><para><computeroutput>capacity() == buffer_capacity &amp;&amp; size() &lt;= std::distance(first, last) &amp;&amp; (*this)[0]== *(last - buffer_capacity) &amp;&amp; (*this)[1] == *(last - buffer_capacity + 1) &amp;&amp; ... &amp;&amp; (*this)[buffer_capacity - 1] == *(last - 1)</computeroutput><sbr/>
  1005. <sbr/>
  1006. If the number of items to be copied from the range <computeroutput>[first, last)</computeroutput> is greater than the specified <computeroutput>buffer_capacity</computeroutput> then only elements from the range <computeroutput>[last - buffer_capacity, last)</computeroutput> will be copied. </para>
  1007. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></constructor>
  1008. <destructor><purpose>The destructor. </purpose><description><para>Destroys the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>.
  1009. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> (including iterators equal to <computeroutput>end()</computeroutput>). </para>
  1010. </formalpara>
  1011. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>) for scalar types; linear for other types. </para>
  1012. </formalpara>
  1013. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>clear()</computeroutput> </para>
  1014. </para>
  1015. </para></description><throws><simpara><classname>Nothing.</classname> </simpara></throws></destructor>
  1016. <copy-assignment><type><classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</type><parameter name="cb"><paramtype>const <classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to be copied. </para></description></parameter><purpose>The assign operator. </purpose><description><para>Makes this <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to become a copy of the specified <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>.
  1017. <formalpara><title>Exception Safety</title><para>Strong. </para>
  1018. </formalpara>
  1019. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to this <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1020. </formalpara>
  1021. <formalpara><title>Complexity</title><para>Linear (in the size of <computeroutput>cb</computeroutput>). </para>
  1022. </formalpara>
  1023. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>assign(size_type, const_reference)</computeroutput>, <computeroutput>assign(capacity_type, size_type, const_reference)</computeroutput>, <computeroutput>assign(InputIterator, InputIterator)</computeroutput>, <computeroutput>assign(capacity_type, InputIterator, InputIterator)</computeroutput> </para>
  1024. </para>
  1025. </para></description><postconditions><para><computeroutput>*this == cb</computeroutput> </para>
  1026. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></copy-assignment>
  1027. <copy-assignment cv="noexcept"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</type><parameter name="cb"><paramtype><classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;&amp;</paramtype><description><para><computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to 'steal' value from. </para></description></parameter><purpose>Move assigns content of <computeroutput>cb</computeroutput> to <computeroutput>*this</computeroutput>, leaving <computeroutput>cb</computeroutput> empty. </purpose><description><para>
  1028. <formalpara><title>Complexity</title><para>Constant. </para>
  1029. </formalpara>
  1030. </para></description><requires><para>C++ compiler with rvalue references support. </para>
  1031. </requires><postconditions><para><computeroutput>cb.empty()</computeroutput> </para>
  1032. </postconditions><throws><simpara><classname>Nothing.</classname> </simpara></throws></copy-assignment>
  1033. </class><function name="operator=="><type>bool</type><template>
  1034. <template-type-parameter name="T"/>
  1035. <template-type-parameter name="Alloc"/>
  1036. </template><parameter name="lhs"><paramtype>const <classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to compare. </para></description></parameter><parameter name="rhs"><paramtype>const <classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to compare. </para></description></parameter><purpose>Compare two <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s element-by-element to determine if they are equal. </purpose><description><para>
  1037. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s). </para>
  1038. </formalpara>
  1039. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  1040. </formalpara>
  1041. </para></description><returns><para><computeroutput>lhs.size() == rhs.size() &amp;&amp; <ulink url="https://www.boost.org/sgi/stl/equal.html">std::equal</ulink>(lhs.begin(), lhs.end(), rhs.begin())</computeroutput> </para>
  1042. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></function>
  1043. <function name="operator&lt;"><type>bool</type><template>
  1044. <template-type-parameter name="T"/>
  1045. <template-type-parameter name="Alloc"/>
  1046. </template><parameter name="lhs"><paramtype>const <classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to compare. </para></description></parameter><parameter name="rhs"><paramtype>const <classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to compare. </para></description></parameter><purpose>Compare two <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s element-by-element to determine if the left one is lesser than the right one. </purpose><description><para>
  1047. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s). </para>
  1048. </formalpara>
  1049. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  1050. </formalpara>
  1051. </para></description><returns><para><computeroutput><ulink url="https://www.boost.org/sgi/stl/lexicographical_compare.html">std::lexicographical_compare</ulink>(lhs.begin(), lhs.end(), rhs.begin(), rhs.end())</computeroutput> </para>
  1052. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></function>
  1053. <function name="operator!="><type>bool</type><template>
  1054. <template-type-parameter name="T"/>
  1055. <template-type-parameter name="Alloc"/>
  1056. </template><parameter name="lhs"><paramtype>const <classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to compare. </para></description></parameter><parameter name="rhs"><paramtype>const <classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to compare. </para></description></parameter><purpose>Compare two <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s element-by-element to determine if they are non-equal. </purpose><description><para>
  1057. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s). </para>
  1058. </formalpara>
  1059. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  1060. </formalpara>
  1061. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>operator==(const circular_buffer&lt;T,Alloc&gt;&amp;, const circular_buffer&lt;T,Alloc&gt;&amp;)</computeroutput> </para>
  1062. </para>
  1063. </para></description><returns><para><computeroutput>!(lhs == rhs)</computeroutput> </para>
  1064. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></function>
  1065. <function name="operator&gt;"><type>bool</type><template>
  1066. <template-type-parameter name="T"/>
  1067. <template-type-parameter name="Alloc"/>
  1068. </template><parameter name="lhs"><paramtype>const <classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to compare. </para></description></parameter><parameter name="rhs"><paramtype>const <classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to compare. </para></description></parameter><purpose>Compare two <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s element-by-element to determine if the left one is greater than the right one. </purpose><description><para>
  1069. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s). </para>
  1070. </formalpara>
  1071. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  1072. </formalpara>
  1073. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>operator&lt;(const circular_buffer&lt;T,Alloc&gt;&amp;, const circular_buffer&lt;T,Alloc&gt;&amp;)</computeroutput> </para>
  1074. </para>
  1075. </para></description><returns><para><computeroutput>rhs &lt; lhs</computeroutput> </para>
  1076. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></function>
  1077. <function name="operator&lt;="><type>bool</type><template>
  1078. <template-type-parameter name="T"/>
  1079. <template-type-parameter name="Alloc"/>
  1080. </template><parameter name="lhs"><paramtype>const <classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to compare. </para></description></parameter><parameter name="rhs"><paramtype>const <classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to compare. </para></description></parameter><purpose>Compare two <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s element-by-element to determine if the left one is lesser or equal to the right one. </purpose><description><para>
  1081. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s). </para>
  1082. </formalpara>
  1083. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  1084. </formalpara>
  1085. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>operator&lt;(const circular_buffer&lt;T,Alloc&gt;&amp;, const circular_buffer&lt;T,Alloc&gt;&amp;)</computeroutput> </para>
  1086. </para>
  1087. </para></description><returns><para><computeroutput>!(rhs &lt; lhs)</computeroutput> </para>
  1088. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></function>
  1089. <function name="operator&gt;="><type>bool</type><template>
  1090. <template-type-parameter name="T"/>
  1091. <template-type-parameter name="Alloc"/>
  1092. </template><parameter name="lhs"><paramtype>const <classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to compare. </para></description></parameter><parameter name="rhs"><paramtype>const <classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to compare. </para></description></parameter><purpose>Compare two <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s element-by-element to determine if the left one is greater or equal to the right one. </purpose><description><para>
  1093. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s). </para>
  1094. </formalpara>
  1095. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  1096. </formalpara>
  1097. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>operator&lt;(const circular_buffer&lt;T,Alloc&gt;&amp;, const circular_buffer&lt;T,Alloc&gt;&amp;)</computeroutput> </para>
  1098. </para>
  1099. </para></description><returns><para><computeroutput>!(lhs &lt; rhs)</computeroutput> </para>
  1100. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></function>
  1101. <function name="swap"><type>void</type><template>
  1102. <template-type-parameter name="T"/>
  1103. <template-type-parameter name="Alloc"/>
  1104. </template><parameter name="lhs"><paramtype><classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> whose content will be swapped with <computeroutput>rhs</computeroutput>. </para></description></parameter><parameter name="rhs"><paramtype><classname>circular_buffer</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> whose content will be swapped with <computeroutput>lhs</computeroutput>. </para></description></parameter><purpose>Swap the contents of two <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s. </purpose><description><para>
  1105. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s). </para>
  1106. </formalpara>
  1107. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators of both <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>s. (On the other hand the iterators still point to the same elements but within another container. If you want to rely on this feature you have to turn the <ulink url="#debug">Debug Support</ulink> off otherwise an assertion will report an error if such invalidated iterator is used.) </para>
  1108. </formalpara>
  1109. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>swap(circular_buffer&lt;T, Alloc&gt;&amp;)</computeroutput> </para>
  1110. </para>
  1111. </para></description><postconditions><para><computeroutput>lhs</computeroutput> contains elements of <computeroutput>rhs</computeroutput> and vice versa. </para>
  1112. </postconditions><throws><simpara><classname>Nothing.</classname> </simpara></throws></function>
  1113. </namespace>
  1114. </header>
  1115. <header name="boost/circular_buffer/space_optimized.hpp">
  1116. <namespace name="boost">
  1117. <class name="circular_buffer_space_optimized"><template>
  1118. <template-type-parameter name="T"/>
  1119. <template-type-parameter name="Alloc"/>
  1120. </template><inherit access="private">boost::circular_buffer&lt; T, Alloc &gt;</inherit><purpose>Space optimized circular buffer container adaptor. <computeroutput>T</computeroutput> must be a copyable class or must have an noexcept move constructor and move assignment operator. </purpose><typedef name="value_type"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::value_type</type></typedef>
  1121. <typedef name="pointer"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::pointer</type></typedef>
  1122. <typedef name="const_pointer"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::const_pointer</type></typedef>
  1123. <typedef name="reference"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::reference</type></typedef>
  1124. <typedef name="const_reference"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::const_reference</type></typedef>
  1125. <typedef name="size_type"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::size_type</type></typedef>
  1126. <typedef name="difference_type"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::difference_type</type></typedef>
  1127. <typedef name="allocator_type"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::allocator_type</type></typedef>
  1128. <typedef name="const_iterator"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::const_iterator</type></typedef>
  1129. <typedef name="iterator"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::iterator</type></typedef>
  1130. <typedef name="const_reverse_iterator"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::const_reverse_iterator</type></typedef>
  1131. <typedef name="reverse_iterator"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::reverse_iterator</type></typedef>
  1132. <typedef name="array_range"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::array_range</type></typedef>
  1133. <typedef name="const_array_range"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::const_array_range</type></typedef>
  1134. <typedef name="param_value_type"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::param_value_type</type></typedef>
  1135. <typedef name="rvalue_type"><type><classname>circular_buffer</classname>&lt; T, Alloc &gt;::rvalue_type</type></typedef>
  1136. <typedef name="capacity_type"><description><para>Capacity controller of the space optimized circular buffer.</para><para><para><emphasis role="bold">See Also:</emphasis><para>capacity_control in details.hpp. </para>
  1137. </para>
  1138. <computeroutput> class capacity_control<sbr/>
  1139. {<sbr/>
  1140. size_type m_capacity; // Available capacity.<sbr/>
  1141. size_type m_min_capacity; // Minimum capacity.<sbr/>
  1142. public:<sbr/>
  1143. capacity_control(size_type capacity, size_type min_capacity = 0)<sbr/>
  1144. : m_capacity(capacity), m_min_capacity(min_capacity)<sbr/>
  1145. {};<sbr/>
  1146. size_type capacity() const { return m_capacity; }<sbr/>
  1147. size_type min_capacity() const { return m_min_capacity; }<sbr/>
  1148. operator size_type() const { return m_capacity; }<sbr/>
  1149. };<sbr/>
  1150. </computeroutput> </para><para>Always <computeroutput>capacity &gt;= min_capacity</computeroutput>. </para><para>The <computeroutput>capacity()</computeroutput> represents the capacity of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> and the <computeroutput>min_capacity()</computeroutput> determines the minimal allocated size of its internal buffer. </para><para>The converting constructor of the <computeroutput>capacity_control</computeroutput> allows implicit conversion from <computeroutput>size_type</computeroutput>-like types which ensures compatibility of creating an instance of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> with other STL containers.</para><para>On the other hand the operator <computeroutput>size_type()</computeroutput> provides implicit conversion to the <computeroutput>size_type</computeroutput> which allows to treat the capacity of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> the same way as in the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para></description><type>cb_details::capacity_control&lt; size_type &gt;</type></typedef>
  1151. <method-group name="public member functions">
  1152. <method name="full" cv="const noexcept"><type>bool</type><purpose>Is the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> full? </purpose><description><para>
  1153. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  1154. </formalpara>
  1155. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  1156. </formalpara>
  1157. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1158. </formalpara>
  1159. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>empty()</computeroutput> </para>
  1160. </para>
  1161. </para></description><returns><para><computeroutput>true</computeroutput> if the number of elements stored in the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> equals the capacity of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>; <computeroutput>false</computeroutput> otherwise. </para>
  1162. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  1163. <method name="reserve" cv="const noexcept"><type>size_type</type><purpose>Get the maximum number of elements which can be inserted into the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> without overwriting any of already stored elements. </purpose><description><para>
  1164. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  1165. </formalpara>
  1166. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  1167. </formalpara>
  1168. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1169. </formalpara>
  1170. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>capacity()</computeroutput>, <computeroutput>size()</computeroutput>, <computeroutput>max_size()</computeroutput> </para>
  1171. </para>
  1172. </para></description><returns><para><computeroutput>capacity().capacity() - size()</computeroutput> </para>
  1173. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  1174. <method name="capacity" cv="const noexcept"><type>const capacity_type &amp;</type><purpose>Get the capacity of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>. </purpose><description><para>
  1175. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  1176. </formalpara>
  1177. <formalpara><title>Iterator Invalidation</title><para>Does not invalidate any iterators. </para>
  1178. </formalpara>
  1179. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1180. </formalpara>
  1181. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>reserve()</computeroutput>, <computeroutput>size()</computeroutput>, <computeroutput>max_size()</computeroutput>, <computeroutput>set_capacity(const capacity_type&amp;)</computeroutput> </para>
  1182. </para>
  1183. </para></description><returns><para>The capacity controller representing the maximum number of elements which can be stored in the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> and the minimal allocated size of the internal buffer. </para>
  1184. </returns><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  1185. <method name="set_capacity"><type>void</type><parameter name="capacity_ctrl"><paramtype>const capacity_type &amp;</paramtype><description><para>The new capacity controller. </para></description></parameter><purpose>Change the capacity (and the minimal guaranteed amount of allocated memory) of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>. </purpose><description><para>
  1186. <formalpara><title>Exception Safety</title><para>Strong. </para>
  1187. </formalpara>
  1188. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1189. </formalpara>
  1190. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>min[size(), capacity_ctrl.capacity()]</computeroutput>). </para>
  1191. </formalpara>
  1192. <note><para>To explicitly clear the extra allocated memory use the <emphasis role="bold">shrink-to-fit</emphasis> technique:<sbr/>
  1193. <sbr/>
  1194. <computeroutput>boost::circular_buffer_space_optimized&lt;int&gt; cb(1000);<sbr/>
  1195. ...<sbr/>
  1196. boost::circular_buffer_space_optimized&lt;int&gt;(cb).swap(cb);</computeroutput><sbr/>
  1197. <sbr/>
  1198. For more information about the shrink-to-fit technique in STL see <ulink url="http://www.gotw.ca/gotw/054.htm">http://www.gotw.ca/gotw/054.htm</ulink>. </para>
  1199. </note>
  1200. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rset_capacity(const capacity_type&amp;)</computeroutput>, <computeroutput>resize(size_type, const_reference)</computeroutput> </para>
  1201. </para>
  1202. </para></description><postconditions><para><computeroutput>capacity() == capacity_ctrl &amp;&amp; size() &lt;= capacity_ctrl.capacity()</computeroutput><sbr/>
  1203. <sbr/>
  1204. If the current number of elements stored in the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is greater than the desired new capacity then number of <computeroutput>[size() - capacity_ctrl.capacity()]</computeroutput> <emphasis role="bold">last</emphasis> elements will be removed and the new size will be equal to <computeroutput>capacity_ctrl.capacity()</computeroutput>.<sbr/>
  1205. <sbr/>
  1206. If the current number of elements stored in the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is lower than the new capacity then the amount of allocated memory in the internal buffer may be accommodated as necessary but it will never drop below <computeroutput>capacity_ctrl.min_capacity()</computeroutput>. </para>
  1207. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted, (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  1208. <method name="resize"><type>void</type><parameter name="new_size"><paramtype>size_type</paramtype><description><para>The new size. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><default>value_type()</default><description><para>The element the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be filled with in order to gain the requested size. (See the <emphasis>Effect</emphasis>.) </para></description></parameter><purpose>Change the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>. </purpose><description><para>
  1209. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1210. </formalpara>
  1211. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1212. </formalpara>
  1213. <formalpara><title>Complexity</title><para>Linear (in the new size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1214. </formalpara>
  1215. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rresize(size_type, const_reference)</computeroutput>, <computeroutput>set_capacity(const capacity_type&amp;)</computeroutput> </para>
  1216. </para>
  1217. </para></description><postconditions><para><computeroutput>size() == new_size &amp;&amp; capacity().capacity() &gt;= new_size</computeroutput><sbr/>
  1218. <sbr/>
  1219. If the new size is greater than the current size, copies of <computeroutput>item</computeroutput> will be inserted at the <emphasis role="bold">back</emphasis> of the of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> in order to achieve the desired size. In the case the resulting size exceeds the current capacity the capacity will be set to <computeroutput>new_size</computeroutput>.<sbr/>
  1220. <sbr/>
  1221. If the current number of elements stored in the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is greater than the desired new size then number of <computeroutput>[size() - new_size]</computeroutput> <emphasis role="bold">last</emphasis> elements will be removed. (The capacity will remain unchanged.)<sbr/>
  1222. <sbr/>
  1223. The amount of allocated memory in the internal buffer may be accommodated as necessary. </para>
  1224. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></method>
  1225. <method name="rset_capacity"><type>void</type><parameter name="capacity_ctrl"><paramtype>const capacity_type &amp;</paramtype><description><para>The new capacity controller. </para></description></parameter><purpose>Change the capacity (and the minimal guaranteed amount of allocated memory) of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>. </purpose><description><para>
  1226. <formalpara><title>Exception Safety</title><para>Strong. </para>
  1227. </formalpara>
  1228. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1229. </formalpara>
  1230. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>min[size(), capacity_ctrl.capacity()]</computeroutput>). </para>
  1231. </formalpara>
  1232. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>set_capacity(const capacity_type&amp;)</computeroutput>, <computeroutput>rresize(size_type, const_reference)</computeroutput> </para>
  1233. </para>
  1234. </para></description><postconditions><para><computeroutput>capacity() == capacity_ctrl &amp;&amp; size() &lt;= capacity_ctrl</computeroutput><sbr/>
  1235. <sbr/>
  1236. If the current number of elements stored in the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is greater than the desired new capacity then number of <computeroutput>[size() - capacity_ctrl.capacity()]</computeroutput> <emphasis role="bold">first</emphasis> elements will be removed and the new size will be equal to <computeroutput>capacity_ctrl.capacity()</computeroutput>.<sbr/>
  1237. <sbr/>
  1238. If the current number of elements stored in the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is lower than the new capacity then the amount of allocated memory in the internal buffer may be accommodated as necessary but it will never drop below <computeroutput>capacity_ctrl.min_capacity()</computeroutput>. </para>
  1239. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  1240. <method name="rresize"><type>void</type><parameter name="new_size"><paramtype>size_type</paramtype><description><para>The new size. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><default>value_type()</default><description><para>The element the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be filled with in order to gain the requested size. (See the <emphasis>Effect</emphasis>.) </para></description></parameter><purpose>Change the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>. </purpose><description><para>
  1241. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1242. </formalpara>
  1243. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1244. </formalpara>
  1245. <formalpara><title>Complexity</title><para>Linear (in the new size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1246. </formalpara>
  1247. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>resize(size_type, const_reference)</computeroutput>, <computeroutput>rset_capacity(const capacity_type&amp;)</computeroutput> </para>
  1248. </para>
  1249. </para></description><postconditions><para><computeroutput>size() == new_size &amp;&amp; capacity().capacity() &gt;= new_size</computeroutput><sbr/>
  1250. <sbr/>
  1251. If the new size is greater than the current size, copies of <computeroutput>item</computeroutput> will be inserted at the <emphasis role="bold">front</emphasis> of the of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> in order to achieve the desired size. In the case the resulting size exceeds the current capacity the capacity will be set to <computeroutput>new_size</computeroutput>.<sbr/>
  1252. <sbr/>
  1253. If the current number of elements stored in the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is greater than the desired new size then number of <computeroutput>[size() - new_size]</computeroutput> <emphasis role="bold">first</emphasis> elements will be removed. (The capacity will remain unchanged.)<sbr/>
  1254. <sbr/>
  1255. The amount of allocated memory in the internal buffer may be accommodated as necessary. </para>
  1256. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></method>
  1257. <method name="assign"><type>void</type><parameter name="n"><paramtype>size_type</paramtype><description><para>The number of elements the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be filled with. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be filled with. </para></description></parameter><purpose>Assign <computeroutput>n</computeroutput> items into the space optimized circular buffer. </purpose><description><para>The content of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be removed and replaced with <computeroutput>n</computeroutput> copies of the <computeroutput>item</computeroutput>.
  1258. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1259. </formalpara>
  1260. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1261. </formalpara>
  1262. <formalpara><title>Complexity</title><para>Linear (in the <computeroutput>n</computeroutput>). </para>
  1263. </formalpara>
  1264. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>operator=</computeroutput>, <computeroutput>assign(capacity_type, size_type, const_reference)</computeroutput>, <computeroutput>assign(InputIterator, InputIterator)</computeroutput>, <computeroutput>assign(capacity_type, InputIterator, InputIterator)</computeroutput> </para>
  1265. </para>
  1266. </para></description><postconditions><para><computeroutput>capacity().capacity() == n &amp;&amp; capacity().min_capacity() == 0 &amp;&amp; size() == n &amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this) [n - 1] == item</computeroutput><sbr/>
  1267. <sbr/>
  1268. The amount of allocated memory in the internal buffer is <computeroutput>n</computeroutput>. </para>
  1269. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></method>
  1270. <method name="assign"><type>void</type><parameter name="capacity_ctrl"><paramtype>capacity_type</paramtype><description><para>The new capacity controller. </para></description></parameter><parameter name="n"><paramtype>size_type</paramtype><description><para>The number of elements the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be filled with. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be filled with. </para></description></parameter><purpose>Assign <computeroutput>n</computeroutput> items into the space optimized circular buffer specifying the capacity. </purpose><description><para>The capacity of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be set to the specified value and the content of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be removed and replaced with <computeroutput>n</computeroutput> copies of the <computeroutput>item</computeroutput>.
  1271. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1272. </formalpara>
  1273. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1274. </formalpara>
  1275. <formalpara><title>Complexity</title><para>Linear (in the <computeroutput>n</computeroutput>). </para>
  1276. </formalpara>
  1277. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>operator=</computeroutput>, <computeroutput>assign(size_type, const_reference)</computeroutput>, <computeroutput>assign(InputIterator, InputIterator)</computeroutput>, <computeroutput>assign(capacity_type, InputIterator, InputIterator)</computeroutput> </para>
  1278. </para>
  1279. </para></description><requires><para><computeroutput>capacity_ctrl.capacity() &gt;= n</computeroutput> </para>
  1280. </requires><postconditions><para><computeroutput>capacity() == capacity_ctrl &amp;&amp; size() == n &amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this) [n - 1] == item </computeroutput><sbr/>
  1281. <sbr/>
  1282. The amount of allocated memory will be <computeroutput>max[n, capacity_ctrl.min_capacity()]</computeroutput>. </para>
  1283. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></method>
  1284. <method name="assign"><type>void</type><template>
  1285. <template-type-parameter name="InputIterator"/>
  1286. </template><parameter name="first"><paramtype>InputIterator</paramtype><description><para>The beginning of the range to be copied. </para></description></parameter><parameter name="last"><paramtype>InputIterator</paramtype><description><para>The end of the range to be copied. </para></description></parameter><purpose>Assign a copy of the range into the space optimized circular buffer. </purpose><description><para>The content of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be removed and replaced with copies of elements from the specified range.
  1287. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1288. </formalpara>
  1289. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1290. </formalpara>
  1291. <formalpara><title>Complexity</title><para>Linear (in the <computeroutput>std::distance(first, last)</computeroutput>). </para>
  1292. </formalpara>
  1293. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>operator=</computeroutput>, <computeroutput>assign(size_type, const_reference)</computeroutput>, <computeroutput>assign(capacity_type, size_type, const_reference)</computeroutput>, <computeroutput>assign(capacity_type, InputIterator, InputIterator)</computeroutput> </para>
  1294. </para>
  1295. </para></description><requires><para>Valid range <computeroutput>[first, last)</computeroutput>.<sbr/>
  1296. <computeroutput>first</computeroutput> and <computeroutput>last</computeroutput> have to meet the requirements of <ulink url="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</ulink>. </para>
  1297. </requires><postconditions><para><computeroutput>capacity().capacity() == std::distance(first, last) &amp;&amp; capacity().min_capacity() == 0 &amp;&amp; size() == std::distance(first, last) &amp;&amp; (*this)[0]== *first &amp;&amp; (*this)[1] == *(first + 1) &amp;&amp; ... &amp;&amp; (*this)[std::distance(first, last) - 1] == *(last - 1)</computeroutput><sbr/>
  1298. <sbr/>
  1299. The amount of allocated memory in the internal buffer is <computeroutput>std::distance(first, last)</computeroutput>. </para>
  1300. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept and <computeroutput>InputIterator</computeroutput> is a move iterator. </simpara></throws></method>
  1301. <method name="assign"><type>void</type><template>
  1302. <template-type-parameter name="InputIterator"/>
  1303. </template><parameter name="capacity_ctrl"><paramtype>capacity_type</paramtype><description><para>The new capacity controller. </para></description></parameter><parameter name="first"><paramtype>InputIterator</paramtype><description><para>The beginning of the range to be copied. </para></description></parameter><parameter name="last"><paramtype>InputIterator</paramtype><description><para>The end of the range to be copied. </para></description></parameter><purpose>Assign a copy of the range into the space optimized circular buffer specifying the capacity. </purpose><description><para>The capacity of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be set to the specified value and the content of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be removed and replaced with copies of elements from the specified range.
  1304. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1305. </formalpara>
  1306. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1307. </formalpara>
  1308. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>std::distance(first, last)</computeroutput>; in <computeroutput>min[capacity_ctrl.capacity(), std::distance(first, last)]</computeroutput> if the <computeroutput>InputIterator</computeroutput> is a <ulink url="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</ulink>). </para>
  1309. </formalpara>
  1310. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>operator=</computeroutput>, <computeroutput>assign(size_type, const_reference)</computeroutput>, <computeroutput>assign(capacity_type, size_type, const_reference)</computeroutput>, <computeroutput>assign(InputIterator, InputIterator)</computeroutput> </para>
  1311. </para>
  1312. </para></description><requires><para>Valid range <computeroutput>[first, last)</computeroutput>.<sbr/>
  1313. <computeroutput>first</computeroutput> and <computeroutput>last</computeroutput> have to meet the requirements of <ulink url="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</ulink>. </para>
  1314. </requires><postconditions><para><computeroutput>capacity() == capacity_ctrl &amp;&amp; size() &lt;= std::distance(first, last) &amp;&amp; (*this)[0]== *(last - capacity) &amp;&amp; (*this)[1] == *(last - capacity + 1) &amp;&amp; ... &amp;&amp; (*this)[capacity - 1] == *(last - 1)</computeroutput><sbr/>
  1315. <sbr/>
  1316. If the number of items to be copied from the range <computeroutput>[first, last)</computeroutput> is greater than the specified <computeroutput>capacity</computeroutput> then only elements from the range <computeroutput>[last - capacity, last)</computeroutput> will be copied.<sbr/>
  1317. <sbr/>
  1318. The amount of allocated memory in the internal buffer is <computeroutput>max[std::distance(first, last), capacity_ctrl.min_capacity()]</computeroutput>. </para>
  1319. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept and <computeroutput>InputIterator</computeroutput> is a move iterator. </simpara></throws></method>
  1320. <method name="swap" cv="noexcept"><type>void</type><parameter name="cb"><paramtype><classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> whose content will be swapped. </para></description></parameter><purpose>Swap the contents of two space-optimized circular-buffers. </purpose><description><para>
  1321. <formalpara><title>Exception Safety</title><para>No-throw. </para>
  1322. </formalpara>
  1323. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators of both <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> containers. (On the other hand the iterators still point to the same elements but within another container. If you want to rely on this feature you have to turn the __debug_support off, otherwise an assertion will report an error if such invalidated iterator is used.) </para>
  1324. </formalpara>
  1325. <formalpara><title>Complexity</title><para>Constant (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1326. </formalpara>
  1327. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>swap(circular_buffer&lt;T, Alloc&gt;&amp;, circular_buffer&lt;T, Alloc&gt;&amp;)</computeroutput>, <computeroutput>swap(circular_buffer_space_optimized&lt;T, Alloc&gt;&amp;, circular_buffer_space_optimized&lt;T, Alloc&gt;&amp;)</computeroutput> </para>
  1328. </para>
  1329. </para></description><postconditions><para><computeroutput>this</computeroutput> contains elements of <computeroutput>cb</computeroutput> and vice versa; the capacity and the amount of allocated memory in the internal buffer of <computeroutput>this</computeroutput> equal to the capacity and the amount of allocated memory of <computeroutput>cb</computeroutput> and vice versa. </para>
  1330. </postconditions><throws><simpara><classname>Nothing.</classname> </simpara></throws></method>
  1331. <method name="push_back"><type>void</type><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert a new element at the end of the space optimized circular buffer. </purpose><description><para>
  1332. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1333. </formalpara>
  1334. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1335. </formalpara>
  1336. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1337. </formalpara>
  1338. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>push_front(const_reference)</computeroutput>, <computeroutput>pop_back()</computeroutput>, <computeroutput>pop_front()</computeroutput> </para>
  1339. </para>
  1340. </para></description><postconditions><para>if <computeroutput>capacity().capacity() &gt; 0</computeroutput> then <computeroutput>back() == item</computeroutput><sbr/>
  1341. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full, the first element will be removed. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted.<sbr/>
  1342. <sbr/>
  1343. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1344. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></method>
  1345. <method name="push_back"><type>void</type><parameter name="item"><paramtype>rvalue_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert a new element at the end of the space optimized circular buffer. </purpose><description><para>
  1346. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1347. </formalpara>
  1348. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1349. </formalpara>
  1350. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1351. </formalpara>
  1352. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>push_front(const_reference)</computeroutput>, <computeroutput>pop_back()</computeroutput>, <computeroutput>pop_front()</computeroutput> </para>
  1353. </para>
  1354. </para></description><postconditions><para>if <computeroutput>capacity().capacity() &gt; 0</computeroutput> then <computeroutput>back() == item</computeroutput><sbr/>
  1355. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full, the first element will be removed. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted.<sbr/>
  1356. <sbr/>
  1357. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1358. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). </simpara></throws></method>
  1359. <method name="push_back"><type>void</type><purpose>Insert a new element at the end of the space optimized circular buffer. </purpose><description><para>
  1360. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1361. </formalpara>
  1362. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1363. </formalpara>
  1364. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1365. </formalpara>
  1366. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>push_front(const_reference)</computeroutput>, <computeroutput>pop_back()</computeroutput>, <computeroutput>pop_front()</computeroutput> </para>
  1367. </para>
  1368. </para></description><postconditions><para>if <computeroutput>capacity().capacity() &gt; 0</computeroutput> then <computeroutput>back() == item</computeroutput><sbr/>
  1369. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full, the first element will be removed. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted.<sbr/>
  1370. <sbr/>
  1371. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1372. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T()</computeroutput> throws. Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  1373. <method name="push_front"><type>void</type><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert a new element at the beginning of the space optimized circular buffer. </purpose><description><para>
  1374. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1375. </formalpara>
  1376. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1377. </formalpara>
  1378. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1379. </formalpara>
  1380. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>push_back(const_reference)</computeroutput>, <computeroutput>pop_back()</computeroutput>, <computeroutput>pop_front()</computeroutput> </para>
  1381. </para>
  1382. </para></description><postconditions><para>if <computeroutput>capacity().capacity() &gt; 0</computeroutput> then <computeroutput>front() == item</computeroutput><sbr/>
  1383. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full, the last element will be removed. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted.<sbr/>
  1384. <sbr/>
  1385. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1386. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></method>
  1387. <method name="push_front"><type>void</type><parameter name="item"><paramtype>rvalue_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert a new element at the beginning of the space optimized circular buffer. </purpose><description><para>
  1388. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1389. </formalpara>
  1390. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1391. </formalpara>
  1392. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1393. </formalpara>
  1394. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>push_back(const_reference)</computeroutput>, <computeroutput>pop_back()</computeroutput>, <computeroutput>pop_front()</computeroutput> </para>
  1395. </para>
  1396. </para></description><postconditions><para>if <computeroutput>capacity().capacity() &gt; 0</computeroutput> then <computeroutput>front() == item</computeroutput><sbr/>
  1397. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full, the last element will be removed. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted.<sbr/>
  1398. <sbr/>
  1399. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1400. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  1401. <method name="push_front"><type>void</type><purpose>Insert a new element at the beginning of the space optimized circular buffer. </purpose><description><para>
  1402. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1403. </formalpara>
  1404. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1405. </formalpara>
  1406. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1407. </formalpara>
  1408. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>push_back(const_reference)</computeroutput>, <computeroutput>pop_back()</computeroutput>, <computeroutput>pop_front()</computeroutput> </para>
  1409. </para>
  1410. </para></description><postconditions><para>if <computeroutput>capacity().capacity() &gt; 0</computeroutput> then <computeroutput>front() == item</computeroutput><sbr/>
  1411. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full, the last element will be removed. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted.<sbr/>
  1412. <sbr/>
  1413. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1414. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T()</computeroutput> throws. Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  1415. <method name="pop_back"><type>void</type><purpose>Remove the last element from the space optimized circular buffer. </purpose><description><para>
  1416. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1417. </formalpara>
  1418. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1419. </formalpara>
  1420. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1421. </formalpara>
  1422. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>pop_front()</computeroutput>, <computeroutput>push_back(const_reference)</computeroutput>, <computeroutput>push_front(const_reference)</computeroutput> </para>
  1423. </para>
  1424. </para></description><requires><para><computeroutput>!empty()</computeroutput> </para>
  1425. </requires><postconditions><para>The last element is removed from the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>.<sbr/>
  1426. <sbr/>
  1427. The amount of allocated memory in the internal buffer may be predictively decreased. </para>
  1428. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). </simpara></throws></method>
  1429. <method name="pop_front"><type>void</type><purpose>Remove the first element from the space optimized circular buffer. </purpose><description><para>
  1430. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1431. </formalpara>
  1432. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1433. </formalpara>
  1434. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1435. </formalpara>
  1436. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>pop_back()</computeroutput>, <computeroutput>push_back(const_reference)</computeroutput>, <computeroutput>push_front(const_reference)</computeroutput> </para>
  1437. </para>
  1438. </para></description><requires><para><computeroutput>!empty()</computeroutput> </para>
  1439. </requires><postconditions><para>The first element is removed from the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>.<sbr/>
  1440. <sbr/>
  1441. The amount of allocated memory in the internal buffer may be predictively decreased. </para>
  1442. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). </simpara></throws></method>
  1443. <method name="insert"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position where the <computeroutput>item</computeroutput> will be inserted. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert an element at the specified position. </purpose><description><para>
  1444. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1445. </formalpara>
  1446. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1447. </formalpara>
  1448. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1449. </formalpara>
  1450. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>rinsert(iterator, value_type)</computeroutput>, <computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  1451. </para>
  1452. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> or its end. </para>
  1453. </requires><postconditions><para>The <computeroutput>item</computeroutput> will be inserted at the position <computeroutput>pos</computeroutput>.<sbr/>
  1454. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full, the first element will be overwritten. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full and the <computeroutput>pos</computeroutput> points to <computeroutput>begin()</computeroutput>, then the <computeroutput>item</computeroutput> will not be inserted. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted.<sbr/>
  1455. <sbr/>
  1456. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1457. </postconditions><returns><para>Iterator to the inserted element or <computeroutput>begin()</computeroutput> if the <computeroutput>item</computeroutput> is not inserted. (See the <emphasis>Effect</emphasis>.) </para>
  1458. </returns><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws. </simpara></throws></method>
  1459. <method name="insert"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position where the <computeroutput>item</computeroutput> will be inserted. </para></description></parameter><parameter name="item"><paramtype>rvalue_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert an element at the specified position. </purpose><description><para>
  1460. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1461. </formalpara>
  1462. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1463. </formalpara>
  1464. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1465. </formalpara>
  1466. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>rinsert(iterator, value_type)</computeroutput>, <computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  1467. </para>
  1468. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> or its end. </para>
  1469. </requires><postconditions><para>The <computeroutput>item</computeroutput> will be inserted at the position <computeroutput>pos</computeroutput>.<sbr/>
  1470. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full, the first element will be overwritten. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full and the <computeroutput>pos</computeroutput> points to <computeroutput>begin()</computeroutput>, then the <computeroutput>item</computeroutput> will not be inserted. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted.<sbr/>
  1471. <sbr/>
  1472. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1473. </postconditions><returns><para>Iterator to the inserted element or <computeroutput>begin()</computeroutput> if the <computeroutput>item</computeroutput> is not inserted. (See the <emphasis>Effect</emphasis>.) </para>
  1474. </returns><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  1475. <method name="insert"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position where the <computeroutput>item</computeroutput> will be inserted. </para></description></parameter><purpose>Insert an element at the specified position. </purpose><description><para>
  1476. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1477. </formalpara>
  1478. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1479. </formalpara>
  1480. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1481. </formalpara>
  1482. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>rinsert(iterator, value_type)</computeroutput>, <computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  1483. </para>
  1484. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> or its end. </para>
  1485. </requires><postconditions><para>The <computeroutput>item</computeroutput> will be inserted at the position <computeroutput>pos</computeroutput>.<sbr/>
  1486. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full, the first element will be overwritten. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full and the <computeroutput>pos</computeroutput> points to <computeroutput>begin()</computeroutput>, then the <computeroutput>item</computeroutput> will not be inserted. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted.<sbr/>
  1487. <sbr/>
  1488. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1489. </postconditions><returns><para>Iterator to the inserted element or <computeroutput>begin()</computeroutput> if the <computeroutput>item</computeroutput> is not inserted. (See the <emphasis>Effect</emphasis>.) </para>
  1490. </returns><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T()</computeroutput> throws. Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  1491. <method name="insert"><type>void</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position where the <computeroutput>item</computeroutput>s will be inserted. </para></description></parameter><parameter name="n"><paramtype>size_type</paramtype><description><para>The number of <computeroutput>item</computeroutput>s the to be inserted. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element whose copies will be inserted. </para></description></parameter><purpose>Insert <computeroutput>n</computeroutput> copies of the <computeroutput>item</computeroutput> at the specified position. </purpose><description><para>
  1492. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1493. </formalpara>
  1494. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1495. </formalpara>
  1496. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>min[capacity().capacity(), size() + n]</computeroutput>). </para>
  1497. </formalpara>
  1498. <formalpara><title>Example</title><para>Consider a <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.<sbr/>
  1499. <sbr/>
  1500. <computeroutput>|1|2|3|4| | |</computeroutput><sbr/>
  1501. <computeroutput>p ___^</computeroutput><sbr/>
  1502. <sbr/>
  1503. After inserting 5 elements at the position <computeroutput>p</computeroutput>:<sbr/>
  1504. <sbr/>
  1505. <computeroutput>insert(p, (size_t)5, 0);</computeroutput><sbr/>
  1506. <sbr/>
  1507. actually only 4 elements get inserted and elements <computeroutput>1</computeroutput> and <computeroutput>2</computeroutput> are overwritten. This is due to the fact the insert operation preserves the capacity. After insertion the internal buffer looks like this:<sbr/>
  1508. <sbr/>
  1509. <computeroutput>|0|0|0|0|3|4|</computeroutput><sbr/>
  1510. <sbr/>
  1511. For comparison if the capacity would not be preserved the internal buffer would then result in <computeroutput>|1|2|0|0|0|0|0|3|4|</computeroutput>. </para>
  1512. </formalpara>
  1513. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>insert(iterator, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>rinsert(iterator, value_type)</computeroutput>, <computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  1514. </para>
  1515. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> or its end. </para>
  1516. </requires><postconditions><para>The number of <computeroutput>min[n, (pos - begin()) + reserve()]</computeroutput> elements will be inserted at the position <computeroutput>pos</computeroutput>.<sbr/>
  1517. The number of <computeroutput>min[pos - begin(), max[0, n - reserve()]]</computeroutput> elements will be overwritten at the beginning of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>.<sbr/>
  1518. (See <emphasis>Example</emphasis> for the explanation.)<sbr/>
  1519. <sbr/>
  1520. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1521. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws. </simpara></throws></method>
  1522. <method name="insert"><type>void</type><template>
  1523. <template-type-parameter name="InputIterator"/>
  1524. </template><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position where the range will be inserted. </para></description></parameter><parameter name="first"><paramtype>InputIterator</paramtype><description><para>The beginning of the range to be inserted. </para></description></parameter><parameter name="last"><paramtype>InputIterator</paramtype><description><para>The end of the range to be inserted. </para></description></parameter><purpose>Insert the range <computeroutput>[first, last)</computeroutput> at the specified position. </purpose><description><para>
  1525. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1526. </formalpara>
  1527. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1528. </formalpara>
  1529. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>[size() + std::distance(first, last)]</computeroutput>; in <computeroutput>min[capacity().capacity(), size() + std::distance(first, last)]</computeroutput> if the <computeroutput>InputIterator</computeroutput> is a <ulink url="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</ulink>). </para>
  1530. </formalpara>
  1531. <formalpara><title>Example</title><para>Consider a <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.<sbr/>
  1532. <sbr/>
  1533. <computeroutput>|1|2|3|4| | |</computeroutput><sbr/>
  1534. <computeroutput>p ___^</computeroutput><sbr/>
  1535. <sbr/>
  1536. After inserting a range of elements at the position <computeroutput>p</computeroutput>:<sbr/>
  1537. <sbr/>
  1538. <computeroutput>int array[] = { 5, 6, 7, 8, 9 };</computeroutput><sbr/>
  1539. <computeroutput>insert(p, array, array + 5);</computeroutput><sbr/>
  1540. <sbr/>
  1541. actually only elements <computeroutput>6</computeroutput>, <computeroutput>7</computeroutput>, <computeroutput>8</computeroutput> and <computeroutput>9</computeroutput> from the specified range get inserted and elements <computeroutput>1</computeroutput> and <computeroutput>2</computeroutput> are overwritten. This is due to the fact the insert operation preserves the capacity. After insertion the internal buffer looks like this:<sbr/>
  1542. <sbr/>
  1543. <computeroutput>|6|7|8|9|3|4|</computeroutput><sbr/>
  1544. <sbr/>
  1545. For comparison if the capacity would not be preserved the internal buffer would then result in <computeroutput>|1|2|5|6|7|8|9|3|4|</computeroutput>. </para>
  1546. </formalpara>
  1547. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>insert(iterator, value_type)</computeroutput>, <computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, value_type)</computeroutput>, <computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  1548. </para>
  1549. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> or its end.<sbr/>
  1550. Valid range <computeroutput>[first, last)</computeroutput> where <computeroutput>first</computeroutput> and <computeroutput>last</computeroutput> meet the requirements of an <ulink url="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</ulink>. </para>
  1551. </requires><postconditions><para>Elements from the range <computeroutput>[first + max[0, distance(first, last) - (pos - begin()) - reserve()], last)</computeroutput> will be inserted at the position <computeroutput>pos</computeroutput>.<sbr/>
  1552. The number of <computeroutput>min[pos - begin(), max[0, distance(first, last) - reserve()]]</computeroutput> elements will be overwritten at the beginning of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>.<sbr/>
  1553. (See <emphasis>Example</emphasis> for the explanation.)<sbr/>
  1554. <sbr/>
  1555. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1556. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  1557. <method name="rinsert"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position before which the <computeroutput>item</computeroutput> will be inserted. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert an element before the specified position. </purpose><description><para>
  1558. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1559. </formalpara>
  1560. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1561. </formalpara>
  1562. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1563. </formalpara>
  1564. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>insert(iterator, value_type)</computeroutput>, <computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  1565. </para>
  1566. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> or its end. </para>
  1567. </requires><postconditions><para>The <computeroutput>item</computeroutput> will be inserted before the position <computeroutput>pos</computeroutput>.<sbr/>
  1568. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full, the last element will be overwritten. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full and the <computeroutput>pos</computeroutput> points to <computeroutput>end()</computeroutput>, then the <computeroutput>item</computeroutput> will not be inserted. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted.<sbr/>
  1569. <sbr/>
  1570. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1571. </postconditions><returns><para>Iterator to the inserted element or <computeroutput>end()</computeroutput> if the <computeroutput>item</computeroutput> is not inserted. (See the <emphasis>Effect</emphasis>.) </para>
  1572. </returns><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws. </simpara></throws></method>
  1573. <method name="rinsert"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position before which the <computeroutput>item</computeroutput> will be inserted. </para></description></parameter><parameter name="item"><paramtype>rvalue_type</paramtype><description><para>The element to be inserted. </para></description></parameter><purpose>Insert an element before the specified position. </purpose><description><para>
  1574. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1575. </formalpara>
  1576. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1577. </formalpara>
  1578. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1579. </formalpara>
  1580. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>insert(iterator, value_type)</computeroutput>, <computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  1581. </para>
  1582. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> or its end. </para>
  1583. </requires><postconditions><para>The <computeroutput>item</computeroutput> will be inserted before the position <computeroutput>pos</computeroutput>.<sbr/>
  1584. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full, the last element will be overwritten. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full and the <computeroutput>pos</computeroutput> points to <computeroutput>end()</computeroutput>, then the <computeroutput>item</computeroutput> will not be inserted. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted.<sbr/>
  1585. <sbr/>
  1586. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1587. </postconditions><returns><para>Iterator to the inserted element or <computeroutput>end()</computeroutput> if the <computeroutput>item</computeroutput> is not inserted. (See the <emphasis>Effect</emphasis>.) </para>
  1588. </returns><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  1589. <method name="rinsert"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position before which the <computeroutput>item</computeroutput> will be inserted. </para></description></parameter><purpose>Insert an element before the specified position. </purpose><description><para>
  1590. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1591. </formalpara>
  1592. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1593. </formalpara>
  1594. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1595. </formalpara>
  1596. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>insert(iterator, value_type)</computeroutput>, <computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  1597. </para>
  1598. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> or its end. </para>
  1599. </requires><postconditions><para>The <computeroutput>item</computeroutput> will be inserted before the position <computeroutput>pos</computeroutput>.<sbr/>
  1600. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full, the last element will be overwritten. If the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> is full and the <computeroutput>pos</computeroutput> points to <computeroutput>end()</computeroutput>, then the <computeroutput>item</computeroutput> will not be inserted. If the capacity is <computeroutput>0</computeroutput>, nothing will be inserted.<sbr/>
  1601. <sbr/>
  1602. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1603. </postconditions><returns><para>Iterator to the inserted element or <computeroutput>end()</computeroutput> if the <computeroutput>item</computeroutput> is not inserted. (See the <emphasis>Effect</emphasis>.) </para>
  1604. </returns><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T()</computeroutput> throws. Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  1605. <method name="rinsert"><type>void</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position where the <computeroutput>item</computeroutput>s will be inserted. </para></description></parameter><parameter name="n"><paramtype>size_type</paramtype><description><para>The number of <computeroutput>item</computeroutput>s the to be inserted. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element whose copies will be inserted. </para></description></parameter><purpose>Insert <computeroutput>n</computeroutput> copies of the <computeroutput>item</computeroutput> before the specified position. </purpose><description><para>
  1606. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1607. </formalpara>
  1608. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1609. </formalpara>
  1610. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>min[capacity().capacity(), size() + n]</computeroutput>). </para>
  1611. </formalpara>
  1612. <formalpara><title>Example</title><para>Consider a <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.<sbr/>
  1613. <sbr/>
  1614. <computeroutput>|1|2|3|4| | |</computeroutput><sbr/>
  1615. <computeroutput>p ___^</computeroutput><sbr/>
  1616. <sbr/>
  1617. After inserting 5 elements before the position <computeroutput>p</computeroutput>:<sbr/>
  1618. <sbr/>
  1619. <computeroutput>rinsert(p, (size_t)5, 0);</computeroutput><sbr/>
  1620. <sbr/>
  1621. actually only 4 elements get inserted and elements <computeroutput>3</computeroutput> and <computeroutput>4</computeroutput> are overwritten. This is due to the fact the rinsert operation preserves the capacity. After insertion the internal buffer looks like this:<sbr/>
  1622. <sbr/>
  1623. <computeroutput>|1|2|0|0|0|0|</computeroutput><sbr/>
  1624. <sbr/>
  1625. For comparison if the capacity would not be preserved the internal buffer would then result in <computeroutput>|1|2|0|0|0|0|0|3|4|</computeroutput>. </para>
  1626. </formalpara>
  1627. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rinsert(iterator, value_type)</computeroutput>, <computeroutput>rinsert(iterator, InputIterator, InputIterator)</computeroutput>, <computeroutput>insert(iterator, value_type)</computeroutput>, <computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  1628. </para>
  1629. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> or its end. </para>
  1630. </requires><postconditions><para>The number of <computeroutput>min[n, (end() - pos) + reserve()]</computeroutput> elements will be inserted before the position <computeroutput>pos</computeroutput>.<sbr/>
  1631. The number of <computeroutput>min[end() - pos, max[0, n - reserve()]]</computeroutput> elements will be overwritten at the end of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>.<sbr/>
  1632. (See <emphasis>Example</emphasis> for the explanation.)<sbr/>
  1633. <sbr/>
  1634. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1635. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws. </simpara></throws></method>
  1636. <method name="rinsert"><type>void</type><template>
  1637. <template-type-parameter name="InputIterator"/>
  1638. </template><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator specifying the position where the range will be inserted. </para></description></parameter><parameter name="first"><paramtype>InputIterator</paramtype><description><para>The beginning of the range to be inserted. </para></description></parameter><parameter name="last"><paramtype>InputIterator</paramtype><description><para>The end of the range to be inserted. </para></description></parameter><purpose>Insert the range <computeroutput>[first, last)</computeroutput> before the specified position. </purpose><description><para>
  1639. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1640. </formalpara>
  1641. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1642. </formalpara>
  1643. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>[size() + std::distance(first, last)]</computeroutput>; in <computeroutput>min[capacity().capacity(), size() + std::distance(first, last)]</computeroutput> if the <computeroutput>InputIterator</computeroutput> is a <ulink url="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</ulink>). </para>
  1644. </formalpara>
  1645. <formalpara><title>Example</title><para>Consider a <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> with the capacity of 6 and the size of 4. Its internal buffer may look like the one below.<sbr/>
  1646. <sbr/>
  1647. <computeroutput>|1|2|3|4| | |</computeroutput><sbr/>
  1648. <computeroutput>p ___^</computeroutput><sbr/>
  1649. <sbr/>
  1650. After inserting a range of elements before the position <computeroutput>p</computeroutput>:<sbr/>
  1651. <sbr/>
  1652. <computeroutput>int array[] = { 5, 6, 7, 8, 9 };</computeroutput><sbr/>
  1653. <computeroutput>insert(p, array, array + 5);</computeroutput><sbr/>
  1654. <sbr/>
  1655. actually only elements <computeroutput>5</computeroutput>, <computeroutput>6</computeroutput>, <computeroutput>7</computeroutput> and <computeroutput>8</computeroutput> from the specified range get inserted and elements <computeroutput>3</computeroutput> and <computeroutput>4</computeroutput> are overwritten. This is due to the fact the rinsert operation preserves the capacity. After insertion the internal buffer looks like this:<sbr/>
  1656. <sbr/>
  1657. <computeroutput>|1|2|5|6|7|8|</computeroutput><sbr/>
  1658. <sbr/>
  1659. For comparison if the capacity would not be preserved the internal buffer would then result in <computeroutput>|1|2|5|6|7|8|9|3|4|</computeroutput>. </para>
  1660. </formalpara>
  1661. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>rinsert(iterator, value_type)</computeroutput>, <computeroutput>rinsert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, value_type)</computeroutput>, <computeroutput>insert(iterator, size_type, value_type)</computeroutput>, <computeroutput>insert(iterator, InputIterator, InputIterator)</computeroutput> </para>
  1662. </para>
  1663. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> or its end.<sbr/>
  1664. Valid range <computeroutput>[first, last)</computeroutput> where <computeroutput>first</computeroutput> and <computeroutput>last</computeroutput> meet the requirements of an <ulink url="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</ulink>. </para>
  1665. </requires><postconditions><para>Elements from the range <computeroutput>[first, last - max[0, distance(first, last) - (end() - pos) - reserve()])</computeroutput> will be inserted before the position <computeroutput>pos</computeroutput>.<sbr/>
  1666. The number of <computeroutput>min[end() - pos, max[0, distance(first, last) - reserve()]]</computeroutput> elements will be overwritten at the end of the <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>.<sbr/>
  1667. (See <emphasis>Example</emphasis> for the explanation.)<sbr/>
  1668. <sbr/>
  1669. The amount of allocated memory in the internal buffer may be predictively increased. </para>
  1670. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws. </simpara></throws></method>
  1671. <method name="erase"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator pointing at the element to be removed. </para></description></parameter><purpose>Remove an element at the specified position. </purpose><description><para>
  1672. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1673. </formalpara>
  1674. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1675. </formalpara>
  1676. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1677. </formalpara>
  1678. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>erase(iterator, iterator)</computeroutput>, <computeroutput>rerase(iterator)</computeroutput>, <computeroutput>rerase(iterator, iterator)</computeroutput>, <computeroutput>clear()</computeroutput> </para>
  1679. </para>
  1680. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (but not an <computeroutput>end()</computeroutput>). </para>
  1681. </requires><postconditions><para>The element at the position <computeroutput>pos</computeroutput> is removed.<sbr/>
  1682. <sbr/>
  1683. The amount of allocated memory in the internal buffer may be predictively decreased. </para>
  1684. </postconditions><returns><para>Iterator to the first element remaining beyond the removed element or <computeroutput>end()</computeroutput> if no such element exists. </para>
  1685. </returns><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::operator = (T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  1686. <method name="erase"><type>iterator</type><parameter name="first"><paramtype>iterator</paramtype><description><para>The beginning of the range to be removed. </para></description></parameter><parameter name="last"><paramtype>iterator</paramtype><description><para>The end of the range to be removed. </para></description></parameter><purpose>Erase the range <computeroutput>[first, last)</computeroutput>. </purpose><description><para>
  1687. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1688. </formalpara>
  1689. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1690. </formalpara>
  1691. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1692. </formalpara>
  1693. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>erase(iterator)</computeroutput>, <computeroutput>rerase(iterator)</computeroutput>, <computeroutput>rerase(iterator, iterator)</computeroutput>, <computeroutput>clear()</computeroutput> </para>
  1694. </para>
  1695. </para></description><requires><para>Valid range <computeroutput>[first, last)</computeroutput>. </para>
  1696. </requires><postconditions><para>The elements from the range <computeroutput>[first, last)</computeroutput> are removed. (If <computeroutput>first == last</computeroutput> nothing is removed.)<sbr/>
  1697. <sbr/>
  1698. The amount of allocated memory in the internal buffer may be predictively decreased. </para>
  1699. </postconditions><returns><para>Iterator to the first element remaining beyond the removed elements or <computeroutput>end()</computeroutput> if no such element exists. </para>
  1700. </returns><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::operator = (T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  1701. <method name="rerase"><type>iterator</type><parameter name="pos"><paramtype>iterator</paramtype><description><para>An iterator pointing at the element to be removed. </para></description></parameter><purpose>Remove an element at the specified position. </purpose><description><para>
  1702. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1703. </formalpara>
  1704. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1705. </formalpara>
  1706. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1707. </formalpara>
  1708. <note><para>Basically there is no difference between <computeroutput>erase(iterator)</computeroutput> and this method. It is implemented only for consistency with the base <computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para>
  1709. </note>
  1710. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>erase(iterator)</computeroutput>, <computeroutput>erase(iterator, iterator)</computeroutput>, <computeroutput>rerase(iterator, iterator)</computeroutput>, <computeroutput>clear()</computeroutput> </para>
  1711. </para>
  1712. </para></description><requires><para><computeroutput>pos</computeroutput> is a valid iterator pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (but not an <computeroutput>end()</computeroutput>).<sbr/>
  1713. <sbr/>
  1714. The amount of allocated memory in the internal buffer may be predictively decreased. </para>
  1715. </requires><postconditions><para>The element at the position <computeroutput>pos</computeroutput> is removed. </para>
  1716. </postconditions><returns><para>Iterator to the first element remaining in front of the removed element or <computeroutput>begin()</computeroutput> if no such element exists. </para>
  1717. </returns><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::operator = (T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  1718. <method name="rerase"><type>iterator</type><parameter name="first"><paramtype>iterator</paramtype><description><para>The beginning of the range to be removed. </para></description></parameter><parameter name="last"><paramtype>iterator</paramtype><description><para>The end of the range to be removed. </para></description></parameter><purpose>Erase the range <computeroutput>[first, last)</computeroutput>. </purpose><description><para>
  1719. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1720. </formalpara>
  1721. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1722. </formalpara>
  1723. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1724. </formalpara>
  1725. <note><para>Basically there is no difference between <computeroutput>erase(iterator, iterator)</computeroutput> and this method. It is implemented only for consistency with the base <computeroutput>&lt;<classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput>. </para>
  1726. </note>
  1727. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>erase(iterator)</computeroutput>, <computeroutput>erase(iterator, iterator)</computeroutput>, <computeroutput>rerase(iterator)</computeroutput>, <computeroutput>clear()</computeroutput> </para>
  1728. </para>
  1729. </para></description><requires><para>Valid range <computeroutput>[first, last)</computeroutput>. </para>
  1730. </requires><postconditions><para>The elements from the range <computeroutput>[first, last)</computeroutput> are removed. (If <computeroutput>first == last</computeroutput> nothing is removed.)<sbr/>
  1731. <sbr/>
  1732. The amount of allocated memory in the internal buffer may be predictively decreased. </para>
  1733. </postconditions><returns><para>Iterator to the first element remaining in front of the removed elements or <computeroutput>begin()</computeroutput> if no such element exists. </para>
  1734. </returns><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::operator = (const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::operator = (T&amp;&amp;)</computeroutput> is noexcept. </simpara></throws></method>
  1735. <method name="clear"><type>void</type><purpose>Remove all stored elements from the space optimized circular buffer. </purpose><description><para>
  1736. <formalpara><title>Exception Safety</title><para>Basic. </para>
  1737. </formalpara>
  1738. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1739. </formalpara>
  1740. <formalpara><title>Complexity</title><para>Linear (in the size of the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>). </para>
  1741. </formalpara>
  1742. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>~circular_buffer_space_optimized()</computeroutput>, <computeroutput>erase(iterator)</computeroutput>, <computeroutput>erase(iterator, iterator)</computeroutput>, <computeroutput>rerase(iterator)</computeroutput>, <computeroutput>rerase(iterator, iterator)</computeroutput> </para>
  1743. </para>
  1744. </para></description><postconditions><para><computeroutput>size() == 0</computeroutput><sbr/>
  1745. <sbr/>
  1746. The amount of allocated memory in the internal buffer may be predictively decreased. </para>
  1747. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). </simpara></throws></method>
  1748. </method-group>
  1749. <constructor specifiers="explicit" cv="noexcept"><parameter name="alloc"><paramtype>const allocator_type &amp;</paramtype><default>allocator_type()</default><description><para>The allocator. </para></description></parameter><purpose>Create an empty space optimized circular buffer with zero capacity. </purpose><description><para>
  1750. <formalpara><title>Complexity</title><para>Constant. </para>
  1751. </formalpara>
  1752. <warning><para>Since Boost version 1.36 the behaviour of this constructor has changed. Now it creates a space optimized circular buffer with zero capacity. </para>
  1753. </warning>
  1754. </para></description><postconditions><para><computeroutput>capacity().capacity() == 0 &amp;&amp; capacity().min_capacity() == 0 &amp;&amp; size() == 0</computeroutput> </para>
  1755. </postconditions><throws><simpara><classname>Nothing.</classname> </simpara></throws></constructor>
  1756. <constructor specifiers="explicit"><parameter name="capacity_ctrl"><paramtype>capacity_type</paramtype><description><para>The capacity controller representing the maximum number of elements which can be stored in the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> and the minimal allocated size of the internal buffer. </para></description></parameter><parameter name="alloc"><paramtype>const allocator_type &amp;</paramtype><default>allocator_type()</default><description><para>The allocator. </para></description></parameter><purpose>Create an empty space optimized circular buffer with the specified capacity. </purpose><description><para>
  1757. <formalpara><title>Complexity</title><para>Constant. </para>
  1758. </formalpara>
  1759. </para></description><postconditions><para><computeroutput>capacity() == capacity_ctrl &amp;&amp; size() == 0</computeroutput><sbr/>
  1760. <sbr/>
  1761. The amount of allocated memory in the internal buffer is <computeroutput>capacity_ctrl.min_capacity()</computeroutput>. </para>
  1762. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). </simpara></throws></constructor>
  1763. <constructor><parameter name="capacity_ctrl"><paramtype>capacity_type</paramtype><description><para>The capacity controller representing the maximum number of elements which can be stored in the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> and the minimal allocated size of the internal buffer. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element the created <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be filled with. </para></description></parameter><parameter name="alloc"><paramtype>const allocator_type &amp;</paramtype><default>allocator_type()</default><description><para>The allocator. </para></description></parameter><purpose>Create a full space optimized circular buffer with the specified capacity filled with <computeroutput>capacity_ctrl.capacity()</computeroutput> copies of <computeroutput>item</computeroutput>. </purpose><description><para>
  1764. <formalpara><title>Complexity</title><para>Linear (in the <computeroutput>capacity_ctrl.capacity()</computeroutput>). </para>
  1765. </formalpara>
  1766. </para></description><postconditions><para><computeroutput>capacity() == capacity_ctrl &amp;&amp; full() &amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this) [capacity_ctrl.capacity() - 1] == item </computeroutput><sbr/>
  1767. <sbr/>
  1768. The amount of allocated memory in the internal buffer is <computeroutput>capacity_ctrl.capacity()</computeroutput>. </para>
  1769. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></constructor>
  1770. <constructor><parameter name="capacity_ctrl"><paramtype>capacity_type</paramtype><description><para>The capacity controller representing the maximum number of elements which can be stored in the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> and the minimal allocated size of the internal buffer. </para></description></parameter><parameter name="n"><paramtype>size_type</paramtype><description><para>The number of elements the created <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be filled with. </para></description></parameter><parameter name="item"><paramtype>param_value_type</paramtype><description><para>The element the created <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> will be filled with. </para></description></parameter><parameter name="alloc"><paramtype>const allocator_type &amp;</paramtype><default>allocator_type()</default><description><para>The allocator. </para></description></parameter><purpose>Create a space optimized circular buffer with the specified capacity filled with <computeroutput>n</computeroutput> copies of <computeroutput>item</computeroutput>. </purpose><description><para>
  1771. <formalpara><title>Complexity</title><para>Linear (in the <computeroutput>n</computeroutput>). </para>
  1772. </formalpara>
  1773. </para></description><requires><para><computeroutput>capacity_ctrl.capacity() &gt;= n</computeroutput> </para>
  1774. </requires><postconditions><para><computeroutput>capacity() == capacity_ctrl &amp;&amp; size() == n &amp;&amp; (*this)[0] == item &amp;&amp; (*this)[1] == item &amp;&amp; ... &amp;&amp; (*this)[n - 1] == item</computeroutput><sbr/>
  1775. <sbr/>
  1776. The amount of allocated memory in the internal buffer is <computeroutput>max[n, capacity_ctrl.min_capacity()]</computeroutput>. </para>
  1777. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></constructor>
  1778. <constructor><parameter name="cb"><paramtype>const <classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> to be copied. </para></description></parameter><purpose>The copy constructor. </purpose><description><para>Creates a copy of the specified <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>.
  1779. <formalpara><title>Complexity</title><para>Linear (in the size of <computeroutput>cb</computeroutput>). </para>
  1780. </formalpara>
  1781. </para></description><postconditions><para><computeroutput>*this == cb</computeroutput><sbr/>
  1782. <sbr/>
  1783. The amount of allocated memory in the internal buffer is <computeroutput>cb.size()</computeroutput>. </para>
  1784. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></constructor>
  1785. <constructor cv="noexcept"><parameter name="cb"><paramtype><classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;&amp;</paramtype><description><para><computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to 'steal' value from. </para></description></parameter><purpose>The move constructor. </purpose><description><para>Move constructs a <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> from <computeroutput>cb</computeroutput>, leaving <computeroutput>cb</computeroutput> empty.
  1786. <formalpara><title>Constant.</title><para/>
  1787. </formalpara>
  1788. </para></description><requires><para>C++ compiler with rvalue references support. </para>
  1789. </requires><postconditions><para><computeroutput>cb.empty()</computeroutput> </para>
  1790. </postconditions><throws><simpara><classname>Nothing.</classname> </simpara></throws></constructor>
  1791. <constructor><template>
  1792. <template-type-parameter name="InputIterator"/>
  1793. </template><parameter name="first"><paramtype>InputIterator</paramtype><description><para>The beginning of the range to be copied. </para></description></parameter><parameter name="last"><paramtype>InputIterator</paramtype><description><para>The end of the range to be copied. </para></description></parameter><parameter name="alloc"><paramtype>const allocator_type &amp;</paramtype><default>allocator_type()</default><description><para>The allocator. </para></description></parameter><purpose>Create a full space optimized circular buffer filled with a copy of the range. </purpose><description><para>
  1794. <formalpara><title>Complexity</title><para>Linear (in the <computeroutput>std::distance(first, last)</computeroutput>). </para>
  1795. </formalpara>
  1796. </para></description><requires><para>Valid range <computeroutput>[first, last)</computeroutput>.<sbr/>
  1797. <computeroutput>first</computeroutput> and <computeroutput>last</computeroutput> have to meet the requirements of <ulink url="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</ulink>. </para>
  1798. </requires><postconditions><para><computeroutput>capacity().capacity() == std::distance(first, last) &amp;&amp; capacity().min_capacity() == 0 &amp;&amp; full() &amp;&amp; (*this)[0]== *first &amp;&amp; (*this)[1] == *(first + 1) &amp;&amp; ... &amp;&amp; (*this)[std::distance(first, last) - 1] == *(last - 1)</computeroutput><sbr/>
  1799. <sbr/>
  1800. The amount of allocated memory in the internal buffer is <computeroutput>std::distance(first, last)</computeroutput>. </para>
  1801. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws or nothing if <computeroutput>T::T(T&amp;&amp;)</computeroutput> is noexcept and <computeroutput>InputIterator</computeroutput> is a move iterator. </simpara></throws></constructor>
  1802. <constructor><template>
  1803. <template-type-parameter name="InputIterator"/>
  1804. </template><parameter name="capacity_ctrl"><paramtype>capacity_type</paramtype><description><para>The capacity controller representing the maximum number of elements which can be stored in the <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> and the minimal allocated size of the internal buffer. </para></description></parameter><parameter name="first"><paramtype>InputIterator</paramtype><description><para>The beginning of the range to be copied. </para></description></parameter><parameter name="last"><paramtype>InputIterator</paramtype><description><para>The end of the range to be copied. </para></description></parameter><parameter name="alloc"><paramtype>const allocator_type &amp;</paramtype><default>allocator_type()</default><description><para>The allocator. </para></description></parameter><purpose>Create a space optimized circular buffer with the specified capacity (and the minimal guaranteed amount of allocated memory) filled with a copy of the range. </purpose><description><para>
  1805. <formalpara><title>Complexity</title><para>Linear (in <computeroutput>std::distance(first, last)</computeroutput>; in <computeroutput>min[capacity_ctrl.capacity(), std::distance(first, last)]</computeroutput> if the <computeroutput>InputIterator</computeroutput> is a <ulink url="https://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</ulink>). </para>
  1806. </formalpara>
  1807. </para></description><requires><para>Valid range <computeroutput>[first, last)</computeroutput>.<sbr/>
  1808. <computeroutput>first</computeroutput> and <computeroutput>last</computeroutput> have to meet the requirements of <ulink url="https://www.boost.org/sgi/stl/InputIterator.html">InputIterator</ulink>. </para>
  1809. </requires><postconditions><para><computeroutput>capacity() == capacity_ctrl &amp;&amp; size() &lt;= std::distance(first, last) &amp;&amp; (*this)[0]== (last - capacity_ctrl.capacity()) &amp;&amp; (*this)[1] == *(last - capacity_ctrl.capacity() + 1) &amp;&amp; ... &amp;&amp; (*this)[capacity_ctrl.capacity() - 1] == *(last - 1)</computeroutput><sbr/>
  1810. <sbr/>
  1811. If the number of items to be copied from the range <computeroutput>[first, last)</computeroutput> is greater than the specified <computeroutput>capacity_ctrl.capacity()</computeroutput> then only elements from the range <computeroutput>[last - capacity_ctrl.capacity(), last)</computeroutput> will be copied.<sbr/>
  1812. <sbr/>
  1813. The amount of allocated memory in the internal buffer is <computeroutput>max[capacity_ctrl.min_capacity(), min[capacity_ctrl.capacity(), std::distance(first, last)]]</computeroutput>. </para>
  1814. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). Whatever <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></constructor>
  1815. <copy-assignment><type><classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</type><parameter name="cb"><paramtype>const <classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype><description><para>The <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> to be copied. </para></description></parameter><purpose>The assign operator. </purpose><description><para>Makes this <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> to become a copy of the specified <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput>.
  1816. <formalpara><title>Exception Safety</title><para>Strong. </para>
  1817. </formalpara>
  1818. <formalpara><title>Iterator Invalidation</title><para>Invalidates all iterators pointing to this <computeroutput><classname alt="boost::circular_buffer_space_optimized">circular_buffer_space_optimized</classname></computeroutput> (except iterators equal to <computeroutput>end()</computeroutput>). </para>
  1819. </formalpara>
  1820. <formalpara><title>Complexity</title><para>Linear (in the size of <computeroutput>cb</computeroutput>). </para>
  1821. </formalpara>
  1822. <para><emphasis role="bold">See Also:</emphasis><para><computeroutput>assign(size_type, const_reference)</computeroutput>, <computeroutput>assign(capacity_type, size_type, const_reference)</computeroutput>, <computeroutput>assign(InputIterator, InputIterator)</computeroutput>, <computeroutput>assign(capacity_type, InputIterator, InputIterator)</computeroutput> </para>
  1823. </para>
  1824. </para></description><postconditions><para><computeroutput>*this == cb</computeroutput><sbr/>
  1825. <sbr/>
  1826. The amount of allocated memory in the internal buffer is <computeroutput>cb.size()</computeroutput>. </para>
  1827. </postconditions><throws><simpara><classname>An allocation error</classname> if memory is exhausted (<computeroutput>std::bad_alloc</computeroutput> if the standard allocator is used). <computeroutput>T::T(const T&amp;)</computeroutput> throws. </simpara></throws></copy-assignment>
  1828. <copy-assignment cv="noexcept"><type><classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</type><parameter name="cb"><paramtype><classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;&amp;</paramtype><description><para><computeroutput><classname alt="boost::circular_buffer">circular_buffer</classname></computeroutput> to 'steal' value from. </para></description></parameter><purpose>Move assigns content of <computeroutput>cb</computeroutput> to <computeroutput>*this</computeroutput>, leaving <computeroutput>cb</computeroutput> empty. </purpose><description><para>
  1829. <formalpara><title>Complexity</title><para>Constant. </para>
  1830. </formalpara>
  1831. </para></description><requires><para>C++ compiler with rvalue references support. </para>
  1832. </requires><postconditions><para><computeroutput>cb.empty()</computeroutput> </para>
  1833. </postconditions><throws><simpara><classname>Nothing.</classname> </simpara></throws></copy-assignment>
  1834. <method-group name="private static functions">
  1835. </method-group>
  1836. </class>
  1837. <function name="operator=="><type>bool</type><template>
  1838. <template-type-parameter name="T"/>
  1839. <template-type-parameter name="Alloc"/>
  1840. </template><parameter name="lhs"><paramtype>const <classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype></parameter><parameter name="rhs"><paramtype>const <classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype></parameter><purpose>Test two space optimized circular buffers for equality. </purpose></function>
  1841. <function name="operator&lt;"><type>bool</type><template>
  1842. <template-type-parameter name="T"/>
  1843. <template-type-parameter name="Alloc"/>
  1844. </template><parameter name="lhs"><paramtype>const <classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype></parameter><parameter name="rhs"><paramtype>const <classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype></parameter><purpose>Lexicographical comparison. </purpose></function>
  1845. <function name="operator!="><type>bool</type><template>
  1846. <template-type-parameter name="T"/>
  1847. <template-type-parameter name="Alloc"/>
  1848. </template><parameter name="lhs"><paramtype>const <classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype></parameter><parameter name="rhs"><paramtype>const <classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype></parameter><purpose>Test two space optimized circular buffers for non-equality. </purpose></function>
  1849. <function name="operator&gt;"><type>bool</type><template>
  1850. <template-type-parameter name="T"/>
  1851. <template-type-parameter name="Alloc"/>
  1852. </template><parameter name="lhs"><paramtype>const <classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype></parameter><parameter name="rhs"><paramtype>const <classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype></parameter><purpose>Lexicographical comparison. </purpose></function>
  1853. <function name="operator&lt;="><type>bool</type><template>
  1854. <template-type-parameter name="T"/>
  1855. <template-type-parameter name="Alloc"/>
  1856. </template><parameter name="lhs"><paramtype>const <classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype></parameter><parameter name="rhs"><paramtype>const <classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype></parameter><purpose>Lexicographical comparison. </purpose></function>
  1857. <function name="operator&gt;="><type>bool</type><template>
  1858. <template-type-parameter name="T"/>
  1859. <template-type-parameter name="Alloc"/>
  1860. </template><parameter name="lhs"><paramtype>const <classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype></parameter><parameter name="rhs"><paramtype>const <classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype></parameter><purpose>Lexicographical comparison. </purpose></function>
  1861. <function name="swap"><type>void</type><template>
  1862. <template-type-parameter name="T"/>
  1863. <template-type-parameter name="Alloc"/>
  1864. </template><parameter name="lhs"><paramtype><classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype></parameter><parameter name="rhs"><paramtype><classname>circular_buffer_space_optimized</classname>&lt; T, Alloc &gt; &amp;</paramtype></parameter><purpose>Swap the contents of two space optimized circular buffers. </purpose></function>
  1865. </namespace>
  1866. </header>
  1867. </library-reference>