Cider Isn't Darwin Emulation, Really
Something went wrong. Try again.
109 kB · 3357 lines
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358// -*- C++ -*-//===------------------------------ vector --------------------------------===////// The LLVM Compiler Infrastructure//// This file is dual licensed under the MIT and the University of Illinois Open// Source Licenses. See LICENSE.TXT for details.////===----------------------------------------------------------------------===//#ifndef _LIBCPP_VECTOR#define _LIBCPP_VECTOR/* vector synopsisnamespace std{template <class T, class Allocator = allocator<T> >class vector{public: typedef T value_type; typedef Allocator allocator_type; typedef typename allocator_type::reference reference; typedef typename allocator_type::const_reference const_reference; typedef implementation-defined iterator; typedef implementation-defined const_iterator; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::difference_type difference_type; typedef typename allocator_type::pointer pointer; typedef typename allocator_type::const_pointer const_pointer; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; vector() noexcept(is_nothrow_default_constructible<allocator_type>::value); explicit vector(const allocator_type&); explicit vector(size_type n); explicit vector(size_type n, const allocator_type&); // C++14 vector(size_type n, const value_type& value, const allocator_type& = allocator_type()); template <class InputIterator> vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type()); vector(const vector& x); vector(vector&& x) noexcept(is_nothrow_move_constructible<allocator_type>::value); vector(initializer_list<value_type> il); vector(initializer_list<value_type> il, const allocator_type& a); ~vector(); vector& operator=(const vector& x); vector& operator=(vector&& x) noexcept( allocator_type::propagate_on_container_move_assignment::value || allocator_type::is_always_equal::value); // C++17 vector& operator=(initializer_list<value_type> il); template <class InputIterator> void assign(InputIterator first, InputIterator last); void assign(size_type n, const value_type& u); void assign(initializer_list<value_type> il); allocator_type get_allocator() const noexcept; iterator begin() noexcept; const_iterator begin() const noexcept; iterator end() noexcept; const_iterator end() const noexcept; reverse_iterator rbegin() noexcept; const_reverse_iterator rbegin() const noexcept; reverse_iterator rend() noexcept; const_reverse_iterator rend() const noexcept; const_iterator cbegin() const noexcept; const_iterator cend() const noexcept; const_reverse_iterator crbegin() const noexcept; const_reverse_iterator crend() const noexcept; size_type size() const noexcept; size_type max_size() const noexcept; size_type capacity() const noexcept; bool empty() const noexcept; void reserve(size_type n); void shrink_to_fit() noexcept; reference operator[](size_type n); const_reference operator[](size_type n) const; reference at(size_type n); const_reference at(size_type n) const; reference front(); const_reference front() const; reference back(); const_reference back() const; value_type* data() noexcept; const value_type* data() const noexcept; void push_back(const value_type& x); void push_back(value_type&& x); template <class... Args> reference emplace_back(Args&&... args); // reference in C++17 void pop_back(); template <class... Args> iterator emplace(const_iterator position, Args&&... args); iterator insert(const_iterator position, const value_type& x); iterator insert(const_iterator position, value_type&& x); iterator insert(const_iterator position, size_type n, const value_type& x); template <class InputIterator> iterator insert(const_iterator position, InputIterator first, InputIterator last); iterator insert(const_iterator position, initializer_list<value_type> il); iterator erase(const_iterator position); iterator erase(const_iterator first, const_iterator last); void clear() noexcept; void resize(size_type sz); void resize(size_type sz, const value_type& c); void swap(vector&) noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value || allocator_traits<allocator_type>::is_always_equal::value); // C++17 bool __invariants() const;};template <class Allocator = allocator<T> >class vector<bool, Allocator>{public: typedef bool value_type; typedef Allocator allocator_type; typedef implementation-defined iterator; typedef implementation-defined const_iterator; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::difference_type difference_type; typedef iterator pointer; typedef const_iterator const_pointer; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; class reference { public: reference(const reference&) noexcept; operator bool() const noexcept; reference& operator=(const bool x) noexcept; reference& operator=(const reference& x) noexcept; iterator operator&() const noexcept; void flip() noexcept; }; class const_reference { public: const_reference(const reference&) noexcept; operator bool() const noexcept; const_iterator operator&() const noexcept; }; vector() noexcept(is_nothrow_default_constructible<allocator_type>::value); explicit vector(const allocator_type&); explicit vector(size_type n, const allocator_type& a = allocator_type()); // C++14 vector(size_type n, const value_type& value, const allocator_type& = allocator_type()); template <class InputIterator> vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type()); vector(const vector& x); vector(vector&& x) noexcept(is_nothrow_move_constructible<allocator_type>::value); vector(initializer_list<value_type> il); vector(initializer_list<value_type> il, const allocator_type& a); ~vector(); vector& operator=(const vector& x); vector& operator=(vector&& x) noexcept( allocator_type::propagate_on_container_move_assignment::value || allocator_type::is_always_equal::value); // C++17 vector& operator=(initializer_list<value_type> il); template <class InputIterator> void assign(InputIterator first, InputIterator last); void assign(size_type n, const value_type& u); void assign(initializer_list<value_type> il); allocator_type get_allocator() const noexcept; iterator begin() noexcept; const_iterator begin() const noexcept; iterator end() noexcept; const_iterator end() const noexcept; reverse_iterator rbegin() noexcept; const_reverse_iterator rbegin() const noexcept; reverse_iterator rend() noexcept; const_reverse_iterator rend() const noexcept; const_iterator cbegin() const noexcept; const_iterator cend() const noexcept; const_reverse_iterator crbegin() const noexcept; const_reverse_iterator crend() const noexcept; size_type size() const noexcept; size_type max_size() const noexcept; size_type capacity() const noexcept; bool empty() const noexcept; void reserve(size_type n); void shrink_to_fit() noexcept; reference operator[](size_type n); const_reference operator[](size_type n) const; reference at(size_type n); const_reference at(size_type n) const; reference front(); const_reference front() const; reference back(); const_reference back() const; void push_back(const value_type& x); template <class... Args> reference emplace_back(Args&&... args); // C++14; reference in C++17 void pop_back(); template <class... Args> iterator emplace(const_iterator position, Args&&... args); // C++14 iterator insert(const_iterator position, const value_type& x); iterator insert(const_iterator position, size_type n, const value_type& x); template <class InputIterator> iterator insert(const_iterator position, InputIterator first, InputIterator last); iterator insert(const_iterator position, initializer_list<value_type> il); iterator erase(const_iterator position); iterator erase(const_iterator first, const_iterator last); void clear() noexcept; void resize(size_type sz); void resize(size_type sz, value_type x); void swap(vector&) noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value || allocator_traits<allocator_type>::is_always_equal::value); // C++17 void flip() noexcept; bool __invariants() const;};template <class Allocator> struct hash<std::vector<bool, Allocator>>;template <class T, class Allocator> bool operator==(const vector<T,Allocator>& x, const vector<T,Allocator>& y);template <class T, class Allocator> bool operator< (const vector<T,Allocator>& x, const vector<T,Allocator>& y);template <class T, class Allocator> bool operator!=(const vector<T,Allocator>& x, const vector<T,Allocator>& y);template <class T, class Allocator> bool operator> (const vector<T,Allocator>& x, const vector<T,Allocator>& y);template <class T, class Allocator> bool operator>=(const vector<T,Allocator>& x, const vector<T,Allocator>& y);template <class T, class Allocator> bool operator<=(const vector<T,Allocator>& x, const vector<T,Allocator>& y);template <class T, class Allocator>void swap(vector<T,Allocator>& x, vector<T,Allocator>& y) noexcept(noexcept(x.swap(y)));} // std*/#include <__config>#include <iosfwd> // for forward declaration of vector#include <__bit_reference>#include <type_traits>#include <climits>#include <limits>#include <initializer_list>#include <memory>#include <stdexcept>#include <algorithm>#include <cstring>#include <__split_buffer>#include <__functional_base>#include <__debug>#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)#pragma GCC system_header#endif_LIBCPP_PUSH_MACROS#include <__undef_macros>_LIBCPP_BEGIN_NAMESPACE_STDtemplate <bool>class __vector_base_common{protected: _LIBCPP_ALWAYS_INLINE __vector_base_common() {} _LIBCPP_NORETURN void __throw_length_error() const; _LIBCPP_NORETURN void __throw_out_of_range() const;};template <bool __b>void__vector_base_common<__b>::__throw_length_error() const{ _VSTD::__throw_length_error("vector");}template <bool __b>void__vector_base_common<__b>::__throw_out_of_range() const{ _VSTD::__throw_out_of_range("vector");}_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __vector_base_common<true>)template <class _Tp, class _Allocator>class __vector_base : protected __vector_base_common<true>{protected: typedef _Tp value_type; typedef _Allocator allocator_type; typedef allocator_traits<allocator_type> __alloc_traits; typedef value_type& reference; typedef const value_type& const_reference; typedef typename __alloc_traits::size_type size_type; typedef typename __alloc_traits::difference_type difference_type; typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; typedef pointer iterator; typedef const_pointer const_iterator; pointer __begin_; pointer __end_; __compressed_pair<pointer, allocator_type> __end_cap_; _LIBCPP_INLINE_VISIBILITY allocator_type& __alloc() _NOEXCEPT {return __end_cap_.second();} _LIBCPP_INLINE_VISIBILITY const allocator_type& __alloc() const _NOEXCEPT {return __end_cap_.second();} _LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();} _LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();} _LIBCPP_INLINE_VISIBILITY __vector_base() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value); _LIBCPP_INLINE_VISIBILITY __vector_base(const allocator_type& __a); ~__vector_base(); _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT {__destruct_at_end(__begin_);} _LIBCPP_INLINE_VISIBILITY size_type capacity() const _NOEXCEPT {return static_cast<size_type>(__end_cap() - __begin_);} _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY void __copy_assign_alloc(const __vector_base& __c) {__copy_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_copy_assignment::value>());} _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__vector_base& __c) _NOEXCEPT_( !__alloc_traits::propagate_on_container_move_assignment::value || is_nothrow_move_assignable<allocator_type>::value) {__move_assign_alloc(__c, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>());}private: _LIBCPP_INLINE_VISIBILITY void __copy_assign_alloc(const __vector_base& __c, true_type) { if (__alloc() != __c.__alloc()) { clear(); __alloc_traits::deallocate(__alloc(), __begin_, capacity()); __begin_ = __end_ = __end_cap() = nullptr; } __alloc() = __c.__alloc(); } _LIBCPP_INLINE_VISIBILITY void __copy_assign_alloc(const __vector_base&, false_type) {} _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__vector_base& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) { __alloc() = _VSTD::move(__c.__alloc()); } _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__vector_base&, false_type) _NOEXCEPT {}};template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvoid__vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT{ pointer __soon_to_be_end = __end_; while (__new_last != __soon_to_be_end) __alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__soon_to_be_end)); __end_ = __new_last;}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITY__vector_base<_Tp, _Allocator>::__vector_base() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) : __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr){}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITY__vector_base<_Tp, _Allocator>::__vector_base(const allocator_type& __a) : __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a){}template <class _Tp, class _Allocator>__vector_base<_Tp, _Allocator>::~__vector_base(){ if (__begin_ != nullptr) { clear(); __alloc_traits::deallocate(__alloc(), __begin_, capacity()); }}template <class _Tp, class _Allocator /* = allocator<_Tp> */>class _LIBCPP_TEMPLATE_VIS vector : private __vector_base<_Tp, _Allocator>{private: typedef __vector_base<_Tp, _Allocator> __base; typedef allocator<_Tp> __default_allocator_type;public: typedef vector __self; typedef _Tp value_type; typedef _Allocator allocator_type; typedef typename __base::__alloc_traits __alloc_traits; typedef typename __base::reference reference; typedef typename __base::const_reference const_reference; typedef typename __base::size_type size_type; typedef typename __base::difference_type difference_type; typedef typename __base::pointer pointer; typedef typename __base::const_pointer const_pointer; typedef __wrap_iter<pointer> iterator; typedef __wrap_iter<const_pointer> const_iterator; typedef _VSTD::reverse_iterator<iterator> reverse_iterator; typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; static_assert((is_same<typename allocator_type::value_type, value_type>::value), "Allocator::value_type must be same type as value_type"); _LIBCPP_INLINE_VISIBILITY vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) {#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif } _LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a)#if _LIBCPP_STD_VER <= 14 _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)#else _NOEXCEPT#endif : __base(__a) {#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif } explicit vector(size_type __n);#if _LIBCPP_STD_VER > 11 explicit vector(size_type __n, const allocator_type& __a);#endif vector(size_type __n, const_reference __x); vector(size_type __n, const_reference __x, const allocator_type& __a); template <class _InputIterator> vector(_InputIterator __first, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< value_type, typename iterator_traits<_InputIterator>::reference>::value, _InputIterator>::type __last); template <class _InputIterator> vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< value_type, typename iterator_traits<_InputIterator>::reference>::value>::type* = 0); template <class _ForwardIterator> vector(_ForwardIterator __first, typename enable_if<__is_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value, _ForwardIterator>::type __last); template <class _ForwardIterator> vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, typename enable_if<__is_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);#if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_INLINE_VISIBILITY ~vector() { __get_db()->__erase_c(this); }#endif vector(const vector& __x); vector(const vector& __x, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(const vector& __x);#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY vector(initializer_list<value_type> __il); _LIBCPP_INLINE_VISIBILITY vector(initializer_list<value_type> __il, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY vector(vector&& __x)#if _LIBCPP_STD_VER > 14 _NOEXCEPT;#else _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);#endif _LIBCPP_INLINE_VISIBILITY vector(vector&& __x, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __x) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); _LIBCPP_INLINE_VISIBILITY vector& operator=(initializer_list<value_type> __il) {assign(__il.begin(), __il.end()); return *this;}#endif // !_LIBCPP_CXX03_LANG template <class _InputIterator> typename enable_if < __is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< value_type, typename iterator_traits<_InputIterator>::reference>::value, void >::type assign(_InputIterator __first, _InputIterator __last); template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value, void >::type assign(_ForwardIterator __first, _ForwardIterator __last); void assign(size_type __n, const_reference __u);#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}#endif _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT {return this->__alloc();} _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());} _LIBCPP_INLINE_VISIBILITY reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());} _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());} _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const _NOEXCEPT {return begin();} _LIBCPP_INLINE_VISIBILITY const_iterator cend() const _NOEXCEPT {return end();} _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const _NOEXCEPT {return rend();} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return static_cast<size_type>(this->__end_ - this->__begin_);} _LIBCPP_INLINE_VISIBILITY size_type capacity() const _NOEXCEPT {return __base::capacity();} _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return this->__begin_ == this->__end_;} size_type max_size() const _NOEXCEPT; void reserve(size_type __n); void shrink_to_fit() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n); _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const; reference at(size_type __n); const_reference at(size_type __n) const; _LIBCPP_INLINE_VISIBILITY reference front() { _LIBCPP_ASSERT(!empty(), "front() called for empty vector"); return *this->__begin_; } _LIBCPP_INLINE_VISIBILITY const_reference front() const { _LIBCPP_ASSERT(!empty(), "front() called for empty vector"); return *this->__begin_; } _LIBCPP_INLINE_VISIBILITY reference back() { _LIBCPP_ASSERT(!empty(), "back() called for empty vector"); return *(this->__end_ - 1); } _LIBCPP_INLINE_VISIBILITY const_reference back() const { _LIBCPP_ASSERT(!empty(), "back() called for empty vector"); return *(this->__end_ - 1); } _LIBCPP_INLINE_VISIBILITY value_type* data() _NOEXCEPT {return _VSTD::__to_raw_pointer(this->__begin_);} _LIBCPP_INLINE_VISIBILITY const value_type* data() const _NOEXCEPT {return _VSTD::__to_raw_pointer(this->__begin_);} _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x); template <class... _Args> _LIBCPP_INLINE_VISIBILITY#if _LIBCPP_STD_VER > 14 reference emplace_back(_Args&&... __args);#else void emplace_back(_Args&&... __args);#endif#endif // !_LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void pop_back(); iterator insert(const_iterator __position, const_reference __x);#ifndef _LIBCPP_CXX03_LANG iterator insert(const_iterator __position, value_type&& __x); template <class... _Args> iterator emplace(const_iterator __position, _Args&&... __args);#endif // !_LIBCPP_CXX03_LANG iterator insert(const_iterator __position, size_type __n, const_reference __x); template <class _InputIterator> typename enable_if < __is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< value_type, typename iterator_traits<_InputIterator>::reference>::value, iterator >::type insert(const_iterator __position, _InputIterator __first, _InputIterator __last); template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value, iterator >::type insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __position, initializer_list<value_type> __il) {return insert(__position, __il.begin(), __il.end());}#endif _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position); iterator erase(const_iterator __first, const_iterator __last); _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT { size_type __old_size = size(); __base::clear(); __annotate_shrink(__old_size); __invalidate_all_iterators(); } void resize(size_type __sz); void resize(size_type __sz, const_reference __x); void swap(vector&)#if _LIBCPP_STD_VER >= 14 _NOEXCEPT_DEBUG;#else _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);#endif bool __invariants() const;#if _LIBCPP_DEBUG_LEVEL >= 2 bool __dereferenceable(const const_iterator* __i) const; bool __decrementable(const const_iterator* __i) const; bool __addable(const const_iterator* __i, ptrdiff_t __n) const; bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;#endif // _LIBCPP_DEBUG_LEVEL >= 2private: _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators(); _LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(pointer __new_last); void allocate(size_type __n); void deallocate() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const; void __construct_at_end(size_type __n); _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, const_reference __x); template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, void >::type __construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n); void __append(size_type __n); void __append(size_type __n, const_reference __x); _LIBCPP_INLINE_VISIBILITY iterator __make_iter(pointer __p) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(const_pointer __p) const _NOEXCEPT; void __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v); pointer __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p); void __move_range(pointer __from_s, pointer __from_e, pointer __to); void __move_assign(vector& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value); void __move_assign(vector& __c, false_type) _NOEXCEPT_(__alloc_traits::is_always_equal::value); _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last) _NOEXCEPT { __invalidate_iterators_past(__new_last); size_type __old_size = size(); __base::__destruct_at_end(__new_last); __annotate_shrink(__old_size); }#ifndef _LIBCPP_CXX03_LANG template <class _Up> void __push_back_slow_path(_Up&& __x); template <class... _Args> void __emplace_back_slow_path(_Args&&... __args);#else template <class _Up> void __push_back_slow_path(_Up& __x);#endif // The following functions are no-ops outside of AddressSanitizer mode. // We call annotatations only for the default Allocator because other allocators // may not meet the AddressSanitizer alignment constraints. // See the documentation for __sanitizer_annotate_contiguous_container for more details.#ifndef _LIBCPP_HAS_NO_ASAN void __annotate_contiguous_container(const void *__beg, const void *__end, const void *__old_mid, const void *__new_mid) const { if (__beg && is_same<allocator_type, __default_allocator_type>::value) __sanitizer_annotate_contiguous_container(__beg, __end, __old_mid, __new_mid); }#else _LIBCPP_INLINE_VISIBILITY void __annotate_contiguous_container(const void*, const void*, const void*, const void*) const {}#endif _LIBCPP_INLINE_VISIBILITY void __annotate_new(size_type __current_size) const { __annotate_contiguous_container(data(), data() + capacity(), data() + capacity(), data() + __current_size); } _LIBCPP_INLINE_VISIBILITY void __annotate_delete() const { __annotate_contiguous_container(data(), data() + capacity(), data() + size(), data() + capacity()); } _LIBCPP_INLINE_VISIBILITY void __annotate_increase(size_type __n) const { __annotate_contiguous_container(data(), data() + capacity(), data() + size(), data() + size() + __n); } _LIBCPP_INLINE_VISIBILITY void __annotate_shrink(size_type __old_size) const { __annotate_contiguous_container(data(), data() + capacity(), data() + __old_size, data() + size()); }#ifndef _LIBCPP_HAS_NO_ASAN // The annotation for size increase should happen before the actual increase, // but if an exception is thrown after that the annotation has to be undone. struct __RAII_IncreaseAnnotator { __RAII_IncreaseAnnotator(const vector &__v, size_type __n = 1) : __commit(false), __v(__v), __old_size(__v.size() + __n) { __v.__annotate_increase(__n); } void __done() { __commit = true; } ~__RAII_IncreaseAnnotator() { if (__commit) return; __v.__annotate_shrink(__old_size); } bool __commit; const vector &__v; size_type __old_size; };#else struct __RAII_IncreaseAnnotator { _LIBCPP_INLINE_VISIBILITY __RAII_IncreaseAnnotator(const vector &, size_type = 1) {} _LIBCPP_INLINE_VISIBILITY void __done() {} };#endif};template <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v){ __annotate_delete(); __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, this->__end_, __v.__begin_); _VSTD::swap(this->__begin_, __v.__begin_); _VSTD::swap(this->__end_, __v.__end_); _VSTD::swap(this->__end_cap(), __v.__end_cap()); __v.__first_ = __v.__begin_; __annotate_new(size()); __invalidate_all_iterators();}template <class _Tp, class _Allocator>typename vector<_Tp, _Allocator>::pointervector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p){ __annotate_delete(); pointer __r = __v.__begin_; __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, __p, __v.__begin_); __alloc_traits::__construct_forward(this->__alloc(), __p, this->__end_, __v.__end_); _VSTD::swap(this->__begin_, __v.__begin_); _VSTD::swap(this->__end_, __v.__end_); _VSTD::swap(this->__end_cap(), __v.__end_cap()); __v.__first_ = __v.__begin_; __annotate_new(size()); __invalidate_all_iterators(); return __r;}// Allocate space for __n objects// throws length_error if __n > max_size()// throws (probably bad_alloc) if memory run out// Precondition: __begin_ == __end_ == __end_cap() == 0// Precondition: __n > 0// Postcondition: capacity() == __n// Postcondition: size() == 0template <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::allocate(size_type __n){ if (__n > max_size()) this->__throw_length_error(); this->__begin_ = this->__end_ = __alloc_traits::allocate(this->__alloc(), __n); this->__end_cap() = this->__begin_ + __n; __annotate_new(0);}template <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::deallocate() _NOEXCEPT{ if (this->__begin_ != nullptr) { clear(); __alloc_traits::deallocate(this->__alloc(), this->__begin_, capacity()); this->__begin_ = this->__end_ = this->__end_cap() = nullptr; }}template <class _Tp, class _Allocator>typename vector<_Tp, _Allocator>::size_typevector<_Tp, _Allocator>::max_size() const _NOEXCEPT{ return _VSTD::min<size_type>(__alloc_traits::max_size(this->__alloc()), numeric_limits<difference_type>::max());}// Precondition: __new_size > capacity()template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYtypename vector<_Tp, _Allocator>::size_typevector<_Tp, _Allocator>::__recommend(size_type __new_size) const{ const size_type __ms = max_size(); if (__new_size > __ms) this->__throw_length_error(); const size_type __cap = capacity(); if (__cap >= __ms / 2) return __ms; return _VSTD::max<size_type>(2*__cap, __new_size);}// Default constructs __n objects starting at __end_// throws if construction throws// Precondition: __n > 0// Precondition: size() + __n <= capacity()// Postcondition: size() == size() + __ntemplate <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::__construct_at_end(size_type __n){ allocator_type& __a = this->__alloc(); do { __RAII_IncreaseAnnotator __annotator(*this); __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_)); ++this->__end_; --__n; __annotator.__done(); } while (__n > 0);}// Copy constructs __n objects starting at __end_ from __x// throws if construction throws// Precondition: __n > 0// Precondition: size() + __n <= capacity()// Postcondition: size() == old size() + __n// Postcondition: [i] == __x for all i in [size() - __n, __n)template <class _Tp, class _Allocator>inlinevoidvector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x){ allocator_type& __a = this->__alloc(); do { __RAII_IncreaseAnnotator __annotator(*this); __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x); ++this->__end_; --__n; __annotator.__done(); } while (__n > 0);}template <class _Tp, class _Allocator>template <class _ForwardIterator>typename enable_if< __is_forward_iterator<_ForwardIterator>::value, void>::typevector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n){ allocator_type& __a = this->__alloc(); __RAII_IncreaseAnnotator __annotator(*this, __n); __alloc_traits::__construct_range_forward(__a, __first, __last, this->__end_); __annotator.__done();}// Default constructs __n objects starting at __end_// throws if construction throws// Postcondition: size() == size() + __n// Exception safety: strong.template <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::__append(size_type __n){ if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n) this->__construct_at_end(__n); else { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a); __v.__construct_at_end(__n); __swap_out_circular_buffer(__v); }}// Default constructs __n objects starting at __end_// throws if construction throws// Postcondition: size() == size() + __n// Exception safety: strong.template <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::__append(size_type __n, const_reference __x){ if (static_cast<size_type>(this->__end_cap() - this->__end_) >= __n) this->__construct_at_end(__n, __x); else { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), size(), __a); __v.__construct_at_end(__n, __x); __swap_out_circular_buffer(__v); }}template <class _Tp, class _Allocator>vector<_Tp, _Allocator>::vector(size_type __n){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif if (__n > 0) { allocate(__n); __construct_at_end(__n); }}#if _LIBCPP_STD_VER > 11template <class _Tp, class _Allocator>vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a) : __base(__a){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif if (__n > 0) { allocate(__n); __construct_at_end(__n); }}#endiftemplate <class _Tp, class _Allocator>vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif if (__n > 0) { allocate(__n); __construct_at_end(__n, __x); }}template <class _Tp, class _Allocator>vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x, const allocator_type& __a) : __base(__a){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif if (__n > 0) { allocate(__n); __construct_at_end(__n, __x); }}template <class _Tp, class _Allocator>template <class _InputIterator>vector<_Tp, _Allocator>::vector(_InputIterator __first, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< value_type, typename iterator_traits<_InputIterator>::reference>::value, _InputIterator>::type __last){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif for (; __first != __last; ++__first) push_back(*__first);}template <class _Tp, class _Allocator>template <class _InputIterator>vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< value_type, typename iterator_traits<_InputIterator>::reference>::value>::type*) : __base(__a){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif for (; __first != __last; ++__first) push_back(*__first);}template <class _Tp, class _Allocator>template <class _ForwardIterator>vector<_Tp, _Allocator>::vector(_ForwardIterator __first, typename enable_if<__is_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value, _ForwardIterator>::type __last){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); if (__n > 0) { allocate(__n); __construct_at_end(__first, __last, __n); }}template <class _Tp, class _Allocator>template <class _ForwardIterator>vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, typename enable_if<__is_forward_iterator<_ForwardIterator>::value && is_constructible< value_type, typename iterator_traits<_ForwardIterator>::reference>::value>::type*) : __base(__a){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); if (__n > 0) { allocate(__n); __construct_at_end(__first, __last, __n); }}template <class _Tp, class _Allocator>vector<_Tp, _Allocator>::vector(const vector& __x) : __base(__alloc_traits::select_on_container_copy_construction(__x.__alloc())){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif size_type __n = __x.size(); if (__n > 0) { allocate(__n); __construct_at_end(__x.__begin_, __x.__end_, __n); }}template <class _Tp, class _Allocator>vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a) : __base(__a){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif size_type __n = __x.size(); if (__n > 0) { allocate(__n); __construct_at_end(__x.__begin_, __x.__end_, __n); }}#ifndef _LIBCPP_CXX03_LANGtemplate <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvector<_Tp, _Allocator>::vector(vector&& __x)#if _LIBCPP_STD_VER > 14 _NOEXCEPT#else _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)#endif : __base(_VSTD::move(__x.__alloc())){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this); __get_db()->swap(this, &__x);#endif this->__begin_ = __x.__begin_; this->__end_ = __x.__end_; this->__end_cap() = __x.__end_cap(); __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a) : __base(__a){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif if (__a == __x.__alloc()) { this->__begin_ = __x.__begin_; this->__end_ = __x.__end_; this->__end_cap() = __x.__end_cap(); __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->swap(this, &__x);#endif } else { typedef move_iterator<iterator> _Ip; assign(_Ip(__x.begin()), _Ip(__x.end())); }}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvector<_Tp, _Allocator>::vector(initializer_list<value_type> __il){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif if (__il.size() > 0) { allocate(__il.size()); __construct_at_end(__il.begin(), __il.end(), __il.size()); }}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a) : __base(__a){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__insert_c(this);#endif if (__il.size() > 0) { allocate(__il.size()); __construct_at_end(__il.begin(), __il.end(), __il.size()); }}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvector<_Tp, _Allocator>&vector<_Tp, _Allocator>::operator=(vector&& __x) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)){ __move_assign(__x, integral_constant<bool, __alloc_traits::propagate_on_container_move_assignment::value>()); return *this;}template <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::__move_assign(vector& __c, false_type) _NOEXCEPT_(__alloc_traits::is_always_equal::value){ if (__base::__alloc() != __c.__alloc()) { typedef move_iterator<iterator> _Ip; assign(_Ip(__c.begin()), _Ip(__c.end())); } else __move_assign(__c, true_type());}template <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::__move_assign(vector& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value){ deallocate(); __base::__move_assign_alloc(__c); // this can throw this->__begin_ = __c.__begin_; this->__end_ = __c.__end_; this->__end_cap() = __c.__end_cap(); __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->swap(this, &__c);#endif}#endif // !_LIBCPP_CXX03_LANGtemplate <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvector<_Tp, _Allocator>&vector<_Tp, _Allocator>::operator=(const vector& __x){ if (this != &__x) { __base::__copy_assign_alloc(__x); assign(__x.__begin_, __x.__end_); } return *this;}template <class _Tp, class _Allocator>template <class _InputIterator>typename enable_if< __is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< _Tp, typename iterator_traits<_InputIterator>::reference>::value, void>::typevector<_Tp, _Allocator>::assign(_InputIterator __first, _InputIterator __last){ clear(); for (; __first != __last; ++__first) push_back(*__first);}template <class _Tp, class _Allocator>template <class _ForwardIterator>typename enable_if< __is_forward_iterator<_ForwardIterator>::value && is_constructible< _Tp, typename iterator_traits<_ForwardIterator>::reference>::value, void>::typevector<_Tp, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last){ size_type __new_size = static_cast<size_type>(_VSTD::distance(__first, __last)); if (__new_size <= capacity()) { _ForwardIterator __mid = __last; bool __growing = false; if (__new_size > size()) { __growing = true; __mid = __first; _VSTD::advance(__mid, size()); } pointer __m = _VSTD::copy(__first, __mid, this->__begin_); if (__growing) __construct_at_end(__mid, __last, __new_size - size()); else this->__destruct_at_end(__m); } else { deallocate(); allocate(__recommend(__new_size)); __construct_at_end(__first, __last, __new_size); } __invalidate_all_iterators();}template <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::assign(size_type __n, const_reference __u){ if (__n <= capacity()) { size_type __s = size(); _VSTD::fill_n(this->__begin_, _VSTD::min(__n, __s), __u); if (__n > __s) __construct_at_end(__n - __s, __u); else this->__destruct_at_end(this->__begin_ + __n); } else { deallocate(); allocate(__recommend(static_cast<size_type>(__n))); __construct_at_end(__n, __u); } __invalidate_all_iterators();}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYtypename vector<_Tp, _Allocator>::iteratorvector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT{#if _LIBCPP_DEBUG_LEVEL >= 2 return iterator(this, __p);#else return iterator(__p);#endif}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYtypename vector<_Tp, _Allocator>::const_iteratorvector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT{#if _LIBCPP_DEBUG_LEVEL >= 2 return const_iterator(this, __p);#else return const_iterator(__p);#endif}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYtypename vector<_Tp, _Allocator>::iteratorvector<_Tp, _Allocator>::begin() _NOEXCEPT{ return __make_iter(this->__begin_);}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYtypename vector<_Tp, _Allocator>::const_iteratorvector<_Tp, _Allocator>::begin() const _NOEXCEPT{ return __make_iter(this->__begin_);}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYtypename vector<_Tp, _Allocator>::iteratorvector<_Tp, _Allocator>::end() _NOEXCEPT{ return __make_iter(this->__end_);}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYtypename vector<_Tp, _Allocator>::const_iteratorvector<_Tp, _Allocator>::end() const _NOEXCEPT{ return __make_iter(this->__end_);}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYtypename vector<_Tp, _Allocator>::referencevector<_Tp, _Allocator>::operator[](size_type __n){ _LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds"); return this->__begin_[__n];}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYtypename vector<_Tp, _Allocator>::const_referencevector<_Tp, _Allocator>::operator[](size_type __n) const{ _LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds"); return this->__begin_[__n];}template <class _Tp, class _Allocator>typename vector<_Tp, _Allocator>::referencevector<_Tp, _Allocator>::at(size_type __n){ if (__n >= size()) this->__throw_out_of_range(); return this->__begin_[__n];}template <class _Tp, class _Allocator>typename vector<_Tp, _Allocator>::const_referencevector<_Tp, _Allocator>::at(size_type __n) const{ if (__n >= size()) this->__throw_out_of_range(); return this->__begin_[__n];}template <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::reserve(size_type __n){ if (__n > capacity()) { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__n, size(), __a); __swap_out_circular_buffer(__v); }}template <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT{ if (capacity() > size()) {#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif // _LIBCPP_NO_EXCEPTIONS allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(size(), size(), __a); __swap_out_circular_buffer(__v);#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { }#endif // _LIBCPP_NO_EXCEPTIONS }}template <class _Tp, class _Allocator>template <class _Up>void#ifndef _LIBCPP_CXX03_LANGvector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x)#elsevector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x)#endif{ allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a); // __v.push_back(_VSTD::forward<_Up>(__x)); __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_), _VSTD::forward<_Up>(__x)); __v.__end_++; __swap_out_circular_buffer(__v);}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvoidvector<_Tp, _Allocator>::push_back(const_reference __x){ if (this->__end_ != this->__end_cap()) { __RAII_IncreaseAnnotator __annotator(*this); __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(this->__end_), __x); __annotator.__done(); ++this->__end_; } else __push_back_slow_path(__x);}#ifndef _LIBCPP_CXX03_LANGtemplate <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvoidvector<_Tp, _Allocator>::push_back(value_type&& __x){ if (this->__end_ < this->__end_cap()) { __RAII_IncreaseAnnotator __annotator(*this); __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(this->__end_), _VSTD::move(__x)); __annotator.__done(); ++this->__end_; } else __push_back_slow_path(_VSTD::move(__x));}template <class _Tp, class _Allocator>template <class... _Args>voidvector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args){ allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);// __v.emplace_back(_VSTD::forward<_Args>(__args)...); __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_), _VSTD::forward<_Args>(__args)...); __v.__end_++; __swap_out_circular_buffer(__v);}template <class _Tp, class _Allocator>template <class... _Args>inline#if _LIBCPP_STD_VER > 14typename vector<_Tp, _Allocator>::reference#elsevoid#endifvector<_Tp, _Allocator>::emplace_back(_Args&&... __args){ if (this->__end_ < this->__end_cap()) { __RAII_IncreaseAnnotator __annotator(*this); __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(this->__end_), _VSTD::forward<_Args>(__args)...); __annotator.__done(); ++this->__end_; } else __emplace_back_slow_path(_VSTD::forward<_Args>(__args)...);#if _LIBCPP_STD_VER > 14 return this->back();#endif}#endif // !_LIBCPP_CXX03_LANGtemplate <class _Tp, class _Allocator>inlinevoidvector<_Tp, _Allocator>::pop_back(){ _LIBCPP_ASSERT(!empty(), "vector::pop_back called for empty vector"); this->__destruct_at_end(this->__end_ - 1);}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYtypename vector<_Tp, _Allocator>::iteratorvector<_Tp, _Allocator>::erase(const_iterator __position){#if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this, "vector::erase(iterator) called with an iterator not" " referring to this vector");#endif _LIBCPP_ASSERT(__position != end(), "vector::erase(iterator) called with a non-dereferenceable iterator"); difference_type __ps = __position - cbegin(); pointer __p = this->__begin_ + __ps; this->__destruct_at_end(_VSTD::move(__p + 1, this->__end_, __p)); this->__invalidate_iterators_past(__p-1); iterator __r = __make_iter(__p); return __r;}template <class _Tp, class _Allocator>typename vector<_Tp, _Allocator>::iteratorvector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last){#if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this, "vector::erase(iterator, iterator) called with an iterator not" " referring to this vector"); _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__last) == this, "vector::erase(iterator, iterator) called with an iterator not" " referring to this vector");#endif _LIBCPP_ASSERT(__first <= __last, "vector::erase(first, last) called with invalid range"); pointer __p = this->__begin_ + (__first - begin()); if (__first != __last) { this->__destruct_at_end(_VSTD::move(__p + (__last - __first), this->__end_, __p)); this->__invalidate_iterators_past(__p - 1); } iterator __r = __make_iter(__p); return __r;}template <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointer __to){ pointer __old_last = this->__end_; difference_type __n = __old_last - __to; for (pointer __i = __from_s + __n; __i < __from_e; ++__i, ++this->__end_) __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(this->__end_), _VSTD::move(*__i)); _VSTD::move_backward(__from_s, __from_s + __n, __old_last);}template <class _Tp, class _Allocator>typename vector<_Tp, _Allocator>::iteratorvector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x){#if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this, "vector::insert(iterator, x) called with an iterator not" " referring to this vector");#endif pointer __p = this->__begin_ + (__position - begin()); if (this->__end_ < this->__end_cap()) { __RAII_IncreaseAnnotator __annotator(*this); if (__p == this->__end_) { __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(this->__end_), __x); ++this->__end_; } else { __move_range(__p, this->__end_, __p + 1); const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x); if (__p <= __xr && __xr < this->__end_) ++__xr; *__p = *__xr; } __annotator.__done(); } else { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a); __v.push_back(__x); __p = __swap_out_circular_buffer(__v, __p); } return __make_iter(__p);}#ifndef _LIBCPP_CXX03_LANGtemplate <class _Tp, class _Allocator>typename vector<_Tp, _Allocator>::iteratorvector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x){#if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this, "vector::insert(iterator, x) called with an iterator not" " referring to this vector");#endif pointer __p = this->__begin_ + (__position - begin()); if (this->__end_ < this->__end_cap()) { __RAII_IncreaseAnnotator __annotator(*this); if (__p == this->__end_) { __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(this->__end_), _VSTD::move(__x)); ++this->__end_; } else { __move_range(__p, this->__end_, __p + 1); *__p = _VSTD::move(__x); } __annotator.__done(); } else { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a); __v.push_back(_VSTD::move(__x)); __p = __swap_out_circular_buffer(__v, __p); } return __make_iter(__p);}template <class _Tp, class _Allocator>template <class... _Args>typename vector<_Tp, _Allocator>::iteratorvector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args){#if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this, "vector::emplace(iterator, x) called with an iterator not" " referring to this vector");#endif pointer __p = this->__begin_ + (__position - begin()); if (this->__end_ < this->__end_cap()) { __RAII_IncreaseAnnotator __annotator(*this); if (__p == this->__end_) { __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(this->__end_), _VSTD::forward<_Args>(__args)...); ++this->__end_; } else { __temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...); __move_range(__p, this->__end_, __p + 1); *__p = _VSTD::move(__tmp.get()); } __annotator.__done(); } else { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), __p - this->__begin_, __a); __v.emplace_back(_VSTD::forward<_Args>(__args)...); __p = __swap_out_circular_buffer(__v, __p); } return __make_iter(__p);}#endif // !_LIBCPP_CXX03_LANGtemplate <class _Tp, class _Allocator>typename vector<_Tp, _Allocator>::iteratorvector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x){#if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this, "vector::insert(iterator, n, x) called with an iterator not" " referring to this vector");#endif pointer __p = this->__begin_ + (__position - begin()); if (__n > 0) { if (__n <= static_cast<size_type>(this->__end_cap() - this->__end_)) { size_type __old_n = __n; pointer __old_last = this->__end_; if (__n > static_cast<size_type>(this->__end_ - __p)) { size_type __cx = __n - (this->__end_ - __p); __construct_at_end(__cx, __x); __n -= __cx; } if (__n > 0) { __RAII_IncreaseAnnotator __annotator(*this, __n); __move_range(__p, __old_last, __p + __old_n); __annotator.__done(); const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x); if (__p <= __xr && __xr < this->__end_) __xr += __old_n; _VSTD::fill_n(__p, __n, *__xr); } } else { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, __a); __v.__construct_at_end(__n, __x); __p = __swap_out_circular_buffer(__v, __p); } } return __make_iter(__p);}template <class _Tp, class _Allocator>template <class _InputIterator>typename enable_if< __is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value && is_constructible< _Tp, typename iterator_traits<_InputIterator>::reference>::value, typename vector<_Tp, _Allocator>::iterator>::typevector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last){#if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this, "vector::insert(iterator, range) called with an iterator not" " referring to this vector");#endif difference_type __off = __position - begin(); pointer __p = this->__begin_ + __off; allocator_type& __a = this->__alloc(); pointer __old_last = this->__end_; for (; this->__end_ != this->__end_cap() && __first != __last; ++__first) { __RAII_IncreaseAnnotator __annotator(*this); __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first); ++this->__end_; __annotator.__done(); } __split_buffer<value_type, allocator_type&> __v(__a); if (__first != __last) {#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif // _LIBCPP_NO_EXCEPTIONS __v.__construct_at_end(__first, __last); difference_type __old_size = __old_last - this->__begin_; difference_type __old_p = __p - this->__begin_; reserve(__recommend(size() + __v.size())); __p = this->__begin_ + __old_p; __old_last = this->__begin_ + __old_size;#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { erase(__make_iter(__old_last), end()); throw; }#endif // _LIBCPP_NO_EXCEPTIONS } __p = _VSTD::rotate(__p, __old_last, this->__end_); insert(__make_iter(__p), make_move_iterator(__v.begin()), make_move_iterator(__v.end())); return begin() + __off;}template <class _Tp, class _Allocator>template <class _ForwardIterator>typename enable_if< __is_forward_iterator<_ForwardIterator>::value && is_constructible< _Tp, typename iterator_traits<_ForwardIterator>::reference>::value, typename vector<_Tp, _Allocator>::iterator>::typevector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last){#if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this, "vector::insert(iterator, range) called with an iterator not" " referring to this vector");#endif pointer __p = this->__begin_ + (__position - begin()); difference_type __n = _VSTD::distance(__first, __last); if (__n > 0) { if (__n <= this->__end_cap() - this->__end_) { size_type __old_n = __n; pointer __old_last = this->__end_; _ForwardIterator __m = __last; difference_type __dx = this->__end_ - __p; if (__n > __dx) { __m = __first; difference_type __diff = this->__end_ - __p; _VSTD::advance(__m, __diff); __construct_at_end(__m, __last, __n - __diff); __n = __dx; } if (__n > 0) { __RAII_IncreaseAnnotator __annotator(*this, __n); __move_range(__p, __old_last, __p + __old_n); __annotator.__done(); _VSTD::copy(__first, __m, __p); } } else { allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(__recommend(size() + __n), __p - this->__begin_, __a); __v.__construct_at_end(__first, __last); __p = __swap_out_circular_buffer(__v, __p); } } return __make_iter(__p);}template <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::resize(size_type __sz){ size_type __cs = size(); if (__cs < __sz) this->__append(__sz - __cs); else if (__cs > __sz) this->__destruct_at_end(this->__begin_ + __sz);}template <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::resize(size_type __sz, const_reference __x){ size_type __cs = size(); if (__cs < __sz) this->__append(__sz - __cs, __x); else if (__cs > __sz) this->__destruct_at_end(this->__begin_ + __sz);}template <class _Tp, class _Allocator>voidvector<_Tp, _Allocator>::swap(vector& __x)#if _LIBCPP_STD_VER >= 14 _NOEXCEPT_DEBUG#else _NOEXCEPT_DEBUG_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)#endif{ _LIBCPP_ASSERT(__alloc_traits::propagate_on_container_swap::value || this->__alloc() == __x.__alloc(), "vector::swap: Either propagate_on_container_swap must be true" " or the allocators must compare equal"); _VSTD::swap(this->__begin_, __x.__begin_); _VSTD::swap(this->__end_, __x.__end_); _VSTD::swap(this->__end_cap(), __x.__end_cap()); __swap_allocator(this->__alloc(), __x.__alloc(), integral_constant<bool,__alloc_traits::propagate_on_container_swap::value>());#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->swap(this, &__x);#endif // _LIBCPP_DEBUG_LEVEL >= 2}template <class _Tp, class _Allocator>boolvector<_Tp, _Allocator>::__invariants() const{ if (this->__begin_ == nullptr) { if (this->__end_ != nullptr || this->__end_cap() != nullptr) return false; } else { if (this->__begin_ > this->__end_) return false; if (this->__begin_ == this->__end_cap()) return false; if (this->__end_ > this->__end_cap()) return false; } return true;}#if _LIBCPP_DEBUG_LEVEL >= 2template <class _Tp, class _Allocator>boolvector<_Tp, _Allocator>::__dereferenceable(const const_iterator* __i) const{ return this->__begin_ <= __i->base() && __i->base() < this->__end_;}template <class _Tp, class _Allocator>boolvector<_Tp, _Allocator>::__decrementable(const const_iterator* __i) const{ return this->__begin_ < __i->base() && __i->base() <= this->__end_;}template <class _Tp, class _Allocator>boolvector<_Tp, _Allocator>::__addable(const const_iterator* __i, ptrdiff_t __n) const{ const_pointer __p = __i->base() + __n; return this->__begin_ <= __p && __p <= this->__end_;}template <class _Tp, class _Allocator>boolvector<_Tp, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __n) const{ const_pointer __p = __i->base() + __n; return this->__begin_ <= __p && __p < this->__end_;}#endif // _LIBCPP_DEBUG_LEVEL >= 2template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvoidvector<_Tp, _Allocator>::__invalidate_all_iterators(){#if _LIBCPP_DEBUG_LEVEL >= 2 __get_db()->__invalidate_all(this);#endif // _LIBCPP_DEBUG_LEVEL >= 2}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvoidvector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) {#if _LIBCPP_DEBUG_LEVEL >= 2 __c_node* __c = __get_db()->__find_c_and_lock(this); for (__i_node** __p = __c->end_; __p != __c->beg_; ) { --__p; const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_); if (__i->base() > __new_last) { (*__p)->__c_ = nullptr; if (--__c->end_ != __p) memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*)); } } __get_db()->unlock();#else ((void)__new_last);#endif}// vector<bool>template <class _Allocator> class vector<bool, _Allocator>;template <class _Allocator> struct hash<vector<bool, _Allocator> >;template <class _Allocator>struct __has_storage_type<vector<bool, _Allocator> >{ static const bool value = true;};template <class _Allocator>class _LIBCPP_TEMPLATE_VIS vector<bool, _Allocator> : private __vector_base_common<true>{public: typedef vector __self; typedef bool value_type; typedef _Allocator allocator_type; typedef allocator_traits<allocator_type> __alloc_traits; typedef typename __alloc_traits::size_type size_type; typedef typename __alloc_traits::difference_type difference_type; typedef size_type __storage_type; typedef __bit_iterator<vector, false> pointer; typedef __bit_iterator<vector, true> const_pointer; typedef pointer iterator; typedef const_pointer const_iterator; typedef _VSTD::reverse_iterator<iterator> reverse_iterator; typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;private: typedef typename __rebind_alloc_helper<__alloc_traits, __storage_type>::type __storage_allocator; typedef allocator_traits<__storage_allocator> __storage_traits; typedef typename __storage_traits::pointer __storage_pointer; typedef typename __storage_traits::const_pointer __const_storage_pointer; __storage_pointer __begin_; size_type __size_; __compressed_pair<size_type, __storage_allocator> __cap_alloc_;public: typedef __bit_reference<vector> reference; typedef __bit_const_reference<vector> const_reference;private: _LIBCPP_INLINE_VISIBILITY size_type& __cap() _NOEXCEPT {return __cap_alloc_.first();} _LIBCPP_INLINE_VISIBILITY const size_type& __cap() const _NOEXCEPT {return __cap_alloc_.first();} _LIBCPP_INLINE_VISIBILITY __storage_allocator& __alloc() _NOEXCEPT {return __cap_alloc_.second();} _LIBCPP_INLINE_VISIBILITY const __storage_allocator& __alloc() const _NOEXCEPT {return __cap_alloc_.second();} static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); _LIBCPP_INLINE_VISIBILITY static size_type __internal_cap_to_external(size_type __n) _NOEXCEPT {return __n * __bits_per_word;} _LIBCPP_INLINE_VISIBILITY static size_type __external_cap_to_internal(size_type __n) _NOEXCEPT {return (__n - 1) / __bits_per_word + 1;}public: _LIBCPP_INLINE_VISIBILITY vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value); _LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a)#if _LIBCPP_STD_VER <= 14 _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value);#else _NOEXCEPT;#endif ~vector(); explicit vector(size_type __n);#if _LIBCPP_STD_VER > 11 explicit vector(size_type __n, const allocator_type& __a);#endif vector(size_type __n, const value_type& __v); vector(size_type __n, const value_type& __v, const allocator_type& __a); template <class _InputIterator> vector(_InputIterator __first, _InputIterator __last, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value>::type* = 0); template <class _InputIterator> vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value>::type* = 0); template <class _ForwardIterator> vector(_ForwardIterator __first, _ForwardIterator __last, typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0); template <class _ForwardIterator> vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0); vector(const vector& __v); vector(const vector& __v, const allocator_type& __a); vector& operator=(const vector& __v);#ifndef _LIBCPP_CXX03_LANG vector(initializer_list<value_type> __il); vector(initializer_list<value_type> __il, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY vector(vector&& __v)#if _LIBCPP_STD_VER > 14 _NOEXCEPT;#else _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);#endif vector(vector&& __v, const allocator_type& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __v) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); _LIBCPP_INLINE_VISIBILITY vector& operator=(initializer_list<value_type> __il) {assign(__il.begin(), __il.end()); return *this;}#endif // !_LIBCPP_CXX03_LANG template <class _InputIterator> typename enable_if < __is_input_iterator<_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value, void >::type assign(_InputIterator __first, _InputIterator __last); template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, void >::type assign(_ForwardIterator __first, _ForwardIterator __last); void assign(size_type __n, const value_type& __x);#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}#endif _LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT {return allocator_type(this->__alloc());} size_type max_size() const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_type capacity() const _NOEXCEPT {return __internal_cap_to_external(__cap());} _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT {return __size_;} _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return __size_ == 0;} void reserve(size_type __n); void shrink_to_fit() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __make_iter(0);} _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __make_iter(0);} _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT {return __make_iter(__size_);} _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT {return __make_iter(__size_);} _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());} _LIBCPP_INLINE_VISIBILITY reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());} _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());} _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const _NOEXCEPT {return __make_iter(0);} _LIBCPP_INLINE_VISIBILITY const_iterator cend() const _NOEXCEPT {return __make_iter(__size_);} _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const _NOEXCEPT {return rend();} _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __make_ref(__n);} _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const {return __make_ref(__n);} reference at(size_type __n); const_reference at(size_type __n) const; _LIBCPP_INLINE_VISIBILITY reference front() {return __make_ref(0);} _LIBCPP_INLINE_VISIBILITY const_reference front() const {return __make_ref(0);} _LIBCPP_INLINE_VISIBILITY reference back() {return __make_ref(__size_ - 1);} _LIBCPP_INLINE_VISIBILITY const_reference back() const {return __make_ref(__size_ - 1);} void push_back(const value_type& __x);#if _LIBCPP_STD_VER > 11 template <class... _Args>#if _LIBCPP_STD_VER > 14 _LIBCPP_INLINE_VISIBILITY reference emplace_back(_Args&&... __args)#else _LIBCPP_INLINE_VISIBILITY void emplace_back(_Args&&... __args)#endif { push_back ( value_type ( _VSTD::forward<_Args>(__args)... ));#if _LIBCPP_STD_VER > 14 return this->back();#endif }#endif _LIBCPP_INLINE_VISIBILITY void pop_back() {--__size_;}#if _LIBCPP_STD_VER > 11 template <class... _Args> _LIBCPP_INLINE_VISIBILITY iterator emplace(const_iterator position, _Args&&... __args) { return insert ( position, value_type ( _VSTD::forward<_Args>(__args)... )); }#endif iterator insert(const_iterator __position, const value_type& __x); iterator insert(const_iterator __position, size_type __n, const value_type& __x); iterator insert(const_iterator __position, size_type __n, const_reference __x); template <class _InputIterator> typename enable_if < __is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value, iterator >::type insert(const_iterator __position, _InputIterator __first, _InputIterator __last); template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, iterator >::type insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __position, initializer_list<value_type> __il) {return insert(__position, __il.begin(), __il.end());}#endif _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position); iterator erase(const_iterator __first, const_iterator __last); _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT {__size_ = 0;} void swap(vector&)#if _LIBCPP_STD_VER >= 14 _NOEXCEPT;#else _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value);#endif static void swap(reference __x, reference __y) _NOEXCEPT { _VSTD::swap(__x, __y); } void resize(size_type __sz, value_type __x = false); void flip() _NOEXCEPT; bool __invariants() const;private: _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators(); void allocate(size_type __n); void deallocate() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY static size_type __align_it(size_type __new_size) _NOEXCEPT {return __new_size + (__bits_per_word-1) & ~((size_type)__bits_per_word-1);}; _LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const; _LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, bool __x); template <class _ForwardIterator> typename enable_if < __is_forward_iterator<_ForwardIterator>::value, void >::type __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); void __append(size_type __n, const_reference __x); _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_type __pos) _NOEXCEPT {return reference(__begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} _LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_type __pos) const _NOEXCEPT {return const_reference(__begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_type __pos) _NOEXCEPT {return iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));} _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_type __pos) const _NOEXCEPT {return const_iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));} _LIBCPP_INLINE_VISIBILITY iterator __const_iterator_cast(const_iterator __p) _NOEXCEPT {return begin() + (__p - cbegin());} _LIBCPP_INLINE_VISIBILITY void __copy_assign_alloc(const vector& __v) {__copy_assign_alloc(__v, integral_constant<bool, __storage_traits::propagate_on_container_copy_assignment::value>());} _LIBCPP_INLINE_VISIBILITY void __copy_assign_alloc(const vector& __c, true_type) { if (__alloc() != __c.__alloc()) deallocate(); __alloc() = __c.__alloc(); } _LIBCPP_INLINE_VISIBILITY void __copy_assign_alloc(const vector&, false_type) {} void __move_assign(vector& __c, false_type); void __move_assign(vector& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value); _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(vector& __c) _NOEXCEPT_( !__storage_traits::propagate_on_container_move_assignment::value || is_nothrow_move_assignable<allocator_type>::value) {__move_assign_alloc(__c, integral_constant<bool, __storage_traits::propagate_on_container_move_assignment::value>());} _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(vector& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) { __alloc() = _VSTD::move(__c.__alloc()); } _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(vector&, false_type) _NOEXCEPT {} size_t __hash_code() const _NOEXCEPT; friend class __bit_reference<vector>; friend class __bit_const_reference<vector>; friend class __bit_iterator<vector, false>; friend class __bit_iterator<vector, true>; friend struct __bit_array<vector>; friend struct _LIBCPP_TEMPLATE_VIS hash<vector>;};template <class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvoidvector<bool, _Allocator>::__invalidate_all_iterators(){}// Allocate space for __n objects// throws length_error if __n > max_size()// throws (probably bad_alloc) if memory run out// Precondition: __begin_ == __end_ == __cap() == 0// Precondition: __n > 0// Postcondition: capacity() == __n// Postcondition: size() == 0template <class _Allocator>voidvector<bool, _Allocator>::allocate(size_type __n){ if (__n > max_size()) this->__throw_length_error(); __n = __external_cap_to_internal(__n); this->__begin_ = __storage_traits::allocate(this->__alloc(), __n); this->__size_ = 0; this->__cap() = __n;}template <class _Allocator>voidvector<bool, _Allocator>::deallocate() _NOEXCEPT{ if (this->__begin_ != nullptr) { __storage_traits::deallocate(this->__alloc(), this->__begin_, __cap()); __invalidate_all_iterators(); this->__begin_ = nullptr; this->__size_ = this->__cap() = 0; }}template <class _Allocator>typename vector<bool, _Allocator>::size_typevector<bool, _Allocator>::max_size() const _NOEXCEPT{ size_type __amax = __storage_traits::max_size(__alloc()); size_type __nmax = numeric_limits<size_type>::max() / 2; // end() >= begin(), always if (__nmax / __bits_per_word <= __amax) return __nmax; return __internal_cap_to_external(__amax);}// Precondition: __new_size > capacity()template <class _Allocator>inline _LIBCPP_INLINE_VISIBILITYtypename vector<bool, _Allocator>::size_typevector<bool, _Allocator>::__recommend(size_type __new_size) const{ const size_type __ms = max_size(); if (__new_size > __ms) this->__throw_length_error(); const size_type __cap = capacity(); if (__cap >= __ms / 2) return __ms; return _VSTD::max(2*__cap, __align_it(__new_size));}// Default constructs __n objects starting at __end_// Precondition: __n > 0// Precondition: size() + __n <= capacity()// Postcondition: size() == size() + __ntemplate <class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvoidvector<bool, _Allocator>::__construct_at_end(size_type __n, bool __x){ size_type __old_size = this->__size_; this->__size_ += __n; _VSTD::fill_n(__make_iter(__old_size), __n, __x);}template <class _Allocator>template <class _ForwardIterator>typename enable_if< __is_forward_iterator<_ForwardIterator>::value, void>::typevector<bool, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last){ size_type __old_size = this->__size_; this->__size_ += _VSTD::distance(__first, __last); _VSTD::copy(__first, __last, __make_iter(__old_size));}template <class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvector<bool, _Allocator>::vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) : __begin_(nullptr), __size_(0), __cap_alloc_(0){}template <class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvector<bool, _Allocator>::vector(const allocator_type& __a)#if _LIBCPP_STD_VER <= 14 _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)#else _NOEXCEPT#endif : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)){}template <class _Allocator>vector<bool, _Allocator>::vector(size_type __n) : __begin_(nullptr), __size_(0), __cap_alloc_(0){ if (__n > 0) { allocate(__n); __construct_at_end(__n, false); }}#if _LIBCPP_STD_VER > 11template <class _Allocator>vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a) : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)){ if (__n > 0) { allocate(__n); __construct_at_end(__n, false); }}#endiftemplate <class _Allocator>vector<bool, _Allocator>::vector(size_type __n, const value_type& __x) : __begin_(nullptr), __size_(0), __cap_alloc_(0){ if (__n > 0) { allocate(__n); __construct_at_end(__n, __x); }}template <class _Allocator>vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a) : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)){ if (__n > 0) { allocate(__n); __construct_at_end(__n, __x); }}template <class _Allocator>template <class _InputIterator>vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value>::type*) : __begin_(nullptr), __size_(0), __cap_alloc_(0){#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif // _LIBCPP_NO_EXCEPTIONS for (; __first != __last; ++__first) push_back(*__first);#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { if (__begin_ != nullptr) __storage_traits::deallocate(__alloc(), __begin_, __cap()); __invalidate_all_iterators(); throw; }#endif // _LIBCPP_NO_EXCEPTIONS}template <class _Allocator>template <class _InputIterator>vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a, typename enable_if<__is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value>::type*) : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)){#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif // _LIBCPP_NO_EXCEPTIONS for (; __first != __last; ++__first) push_back(*__first);#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { if (__begin_ != nullptr) __storage_traits::deallocate(__alloc(), __begin_, __cap()); __invalidate_all_iterators(); throw; }#endif // _LIBCPP_NO_EXCEPTIONS}template <class _Allocator>template <class _ForwardIterator>vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*) : __begin_(nullptr), __size_(0), __cap_alloc_(0){ size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); if (__n > 0) { allocate(__n); __construct_at_end(__first, __last); }}template <class _Allocator>template <class _ForwardIterator>vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a, typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*) : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)){ size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last)); if (__n > 0) { allocate(__n); __construct_at_end(__first, __last); }}#ifndef _LIBCPP_CXX03_LANGtemplate <class _Allocator>vector<bool, _Allocator>::vector(initializer_list<value_type> __il) : __begin_(nullptr), __size_(0), __cap_alloc_(0){ size_type __n = static_cast<size_type>(__il.size()); if (__n > 0) { allocate(__n); __construct_at_end(__il.begin(), __il.end()); }}template <class _Allocator>vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a) : __begin_(nullptr), __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)){ size_type __n = static_cast<size_type>(__il.size()); if (__n > 0) { allocate(__n); __construct_at_end(__il.begin(), __il.end()); }}#endif // _LIBCPP_CXX03_LANGtemplate <class _Allocator>vector<bool, _Allocator>::~vector(){ if (__begin_ != nullptr) __storage_traits::deallocate(__alloc(), __begin_, __cap()); __invalidate_all_iterators();}template <class _Allocator>vector<bool, _Allocator>::vector(const vector& __v) : __begin_(nullptr), __size_(0), __cap_alloc_(0, __storage_traits::select_on_container_copy_construction(__v.__alloc())){ if (__v.size() > 0) { allocate(__v.size()); __construct_at_end(__v.begin(), __v.end()); }}template <class _Allocator>vector<bool, _Allocator>::vector(const vector& __v, const allocator_type& __a) : __begin_(nullptr), __size_(0), __cap_alloc_(0, __a){ if (__v.size() > 0) { allocate(__v.size()); __construct_at_end(__v.begin(), __v.end()); }}template <class _Allocator>vector<bool, _Allocator>&vector<bool, _Allocator>::operator=(const vector& __v){ if (this != &__v) { __copy_assign_alloc(__v); if (__v.__size_) { if (__v.__size_ > capacity()) { deallocate(); allocate(__v.__size_); } _VSTD::copy(__v.__begin_, __v.__begin_ + __external_cap_to_internal(__v.__size_), __begin_); } __size_ = __v.__size_; } return *this;}#ifndef _LIBCPP_CXX03_LANGtemplate <class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvector<bool, _Allocator>::vector(vector&& __v)#if _LIBCPP_STD_VER > 14 _NOEXCEPT#else _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)#endif : __begin_(__v.__begin_), __size_(__v.__size_), __cap_alloc_(__v.__cap_alloc_){ __v.__begin_ = nullptr; __v.__size_ = 0; __v.__cap() = 0;}template <class _Allocator>vector<bool, _Allocator>::vector(vector&& __v, const allocator_type& __a) : __begin_(nullptr), __size_(0), __cap_alloc_(0, __a){ if (__a == allocator_type(__v.__alloc())) { this->__begin_ = __v.__begin_; this->__size_ = __v.__size_; this->__cap() = __v.__cap(); __v.__begin_ = nullptr; __v.__cap() = __v.__size_ = 0; } else if (__v.size() > 0) { allocate(__v.size()); __construct_at_end(__v.begin(), __v.end()); }}template <class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvector<bool, _Allocator>&vector<bool, _Allocator>::operator=(vector&& __v) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)){ __move_assign(__v, integral_constant<bool, __storage_traits::propagate_on_container_move_assignment::value>()); return *this;}template <class _Allocator>voidvector<bool, _Allocator>::__move_assign(vector& __c, false_type){ if (__alloc() != __c.__alloc()) assign(__c.begin(), __c.end()); else __move_assign(__c, true_type());}template <class _Allocator>voidvector<bool, _Allocator>::__move_assign(vector& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value){ deallocate(); __move_assign_alloc(__c); this->__begin_ = __c.__begin_; this->__size_ = __c.__size_; this->__cap() = __c.__cap(); __c.__begin_ = nullptr; __c.__cap() = __c.__size_ = 0;}#endif // !_LIBCPP_CXX03_LANGtemplate <class _Allocator>voidvector<bool, _Allocator>::assign(size_type __n, const value_type& __x){ __size_ = 0; if (__n > 0) { size_type __c = capacity(); if (__n <= __c) __size_ = __n; else { vector __v(__alloc()); __v.reserve(__recommend(__n)); __v.__size_ = __n; swap(__v); } _VSTD::fill_n(begin(), __n, __x); } __invalidate_all_iterators();}template <class _Allocator>template <class _InputIterator>typename enable_if< __is_input_iterator<_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value, void>::typevector<bool, _Allocator>::assign(_InputIterator __first, _InputIterator __last){ clear(); for (; __first != __last; ++__first) push_back(*__first);}template <class _Allocator>template <class _ForwardIterator>typename enable_if< __is_forward_iterator<_ForwardIterator>::value, void>::typevector<bool, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last){ clear(); difference_type __ns = _VSTD::distance(__first, __last); _LIBCPP_ASSERT(__ns >= 0, "invalid range specified"); const size_t __n = static_cast<size_type>(__ns); if (__n) { if (__n > capacity()) { deallocate(); allocate(__n); } __construct_at_end(__first, __last); }}template <class _Allocator>voidvector<bool, _Allocator>::reserve(size_type __n){ if (__n > capacity()) { vector __v(this->__alloc()); __v.allocate(__n); __v.__construct_at_end(this->begin(), this->end()); swap(__v); __invalidate_all_iterators(); }}template <class _Allocator>voidvector<bool, _Allocator>::shrink_to_fit() _NOEXCEPT{ if (__external_cap_to_internal(size()) > __cap()) {#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif // _LIBCPP_NO_EXCEPTIONS vector(*this, allocator_type(__alloc())).swap(*this);#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { }#endif // _LIBCPP_NO_EXCEPTIONS }}template <class _Allocator>typename vector<bool, _Allocator>::referencevector<bool, _Allocator>::at(size_type __n){ if (__n >= size()) this->__throw_out_of_range(); return (*this)[__n];}template <class _Allocator>typename vector<bool, _Allocator>::const_referencevector<bool, _Allocator>::at(size_type __n) const{ if (__n >= size()) this->__throw_out_of_range(); return (*this)[__n];}template <class _Allocator>voidvector<bool, _Allocator>::push_back(const value_type& __x){ if (this->__size_ == this->capacity()) reserve(__recommend(this->__size_ + 1)); ++this->__size_; back() = __x;}template <class _Allocator>typename vector<bool, _Allocator>::iteratorvector<bool, _Allocator>::insert(const_iterator __position, const value_type& __x){ iterator __r; if (size() < capacity()) { const_iterator __old_end = end(); ++__size_; _VSTD::copy_backward(__position, __old_end, end()); __r = __const_iterator_cast(__position); } else { vector __v(__alloc()); __v.reserve(__recommend(__size_ + 1)); __v.__size_ = __size_ + 1; __r = _VSTD::copy(cbegin(), __position, __v.begin()); _VSTD::copy_backward(__position, cend(), __v.end()); swap(__v); } *__r = __x; return __r;}template <class _Allocator>typename vector<bool, _Allocator>::iteratorvector<bool, _Allocator>::insert(const_iterator __position, size_type __n, const value_type& __x){ iterator __r; size_type __c = capacity(); if (__n <= __c && size() <= __c - __n) { const_iterator __old_end = end(); __size_ += __n; _VSTD::copy_backward(__position, __old_end, end()); __r = __const_iterator_cast(__position); } else { vector __v(__alloc()); __v.reserve(__recommend(__size_ + __n)); __v.__size_ = __size_ + __n; __r = _VSTD::copy(cbegin(), __position, __v.begin()); _VSTD::copy_backward(__position, cend(), __v.end()); swap(__v); } _VSTD::fill_n(__r, __n, __x); return __r;}template <class _Allocator>template <class _InputIterator>typename enable_if< __is_input_iterator <_InputIterator>::value && !__is_forward_iterator<_InputIterator>::value, typename vector<bool, _Allocator>::iterator>::typevector<bool, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last){ difference_type __off = __position - begin(); iterator __p = __const_iterator_cast(__position); iterator __old_end = end(); for (; size() != capacity() && __first != __last; ++__first) { ++this->__size_; back() = *__first; } vector __v(__alloc()); if (__first != __last) {#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif // _LIBCPP_NO_EXCEPTIONS __v.assign(__first, __last); difference_type __old_size = static_cast<difference_type>(__old_end - begin()); difference_type __old_p = __p - begin(); reserve(__recommend(size() + __v.size())); __p = begin() + __old_p; __old_end = begin() + __old_size;#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { erase(__old_end, end()); throw; }#endif // _LIBCPP_NO_EXCEPTIONS } __p = _VSTD::rotate(__p, __old_end, end()); insert(__p, __v.begin(), __v.end()); return begin() + __off;}template <class _Allocator>template <class _ForwardIterator>typename enable_if< __is_forward_iterator<_ForwardIterator>::value, typename vector<bool, _Allocator>::iterator>::typevector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last){ const difference_type __n_signed = _VSTD::distance(__first, __last); _LIBCPP_ASSERT(__n_signed >= 0, "invalid range specified"); const size_type __n = static_cast<size_type>(__n_signed); iterator __r; size_type __c = capacity(); if (__n <= __c && size() <= __c - __n) { const_iterator __old_end = end(); __size_ += __n; _VSTD::copy_backward(__position, __old_end, end()); __r = __const_iterator_cast(__position); } else { vector __v(__alloc()); __v.reserve(__recommend(__size_ + __n)); __v.__size_ = __size_ + __n; __r = _VSTD::copy(cbegin(), __position, __v.begin()); _VSTD::copy_backward(__position, cend(), __v.end()); swap(__v); } _VSTD::copy(__first, __last, __r); return __r;}template <class _Allocator>inline _LIBCPP_INLINE_VISIBILITYtypename vector<bool, _Allocator>::iteratorvector<bool, _Allocator>::erase(const_iterator __position){ iterator __r = __const_iterator_cast(__position); _VSTD::copy(__position + 1, this->cend(), __r); --__size_; return __r;}template <class _Allocator>typename vector<bool, _Allocator>::iteratorvector<bool, _Allocator>::erase(const_iterator __first, const_iterator __last){ iterator __r = __const_iterator_cast(__first); difference_type __d = __last - __first; _VSTD::copy(__last, this->cend(), __r); __size_ -= __d; return __r;}template <class _Allocator>voidvector<bool, _Allocator>::swap(vector& __x)#if _LIBCPP_STD_VER >= 14 _NOEXCEPT#else _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<allocator_type>::value)#endif{ _VSTD::swap(this->__begin_, __x.__begin_); _VSTD::swap(this->__size_, __x.__size_); _VSTD::swap(this->__cap(), __x.__cap()); __swap_allocator(this->__alloc(), __x.__alloc(), integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());}template <class _Allocator>voidvector<bool, _Allocator>::resize(size_type __sz, value_type __x){ size_type __cs = size(); if (__cs < __sz) { iterator __r; size_type __c = capacity(); size_type __n = __sz - __cs; if (__n <= __c && __cs <= __c - __n) { __r = end(); __size_ += __n; } else { vector __v(__alloc()); __v.reserve(__recommend(__size_ + __n)); __v.__size_ = __size_ + __n; __r = _VSTD::copy(cbegin(), cend(), __v.begin()); swap(__v); } _VSTD::fill_n(__r, __n, __x); } else __size_ = __sz;}template <class _Allocator>voidvector<bool, _Allocator>::flip() _NOEXCEPT{ // do middle whole words size_type __n = __size_; __storage_pointer __p = __begin_; for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) *__p = ~*__p; // do last partial word if (__n > 0) { __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); __storage_type __b = *__p & __m; *__p &= ~__m; *__p |= ~__b & __m; }}template <class _Allocator>boolvector<bool, _Allocator>::__invariants() const{ if (this->__begin_ == nullptr) { if (this->__size_ != 0 || this->__cap() != 0) return false; } else { if (this->__cap() == 0) return false; if (this->__size_ > this->capacity()) return false; } return true;}template <class _Allocator>size_tvector<bool, _Allocator>::__hash_code() const _NOEXCEPT{ size_t __h = 0; // do middle whole words size_type __n = __size_; __storage_pointer __p = __begin_; for (; __n >= __bits_per_word; ++__p, __n -= __bits_per_word) __h ^= *__p; // do last partial word if (__n > 0) { const __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); __h ^= *__p & __m; } return __h;}template <class _Allocator>struct _LIBCPP_TEMPLATE_VIS hash<vector<bool, _Allocator> > : public unary_function<vector<bool, _Allocator>, size_t>{ _LIBCPP_INLINE_VISIBILITY size_t operator()(const vector<bool, _Allocator>& __vec) const _NOEXCEPT {return __vec.__hash_code();}};template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYbooloperator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y){ const typename vector<_Tp, _Allocator>::size_type __sz = __x.size(); return __sz == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYbooloperator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y){ return !(__x == __y);}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYbooloperator< (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y){ return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYbooloperator> (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y){ return __y < __x;}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYbooloperator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y){ return !(__x < __y);}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYbooloperator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y){ return !(__y < __x);}template <class _Tp, class _Allocator>inline _LIBCPP_INLINE_VISIBILITYvoidswap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))){ __x.swap(__y);}_LIBCPP_END_NAMESPACE_STD_LIBCPP_POP_MACROS#endif // _LIBCPP_VECTOR