Cider Isn't Darwin Emulation, Really
Something went wrong. Try again.
170 kB · 5548 lines
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549// -*- C++ -*-//===-------------------------- memory ------------------------------------===////// 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_MEMORY#define _LIBCPP_MEMORY/* memory synopsisnamespace std{struct allocator_arg_t { };constexpr allocator_arg_t allocator_arg = allocator_arg_t();template <class T, class Alloc> struct uses_allocator;template <class Ptr>struct pointer_traits{ typedef Ptr pointer; typedef <details> element_type; typedef <details> difference_type; template <class U> using rebind = <details>; static pointer pointer_to(<details>);};template <class T>struct pointer_traits<T*>{ typedef T* pointer; typedef T element_type; typedef ptrdiff_t difference_type; template <class U> using rebind = U*; static pointer pointer_to(<details>) noexcept;};template <class Alloc>struct allocator_traits{ typedef Alloc allocator_type; typedef typename allocator_type::value_type value_type; typedef Alloc::pointer | value_type* pointer; typedef Alloc::const_pointer | pointer_traits<pointer>::rebind<const value_type> const_pointer; typedef Alloc::void_pointer | pointer_traits<pointer>::rebind<void> void_pointer; typedef Alloc::const_void_pointer | pointer_traits<pointer>::rebind<const void> const_void_pointer; typedef Alloc::difference_type | pointer_traits<pointer>::difference_type difference_type; typedef Alloc::size_type | make_unsigned<difference_type>::type size_type; typedef Alloc::propagate_on_container_copy_assignment | false_type propagate_on_container_copy_assignment; typedef Alloc::propagate_on_container_move_assignment | false_type propagate_on_container_move_assignment; typedef Alloc::propagate_on_container_swap | false_type propagate_on_container_swap; typedef Alloc::is_always_equal | is_empty is_always_equal; template <class T> using rebind_alloc = Alloc::rebind<U>::other | Alloc<T, Args...>; template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>; static pointer allocate(allocator_type& a, size_type n); static pointer allocate(allocator_type& a, size_type n, const_void_pointer hint); static void deallocate(allocator_type& a, pointer p, size_type n) noexcept; template <class T, class... Args> static void construct(allocator_type& a, T* p, Args&&... args); template <class T> static void destroy(allocator_type& a, T* p); static size_type max_size(const allocator_type& a); // noexcept in C++14 static allocator_type select_on_container_copy_construction(const allocator_type& a);};template <>class allocator<void>{public: typedef void* pointer; typedef const void* const_pointer; typedef void value_type; template <class _Up> struct rebind {typedef allocator<_Up> other;};};template <class T>class allocator{public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef T* pointer; typedef const T* const_pointer; typedef typename add_lvalue_reference<T>::type reference; typedef typename add_lvalue_reference<const T>::type const_reference; typedef T value_type; template <class U> struct rebind {typedef allocator<U> other;}; allocator() noexcept; allocator(const allocator&) noexcept; template <class U> allocator(const allocator<U>&) noexcept; ~allocator(); pointer address(reference x) const noexcept; const_pointer address(const_reference x) const noexcept; pointer allocate(size_type, allocator<void>::const_pointer hint = 0); void deallocate(pointer p, size_type n) noexcept; size_type max_size() const noexcept; template<class U, class... Args> void construct(U* p, Args&&... args); template <class U> void destroy(U* p);};template <class T, class U>bool operator==(const allocator<T>&, const allocator<U>&) noexcept;template <class T, class U>bool operator!=(const allocator<T>&, const allocator<U>&) noexcept;template <class OutputIterator, class T>class raw_storage_iterator : public iterator<output_iterator_tag, T, // purposefully not C++03 ptrdiff_t, // purposefully not C++03 T*, // purposefully not C++03 raw_storage_iterator&> // purposefully not C++03{public: explicit raw_storage_iterator(OutputIterator x); raw_storage_iterator& operator*(); raw_storage_iterator& operator=(const T& element); raw_storage_iterator& operator++(); raw_storage_iterator operator++(int);};template <class T> pair<T*,ptrdiff_t> get_temporary_buffer(ptrdiff_t n) noexcept;template <class T> void return_temporary_buffer(T* p) noexcept;template <class T> T* addressof(T& r) noexcept;template <class T> T* addressof(const T&& r) noexcept = delete;template <class InputIterator, class ForwardIterator>ForwardIteratoruninitialized_copy(InputIterator first, InputIterator last, ForwardIterator result);template <class InputIterator, class Size, class ForwardIterator>ForwardIteratoruninitialized_copy_n(InputIterator first, Size n, ForwardIterator result);template <class ForwardIterator, class T>void uninitialized_fill(ForwardIterator first, ForwardIterator last, const T& x);template <class ForwardIterator, class Size, class T>ForwardIteratoruninitialized_fill_n(ForwardIterator first, Size n, const T& x);template <class T>void destroy_at(T* location);template <class ForwardIterator> void destroy(ForwardIterator first, ForwardIterator last);template <class ForwardIterator, class Size> ForwardIterator destroy_n(ForwardIterator first, Size n);template <class InputIterator, class ForwardIterator> ForwardIterator uninitialized_move(InputIterator first, InputIterator last, ForwardIterator result);template <class InputIterator, class Size, class ForwardIterator> pair<InputIterator,ForwardIterator> uninitialized_move_n(InputIterator first, Size n, ForwardIterator result);template <class ForwardIterator> void uninitialized_value_construct(ForwardIterator first, ForwardIterator last);template <class ForwardIterator, class Size> ForwardIterator uninitialized_value_construct_n(ForwardIterator first, Size n);template <class ForwardIterator> void uninitialized_default_construct(ForwardIterator first, ForwardIterator last);template <class ForwardIterator, class Size> ForwardIterator uninitialized_default_construct_n(ForwardIterator first, Size n);template <class Y> struct auto_ptr_ref {}; // removed in C++17template<class X>class auto_ptr // removed in C++17{public: typedef X element_type; explicit auto_ptr(X* p =0) throw(); auto_ptr(auto_ptr&) throw(); template<class Y> auto_ptr(auto_ptr<Y>&) throw(); auto_ptr& operator=(auto_ptr&) throw(); template<class Y> auto_ptr& operator=(auto_ptr<Y>&) throw(); auto_ptr& operator=(auto_ptr_ref<X> r) throw(); ~auto_ptr() throw(); typename add_lvalue_reference<X>::type operator*() const throw(); X* operator->() const throw(); X* get() const throw(); X* release() throw(); void reset(X* p =0) throw(); auto_ptr(auto_ptr_ref<X>) throw(); template<class Y> operator auto_ptr_ref<Y>() throw(); template<class Y> operator auto_ptr<Y>() throw();};template <class T>struct default_delete{ constexpr default_delete() noexcept = default; template <class U> default_delete(const default_delete<U>&) noexcept; void operator()(T*) const noexcept;};template <class T>struct default_delete<T[]>{ constexpr default_delete() noexcept = default; void operator()(T*) const noexcept; template <class U> void operator()(U*) const = delete;};template <class T, class D = default_delete<T>>class unique_ptr{public: typedef see below pointer; typedef T element_type; typedef D deleter_type; // constructors constexpr unique_ptr() noexcept; explicit unique_ptr(pointer p) noexcept; unique_ptr(pointer p, see below d1) noexcept; unique_ptr(pointer p, see below d2) noexcept; unique_ptr(unique_ptr&& u) noexcept; unique_ptr(nullptr_t) noexcept : unique_ptr() { } template <class U, class E> unique_ptr(unique_ptr<U, E>&& u) noexcept; template <class U> unique_ptr(auto_ptr<U>&& u) noexcept; // removed in C++17 // destructor ~unique_ptr(); // assignment unique_ptr& operator=(unique_ptr&& u) noexcept; template <class U, class E> unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept; unique_ptr& operator=(nullptr_t) noexcept; // observers typename add_lvalue_reference<T>::type operator*() const; pointer operator->() const noexcept; pointer get() const noexcept; deleter_type& get_deleter() noexcept; const deleter_type& get_deleter() const noexcept; explicit operator bool() const noexcept; // modifiers pointer release() noexcept; void reset(pointer p = pointer()) noexcept; void swap(unique_ptr& u) noexcept;};template <class T, class D>class unique_ptr<T[], D>{public: typedef implementation-defined pointer; typedef T element_type; typedef D deleter_type; // constructors constexpr unique_ptr() noexcept; explicit unique_ptr(pointer p) noexcept; unique_ptr(pointer p, see below d) noexcept; unique_ptr(pointer p, see below d) noexcept; unique_ptr(unique_ptr&& u) noexcept; unique_ptr(nullptr_t) noexcept : unique_ptr() { } // destructor ~unique_ptr(); // assignment unique_ptr& operator=(unique_ptr&& u) noexcept; unique_ptr& operator=(nullptr_t) noexcept; // observers T& operator[](size_t i) const; pointer get() const noexcept; deleter_type& get_deleter() noexcept; const deleter_type& get_deleter() const noexcept; explicit operator bool() const noexcept; // modifiers pointer release() noexcept; void reset(pointer p = pointer()) noexcept; void reset(nullptr_t) noexcept; template <class U> void reset(U) = delete; void swap(unique_ptr& u) noexcept;};template <class T, class D> void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept;template <class T1, class D1, class T2, class D2> bool operator==(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);template <class T1, class D1, class T2, class D2> bool operator!=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);template <class T1, class D1, class T2, class D2> bool operator<(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);template <class T1, class D1, class T2, class D2> bool operator<=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);template <class T1, class D1, class T2, class D2> bool operator>(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);template <class T1, class D1, class T2, class D2> bool operator>=(const unique_ptr<T1, D1>& x, const unique_ptr<T2, D2>& y);template <class T, class D> bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept;template <class T, class D> bool operator==(nullptr_t, const unique_ptr<T, D>& y) noexcept;template <class T, class D> bool operator!=(const unique_ptr<T, D>& x, nullptr_t) noexcept;template <class T, class D> bool operator!=(nullptr_t, const unique_ptr<T, D>& y) noexcept;template <class T, class D> bool operator<(const unique_ptr<T, D>& x, nullptr_t);template <class T, class D> bool operator<(nullptr_t, const unique_ptr<T, D>& y);template <class T, class D> bool operator<=(const unique_ptr<T, D>& x, nullptr_t);template <class T, class D> bool operator<=(nullptr_t, const unique_ptr<T, D>& y);template <class T, class D> bool operator>(const unique_ptr<T, D>& x, nullptr_t);template <class T, class D> bool operator>(nullptr_t, const unique_ptr<T, D>& y);template <class T, class D> bool operator>=(const unique_ptr<T, D>& x, nullptr_t);template <class T, class D> bool operator>=(nullptr_t, const unique_ptr<T, D>& y);class bad_weak_ptr : public std::exception{ bad_weak_ptr() noexcept;};template<class T, class... Args> unique_ptr<T> make_unique(Args&&... args); // C++14template<class T> unique_ptr<T> make_unique(size_t n); // C++14template<class T, class... Args> unspecified make_unique(Args&&...) = delete; // C++14, T == U[N]template<class T>class shared_ptr{public: typedef T element_type; typedef weak_ptr<T> weak_type; // C++17 // constructors: constexpr shared_ptr() noexcept; template<class Y> explicit shared_ptr(Y* p); template<class Y, class D> shared_ptr(Y* p, D d); template<class Y, class D, class A> shared_ptr(Y* p, D d, A a); template <class D> shared_ptr(nullptr_t p, D d); template <class D, class A> shared_ptr(nullptr_t p, D d, A a); template<class Y> shared_ptr(const shared_ptr<Y>& r, T *p) noexcept; shared_ptr(const shared_ptr& r) noexcept; template<class Y> shared_ptr(const shared_ptr<Y>& r) noexcept; shared_ptr(shared_ptr&& r) noexcept; template<class Y> shared_ptr(shared_ptr<Y>&& r) noexcept; template<class Y> explicit shared_ptr(const weak_ptr<Y>& r); template<class Y> shared_ptr(auto_ptr<Y>&& r); // removed in C++17 template <class Y, class D> shared_ptr(unique_ptr<Y, D>&& r); shared_ptr(nullptr_t) : shared_ptr() { } // destructor: ~shared_ptr(); // assignment: shared_ptr& operator=(const shared_ptr& r) noexcept; template<class Y> shared_ptr& operator=(const shared_ptr<Y>& r) noexcept; shared_ptr& operator=(shared_ptr&& r) noexcept; template<class Y> shared_ptr& operator=(shared_ptr<Y>&& r); template<class Y> shared_ptr& operator=(auto_ptr<Y>&& r); // removed in C++17 template <class Y, class D> shared_ptr& operator=(unique_ptr<Y, D>&& r); // modifiers: void swap(shared_ptr& r) noexcept; void reset() noexcept; template<class Y> void reset(Y* p); template<class Y, class D> void reset(Y* p, D d); template<class Y, class D, class A> void reset(Y* p, D d, A a); // observers: T* get() const noexcept; T& operator*() const noexcept; T* operator->() const noexcept; long use_count() const noexcept; bool unique() const noexcept; explicit operator bool() const noexcept; template<class U> bool owner_before(shared_ptr<U> const& b) const noexcept; template<class U> bool owner_before(weak_ptr<U> const& b) const noexcept;};// shared_ptr comparisons:template<class T, class U> bool operator==(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;template<class T, class U> bool operator!=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;template<class T, class U> bool operator<(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;template<class T, class U> bool operator>(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;template<class T, class U> bool operator<=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;template<class T, class U> bool operator>=(shared_ptr<T> const& a, shared_ptr<U> const& b) noexcept;template <class T> bool operator==(const shared_ptr<T>& x, nullptr_t) noexcept;template <class T> bool operator==(nullptr_t, const shared_ptr<T>& y) noexcept;template <class T> bool operator!=(const shared_ptr<T>& x, nullptr_t) noexcept;template <class T> bool operator!=(nullptr_t, const shared_ptr<T>& y) noexcept;template <class T> bool operator<(const shared_ptr<T>& x, nullptr_t) noexcept;template <class T>bool operator<(nullptr_t, const shared_ptr<T>& y) noexcept;template <class T> bool operator<=(const shared_ptr<T>& x, nullptr_t) noexcept;template <class T> bool operator<=(nullptr_t, const shared_ptr<T>& y) noexcept;template <class T> bool operator>(const shared_ptr<T>& x, nullptr_t) noexcept;template <class T> bool operator>(nullptr_t, const shared_ptr<T>& y) noexcept;template <class T> bool operator>=(const shared_ptr<T>& x, nullptr_t) noexcept;template <class T> bool operator>=(nullptr_t, const shared_ptr<T>& y) noexcept;// shared_ptr specialized algorithms:template<class T> void swap(shared_ptr<T>& a, shared_ptr<T>& b) noexcept;// shared_ptr casts:template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const& r) noexcept;template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const& r) noexcept;template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const& r) noexcept;// shared_ptr I/O:template<class E, class T, class Y> basic_ostream<E, T>& operator<< (basic_ostream<E, T>& os, shared_ptr<Y> const& p);// shared_ptr get_deleter:template<class D, class T> D* get_deleter(shared_ptr<T> const& p) noexcept;template<class T, class... Args> shared_ptr<T> make_shared(Args&&... args);template<class T, class A, class... Args> shared_ptr<T> allocate_shared(const A& a, Args&&... args);template<class T>class weak_ptr{public: typedef T element_type; // constructors constexpr weak_ptr() noexcept; template<class Y> weak_ptr(shared_ptr<Y> const& r) noexcept; weak_ptr(weak_ptr const& r) noexcept; template<class Y> weak_ptr(weak_ptr<Y> const& r) noexcept; weak_ptr(weak_ptr&& r) noexcept; // C++14 template<class Y> weak_ptr(weak_ptr<Y>&& r) noexcept; // C++14 // destructor ~weak_ptr(); // assignment weak_ptr& operator=(weak_ptr const& r) noexcept; template<class Y> weak_ptr& operator=(weak_ptr<Y> const& r) noexcept; template<class Y> weak_ptr& operator=(shared_ptr<Y> const& r) noexcept; weak_ptr& operator=(weak_ptr&& r) noexcept; // C++14 template<class Y> weak_ptr& operator=(weak_ptr<Y>&& r) noexcept; // C++14 // modifiers void swap(weak_ptr& r) noexcept; void reset() noexcept; // observers long use_count() const noexcept; bool expired() const noexcept; shared_ptr<T> lock() const noexcept; template<class U> bool owner_before(shared_ptr<U> const& b) const noexcept; template<class U> bool owner_before(weak_ptr<U> const& b) const noexcept;};// weak_ptr specialized algorithms:template<class T> void swap(weak_ptr<T>& a, weak_ptr<T>& b) noexcept;// class owner_less:template<class T> struct owner_less;template<class T>struct owner_less<shared_ptr<T>> : binary_function<shared_ptr<T>, shared_ptr<T>, bool>{ typedef bool result_type; bool operator()(shared_ptr<T> const&, shared_ptr<T> const&) const noexcept; bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const noexcept; bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const noexcept;};template<class T>struct owner_less<weak_ptr<T>> : binary_function<weak_ptr<T>, weak_ptr<T>, bool>{ typedef bool result_type; bool operator()(weak_ptr<T> const&, weak_ptr<T> const&) const noexcept; bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const noexcept; bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const noexcept;};template <> // Added in C++14struct owner_less<void>{ template <class _Tp, class _Up> bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const noexcept; template <class _Tp, class _Up> bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const noexcept; template <class _Tp, class _Up> bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const noexcept; template <class _Tp, class _Up> bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const noexcept; typedef void is_transparent;};template<class T>class enable_shared_from_this{protected: constexpr enable_shared_from_this() noexcept; enable_shared_from_this(enable_shared_from_this const&) noexcept; enable_shared_from_this& operator=(enable_shared_from_this const&) noexcept; ~enable_shared_from_this();public: shared_ptr<T> shared_from_this(); shared_ptr<T const> shared_from_this() const;};template<class T> bool atomic_is_lock_free(const shared_ptr<T>* p);template<class T> shared_ptr<T> atomic_load(const shared_ptr<T>* p);template<class T> shared_ptr<T> atomic_load_explicit(const shared_ptr<T>* p, memory_order mo);template<class T> void atomic_store(shared_ptr<T>* p, shared_ptr<T> r);template<class T> void atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);template<class T> shared_ptr<T> atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r);template<class T> shared_ptr<T> atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo);template<class T> bool atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);template<class T> bool atomic_compare_exchange_strong( shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w);template<class T> bool atomic_compare_exchange_weak_explicit(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w, memory_order success, memory_order failure);template<class T> bool atomic_compare_exchange_strong_explicit(shared_ptr<T>* p, shared_ptr<T>* v, shared_ptr<T> w, memory_order success, memory_order failure);// Hash supporttemplate <class T> struct hash;template <class T, class D> struct hash<unique_ptr<T, D> >;template <class T> struct hash<shared_ptr<T> >;// Pointer safetyenum class pointer_safety { relaxed, preferred, strict };void declare_reachable(void *p);template <class T> T *undeclare_reachable(T *p);void declare_no_pointers(char *p, size_t n);void undeclare_no_pointers(char *p, size_t n);pointer_safety get_pointer_safety() noexcept;void* align(size_t alignment, size_t size, void*& ptr, size_t& space);} // std*/#include <__config>#include <type_traits>#include <typeinfo>#include <cstddef>#include <cstdint>#include <new>#include <utility>#include <limits>#include <iterator>#include <__functional_base>#include <iosfwd>#include <tuple>#include <stdexcept>#include <cstring>#include <cassert>#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)# include <atomic>#endif#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)#pragma GCC system_header#endif_LIBCPP_PUSH_MACROS#include <__undef_macros>_LIBCPP_BEGIN_NAMESPACE_STDtemplate <class _ValueType>inline _LIBCPP_ALWAYS_INLINE_ValueType __libcpp_relaxed_load(_ValueType const* __value) {#if !defined(_LIBCPP_HAS_NO_THREADS) && \ defined(__ATOMIC_RELAXED) && \ (__has_builtin(__atomic_load_n) || _GNUC_VER >= 407) return __atomic_load_n(__value, __ATOMIC_RELAXED);#else return *__value;#endif}template <class _ValueType>inline _LIBCPP_ALWAYS_INLINE_ValueType __libcpp_acquire_load(_ValueType const* __value) {#if !defined(_LIBCPP_HAS_NO_THREADS) && \ defined(__ATOMIC_ACQUIRE) && \ (__has_builtin(__atomic_load_n) || _GNUC_VER >= 407) return __atomic_load_n(__value, __ATOMIC_ACQUIRE);#else return *__value;#endif}// addressof moved to <type_traits>template <class _Tp> class allocator;template <>class _LIBCPP_TEMPLATE_VIS allocator<void>{public: typedef void* pointer; typedef const void* const_pointer; typedef void value_type; template <class _Up> struct rebind {typedef allocator<_Up> other;};};template <>class _LIBCPP_TEMPLATE_VIS allocator<const void>{public: typedef const void* pointer; typedef const void* const_pointer; typedef const void value_type; template <class _Up> struct rebind {typedef allocator<_Up> other;};};// pointer_traitstemplate <class _Tp, class = void>struct __has_element_type : false_type {};template <class _Tp>struct __has_element_type<_Tp, typename __void_t<typename _Tp::element_type>::type> : true_type {};template <class _Ptr, bool = __has_element_type<_Ptr>::value>struct __pointer_traits_element_type;template <class _Ptr>struct __pointer_traits_element_type<_Ptr, true>{ typedef typename _Ptr::element_type type;};#ifndef _LIBCPP_HAS_NO_VARIADICStemplate <template <class, class...> class _Sp, class _Tp, class ..._Args>struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>{ typedef typename _Sp<_Tp, _Args...>::element_type type;};template <template <class, class...> class _Sp, class _Tp, class ..._Args>struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false>{ typedef _Tp type;};#else // _LIBCPP_HAS_NO_VARIADICStemplate <template <class> class _Sp, class _Tp>struct __pointer_traits_element_type<_Sp<_Tp>, true>{ typedef typename _Sp<_Tp>::element_type type;};template <template <class> class _Sp, class _Tp>struct __pointer_traits_element_type<_Sp<_Tp>, false>{ typedef _Tp type;};template <template <class, class> class _Sp, class _Tp, class _A0>struct __pointer_traits_element_type<_Sp<_Tp, _A0>, true>{ typedef typename _Sp<_Tp, _A0>::element_type type;};template <template <class, class> class _Sp, class _Tp, class _A0>struct __pointer_traits_element_type<_Sp<_Tp, _A0>, false>{ typedef _Tp type;};template <template <class, class, class> class _Sp, class _Tp, class _A0, class _A1>struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1>, true>{ typedef typename _Sp<_Tp, _A0, _A1>::element_type type;};template <template <class, class, class> class _Sp, class _Tp, class _A0, class _A1>struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1>, false>{ typedef _Tp type;};template <template <class, class, class, class> class _Sp, class _Tp, class _A0, class _A1, class _A2>struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1, _A2>, true>{ typedef typename _Sp<_Tp, _A0, _A1, _A2>::element_type type;};template <template <class, class, class, class> class _Sp, class _Tp, class _A0, class _A1, class _A2>struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1, _A2>, false>{ typedef _Tp type;};#endif // _LIBCPP_HAS_NO_VARIADICStemplate <class _Tp, class = void>struct __has_difference_type : false_type {};template <class _Tp>struct __has_difference_type<_Tp, typename __void_t<typename _Tp::difference_type>::type> : true_type {};template <class _Ptr, bool = __has_difference_type<_Ptr>::value>struct __pointer_traits_difference_type{ typedef ptrdiff_t type;};template <class _Ptr>struct __pointer_traits_difference_type<_Ptr, true>{ typedef typename _Ptr::difference_type type;};template <class _Tp, class _Up>struct __has_rebind{private: struct __two {char __lx; char __lxx;}; template <class _Xp> static __two __test(...); template <class _Xp> static char __test(typename _Xp::template rebind<_Up>* = 0);public: static const bool value = sizeof(__test<_Tp>(0)) == 1;};template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>struct __pointer_traits_rebind{#ifndef _LIBCPP_CXX03_LANG typedef typename _Tp::template rebind<_Up> type;#else typedef typename _Tp::template rebind<_Up>::other type;#endif};#ifndef _LIBCPP_HAS_NO_VARIADICStemplate <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true>{#ifndef _LIBCPP_CXX03_LANG typedef typename _Sp<_Tp, _Args...>::template rebind<_Up> type;#else typedef typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;#endif};template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false>{ typedef _Sp<_Up, _Args...> type;};#else // _LIBCPP_HAS_NO_VARIADICStemplate <template <class> class _Sp, class _Tp, class _Up>struct __pointer_traits_rebind<_Sp<_Tp>, _Up, true>{#ifndef _LIBCPP_CXX03_LANG typedef typename _Sp<_Tp>::template rebind<_Up> type;#else typedef typename _Sp<_Tp>::template rebind<_Up>::other type;#endif};template <template <class> class _Sp, class _Tp, class _Up>struct __pointer_traits_rebind<_Sp<_Tp>, _Up, false>{ typedef _Sp<_Up> type;};template <template <class, class> class _Sp, class _Tp, class _A0, class _Up>struct __pointer_traits_rebind<_Sp<_Tp, _A0>, _Up, true>{#ifndef _LIBCPP_CXX03_LANG typedef typename _Sp<_Tp, _A0>::template rebind<_Up> type;#else typedef typename _Sp<_Tp, _A0>::template rebind<_Up>::other type;#endif};template <template <class, class> class _Sp, class _Tp, class _A0, class _Up>struct __pointer_traits_rebind<_Sp<_Tp, _A0>, _Up, false>{ typedef _Sp<_Up, _A0> type;};template <template <class, class, class> class _Sp, class _Tp, class _A0, class _A1, class _Up>struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1>, _Up, true>{#ifndef _LIBCPP_CXX03_LANG typedef typename _Sp<_Tp, _A0, _A1>::template rebind<_Up> type;#else typedef typename _Sp<_Tp, _A0, _A1>::template rebind<_Up>::other type;#endif};template <template <class, class, class> class _Sp, class _Tp, class _A0, class _A1, class _Up>struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1>, _Up, false>{ typedef _Sp<_Up, _A0, _A1> type;};template <template <class, class, class, class> class _Sp, class _Tp, class _A0, class _A1, class _A2, class _Up>struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1, _A2>, _Up, true>{#ifndef _LIBCPP_CXX03_LANG typedef typename _Sp<_Tp, _A0, _A1, _A2>::template rebind<_Up> type;#else typedef typename _Sp<_Tp, _A0, _A1, _A2>::template rebind<_Up>::other type;#endif};template <template <class, class, class, class> class _Sp, class _Tp, class _A0, class _A1, class _A2, class _Up>struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1, _A2>, _Up, false>{ typedef _Sp<_Up, _A0, _A1, _A2> type;};#endif // _LIBCPP_HAS_NO_VARIADICStemplate <class _Ptr>struct _LIBCPP_TEMPLATE_VIS pointer_traits{ typedef _Ptr pointer; typedef typename __pointer_traits_element_type<pointer>::type element_type; typedef typename __pointer_traits_difference_type<pointer>::type difference_type;#ifndef _LIBCPP_CXX03_LANG template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type;#else template <class _Up> struct rebind {typedef typename __pointer_traits_rebind<pointer, _Up>::type other;};#endif // _LIBCPP_CXX03_LANGprivate: struct __nat {};public: _LIBCPP_INLINE_VISIBILITY static pointer pointer_to(typename conditional<is_void<element_type>::value, __nat, element_type>::type& __r) {return pointer::pointer_to(__r);}};template <class _Tp>struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*>{ typedef _Tp* pointer; typedef _Tp element_type; typedef ptrdiff_t difference_type;#ifndef _LIBCPP_CXX03_LANG template <class _Up> using rebind = _Up*;#else template <class _Up> struct rebind {typedef _Up* other;};#endifprivate: struct __nat {};public: _LIBCPP_INLINE_VISIBILITY static pointer pointer_to(typename conditional<is_void<element_type>::value, __nat, element_type>::type& __r) _NOEXCEPT {return _VSTD::addressof(__r);}};template <class _From, class _To>struct __rebind_pointer {#ifndef _LIBCPP_CXX03_LANG typedef typename pointer_traits<_From>::template rebind<_To> type;#else typedef typename pointer_traits<_From>::template rebind<_To>::other type;#endif};// allocator_traitstemplate <class _Tp, class = void>struct __has_pointer_type : false_type {};template <class _Tp>struct __has_pointer_type<_Tp, typename __void_t<typename _Tp::pointer>::type> : true_type {};namespace __pointer_type_imp{template <class _Tp, class _Dp, bool = __has_pointer_type<_Dp>::value>struct __pointer_type{ typedef typename _Dp::pointer type;};template <class _Tp, class _Dp>struct __pointer_type<_Tp, _Dp, false>{ typedef _Tp* type;};} // __pointer_type_imptemplate <class _Tp, class _Dp>struct __pointer_type{ typedef typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type;};template <class _Tp, class = void>struct __has_const_pointer : false_type {};template <class _Tp>struct __has_const_pointer<_Tp, typename __void_t<typename _Tp::const_pointer>::type> : true_type {};template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value>struct __const_pointer{ typedef typename _Alloc::const_pointer type;};template <class _Tp, class _Ptr, class _Alloc>struct __const_pointer<_Tp, _Ptr, _Alloc, false>{#ifndef _LIBCPP_CXX03_LANG typedef typename pointer_traits<_Ptr>::template rebind<const _Tp> type;#else typedef typename pointer_traits<_Ptr>::template rebind<const _Tp>::other type;#endif};template <class _Tp, class = void>struct __has_void_pointer : false_type {};template <class _Tp>struct __has_void_pointer<_Tp, typename __void_t<typename _Tp::void_pointer>::type> : true_type {};template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value>struct __void_pointer{ typedef typename _Alloc::void_pointer type;};template <class _Ptr, class _Alloc>struct __void_pointer<_Ptr, _Alloc, false>{#ifndef _LIBCPP_CXX03_LANG typedef typename pointer_traits<_Ptr>::template rebind<void> type;#else typedef typename pointer_traits<_Ptr>::template rebind<void>::other type;#endif};template <class _Tp, class = void>struct __has_const_void_pointer : false_type {};template <class _Tp>struct __has_const_void_pointer<_Tp, typename __void_t<typename _Tp::const_void_pointer>::type> : true_type {};template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value>struct __const_void_pointer{ typedef typename _Alloc::const_void_pointer type;};template <class _Ptr, class _Alloc>struct __const_void_pointer<_Ptr, _Alloc, false>{#ifndef _LIBCPP_CXX03_LANG typedef typename pointer_traits<_Ptr>::template rebind<const void> type;#else typedef typename pointer_traits<_Ptr>::template rebind<const void>::other type;#endif};template <class _Tp>inline _LIBCPP_INLINE_VISIBILITY_Tp*__to_raw_pointer(_Tp* __p) _NOEXCEPT{ return __p;}template <class _Pointer>inline _LIBCPP_INLINE_VISIBILITYtypename pointer_traits<_Pointer>::element_type*__to_raw_pointer(_Pointer __p) _NOEXCEPT{ return _VSTD::__to_raw_pointer(__p.operator->());}template <class _Tp, class = void>struct __has_size_type : false_type {};template <class _Tp>struct __has_size_type<_Tp, typename __void_t<typename _Tp::size_type>::type> : true_type {};template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>struct __size_type{ typedef typename make_unsigned<_DiffType>::type type;};template <class _Alloc, class _DiffType>struct __size_type<_Alloc, _DiffType, true>{ typedef typename _Alloc::size_type type;};template <class _Tp, class = void>struct __has_propagate_on_container_copy_assignment : false_type {};template <class _Tp>struct __has_propagate_on_container_copy_assignment<_Tp, typename __void_t<typename _Tp::propagate_on_container_copy_assignment>::type> : true_type {};template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>struct __propagate_on_container_copy_assignment{ typedef false_type type;};template <class _Alloc>struct __propagate_on_container_copy_assignment<_Alloc, true>{ typedef typename _Alloc::propagate_on_container_copy_assignment type;};template <class _Tp, class = void>struct __has_propagate_on_container_move_assignment : false_type {};template <class _Tp>struct __has_propagate_on_container_move_assignment<_Tp, typename __void_t<typename _Tp::propagate_on_container_move_assignment>::type> : true_type {};template <class _Alloc, bool = __has_propagate_on_container_move_assignment<_Alloc>::value>struct __propagate_on_container_move_assignment{ typedef false_type type;};template <class _Alloc>struct __propagate_on_container_move_assignment<_Alloc, true>{ typedef typename _Alloc::propagate_on_container_move_assignment type;};template <class _Tp, class = void>struct __has_propagate_on_container_swap : false_type {};template <class _Tp>struct __has_propagate_on_container_swap<_Tp, typename __void_t<typename _Tp::propagate_on_container_swap>::type> : true_type {};template <class _Alloc, bool = __has_propagate_on_container_swap<_Alloc>::value>struct __propagate_on_container_swap{ typedef false_type type;};template <class _Alloc>struct __propagate_on_container_swap<_Alloc, true>{ typedef typename _Alloc::propagate_on_container_swap type;};template <class _Tp, class = void>struct __has_is_always_equal : false_type {};template <class _Tp>struct __has_is_always_equal<_Tp, typename __void_t<typename _Tp::is_always_equal>::type> : true_type {};template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>struct __is_always_equal{ typedef typename _VSTD::is_empty<_Alloc>::type type;};template <class _Alloc>struct __is_always_equal<_Alloc, true>{ typedef typename _Alloc::is_always_equal type;};template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>struct __has_rebind_other{private: struct __two {char __lx; char __lxx;}; template <class _Xp> static __two __test(...); template <class _Xp> static char __test(typename _Xp::template rebind<_Up>::other* = 0);public: static const bool value = sizeof(__test<_Tp>(0)) == 1;};template <class _Tp, class _Up>struct __has_rebind_other<_Tp, _Up, false>{ static const bool value = false;};template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>struct __allocator_traits_rebind{ typedef typename _Tp::template rebind<_Up>::other type;};#ifndef _LIBCPP_HAS_NO_VARIADICStemplate <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true>{ typedef typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type;};template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false>{ typedef _Alloc<_Up, _Args...> type;};#else // _LIBCPP_HAS_NO_VARIADICStemplate <template <class> class _Alloc, class _Tp, class _Up>struct __allocator_traits_rebind<_Alloc<_Tp>, _Up, true>{ typedef typename _Alloc<_Tp>::template rebind<_Up>::other type;};template <template <class> class _Alloc, class _Tp, class _Up>struct __allocator_traits_rebind<_Alloc<_Tp>, _Up, false>{ typedef _Alloc<_Up> type;};template <template <class, class> class _Alloc, class _Tp, class _A0, class _Up>struct __allocator_traits_rebind<_Alloc<_Tp, _A0>, _Up, true>{ typedef typename _Alloc<_Tp, _A0>::template rebind<_Up>::other type;};template <template <class, class> class _Alloc, class _Tp, class _A0, class _Up>struct __allocator_traits_rebind<_Alloc<_Tp, _A0>, _Up, false>{ typedef _Alloc<_Up, _A0> type;};template <template <class, class, class> class _Alloc, class _Tp, class _A0, class _A1, class _Up>struct __allocator_traits_rebind<_Alloc<_Tp, _A0, _A1>, _Up, true>{ typedef typename _Alloc<_Tp, _A0, _A1>::template rebind<_Up>::other type;};template <template <class, class, class> class _Alloc, class _Tp, class _A0, class _A1, class _Up>struct __allocator_traits_rebind<_Alloc<_Tp, _A0, _A1>, _Up, false>{ typedef _Alloc<_Up, _A0, _A1> type;};template <template <class, class, class, class> class _Alloc, class _Tp, class _A0, class _A1, class _A2, class _Up>struct __allocator_traits_rebind<_Alloc<_Tp, _A0, _A1, _A2>, _Up, true>{ typedef typename _Alloc<_Tp, _A0, _A1, _A2>::template rebind<_Up>::other type;};template <template <class, class, class, class> class _Alloc, class _Tp, class _A0, class _A1, class _A2, class _Up>struct __allocator_traits_rebind<_Alloc<_Tp, _A0, _A1, _A2>, _Up, false>{ typedef _Alloc<_Up, _A0, _A1, _A2> type;};#endif // _LIBCPP_HAS_NO_VARIADICS#ifndef _LIBCPP_CXX03_LANGtemplate <class _Alloc, class _SizeType, class _ConstVoidPtr>auto__has_allocate_hint_test(_Alloc&& __a, _SizeType&& __sz, _ConstVoidPtr&& __p) -> decltype(__a.allocate(__sz, __p), true_type());template <class _Alloc, class _SizeType, class _ConstVoidPtr>auto__has_allocate_hint_test(const _Alloc& __a, _SizeType&& __sz, _ConstVoidPtr&& __p) -> false_type;template <class _Alloc, class _SizeType, class _ConstVoidPtr>struct __has_allocate_hint : integral_constant<bool, is_same< decltype(__has_allocate_hint_test(declval<_Alloc>(), declval<_SizeType>(), declval<_ConstVoidPtr>())), true_type>::value>{};#else // _LIBCPP_CXX03_LANGtemplate <class _Alloc, class _SizeType, class _ConstVoidPtr>struct __has_allocate_hint : true_type{};#endif // _LIBCPP_CXX03_LANG#if !defined(_LIBCPP_CXX03_LANG)template <class _Alloc, class _Tp, class ..._Args>decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Tp*>(), _VSTD::declval<_Args>()...), true_type())__has_construct_test(_Alloc&& __a, _Tp* __p, _Args&& ...__args);template <class _Alloc, class _Pointer, class ..._Args>false_type__has_construct_test(const _Alloc& __a, _Pointer&& __p, _Args&& ...__args);template <class _Alloc, class _Pointer, class ..._Args>struct __has_construct : integral_constant<bool, is_same< decltype(__has_construct_test(declval<_Alloc>(), declval<_Pointer>(), declval<_Args>()...)), true_type>::value>{};template <class _Alloc, class _Pointer>auto__has_destroy_test(_Alloc&& __a, _Pointer&& __p) -> decltype(__a.destroy(__p), true_type());template <class _Alloc, class _Pointer>auto__has_destroy_test(const _Alloc& __a, _Pointer&& __p) -> false_type;template <class _Alloc, class _Pointer>struct __has_destroy : integral_constant<bool, is_same< decltype(__has_destroy_test(declval<_Alloc>(), declval<_Pointer>())), true_type>::value>{};template <class _Alloc>auto__has_max_size_test(_Alloc&& __a) -> decltype(__a.max_size(), true_type());template <class _Alloc>auto__has_max_size_test(const volatile _Alloc& __a) -> false_type;template <class _Alloc>struct __has_max_size : integral_constant<bool, is_same< decltype(__has_max_size_test(declval<_Alloc&>())), true_type>::value>{};template <class _Alloc>auto__has_select_on_container_copy_construction_test(_Alloc&& __a) -> decltype(__a.select_on_container_copy_construction(), true_type());template <class _Alloc>auto__has_select_on_container_copy_construction_test(const volatile _Alloc& __a) -> false_type;template <class _Alloc>struct __has_select_on_container_copy_construction : integral_constant<bool, is_same< decltype(__has_select_on_container_copy_construction_test(declval<_Alloc&>())), true_type>::value>{};#else // _LIBCPP_CXX03_LANG#ifndef _LIBCPP_HAS_NO_VARIADICStemplate <class _Alloc, class _Pointer, class ..._Args>struct __has_construct : false_type{};#else // _LIBCPP_HAS_NO_VARIADICStemplate <class _Alloc, class _Pointer, class _Args>struct __has_construct : false_type{};#endif // _LIBCPP_HAS_NO_VARIADICStemplate <class _Alloc, class _Pointer>struct __has_destroy : false_type{};template <class _Alloc>struct __has_max_size : true_type{};template <class _Alloc>struct __has_select_on_container_copy_construction : false_type{};#endif // _LIBCPP_CXX03_LANGtemplate <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value>struct __alloc_traits_difference_type{ typedef typename pointer_traits<_Ptr>::difference_type type;};template <class _Alloc, class _Ptr>struct __alloc_traits_difference_type<_Alloc, _Ptr, true>{ typedef typename _Alloc::difference_type type;};template <class _Alloc>struct _LIBCPP_TEMPLATE_VIS allocator_traits{ typedef _Alloc allocator_type; typedef typename allocator_type::value_type value_type; typedef typename __pointer_type<value_type, allocator_type>::type pointer; typedef typename __const_pointer<value_type, pointer, allocator_type>::type const_pointer; typedef typename __void_pointer<pointer, allocator_type>::type void_pointer; typedef typename __const_void_pointer<pointer, allocator_type>::type const_void_pointer; typedef typename __alloc_traits_difference_type<allocator_type, pointer>::type difference_type; typedef typename __size_type<allocator_type, difference_type>::type size_type; typedef typename __propagate_on_container_copy_assignment<allocator_type>::type propagate_on_container_copy_assignment; typedef typename __propagate_on_container_move_assignment<allocator_type>::type propagate_on_container_move_assignment; typedef typename __propagate_on_container_swap<allocator_type>::type propagate_on_container_swap; typedef typename __is_always_equal<allocator_type>::type is_always_equal;#ifndef _LIBCPP_CXX03_LANG template <class _Tp> using rebind_alloc = typename __allocator_traits_rebind<allocator_type, _Tp>::type; template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp>>;#else // _LIBCPP_CXX03_LANG template <class _Tp> struct rebind_alloc {typedef typename __allocator_traits_rebind<allocator_type, _Tp>::type other;}; template <class _Tp> struct rebind_traits {typedef allocator_traits<typename rebind_alloc<_Tp>::other> other;};#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY static pointer allocate(allocator_type& __a, size_type __n) {return __a.allocate(__n);} _LIBCPP_INLINE_VISIBILITY static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) {return __allocate(__a, __n, __hint, __has_allocate_hint<allocator_type, size_type, const_void_pointer>());} _LIBCPP_INLINE_VISIBILITY static void deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT {__a.deallocate(__p, __n);}#ifndef _LIBCPP_HAS_NO_VARIADICS template <class _Tp, class... _Args> _LIBCPP_INLINE_VISIBILITY static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args) {__construct(__has_construct<allocator_type, _Tp*, _Args...>(), __a, __p, _VSTD::forward<_Args>(__args)...);}#else // _LIBCPP_HAS_NO_VARIADICS template <class _Tp> _LIBCPP_INLINE_VISIBILITY static void construct(allocator_type&, _Tp* __p) { ::new ((void*)__p) _Tp(); } template <class _Tp, class _A0> _LIBCPP_INLINE_VISIBILITY static void construct(allocator_type&, _Tp* __p, const _A0& __a0) { ::new ((void*)__p) _Tp(__a0); } template <class _Tp, class _A0, class _A1> _LIBCPP_INLINE_VISIBILITY static void construct(allocator_type&, _Tp* __p, const _A0& __a0, const _A1& __a1) { ::new ((void*)__p) _Tp(__a0, __a1); } template <class _Tp, class _A0, class _A1, class _A2> _LIBCPP_INLINE_VISIBILITY static void construct(allocator_type&, _Tp* __p, const _A0& __a0, const _A1& __a1, const _A2& __a2) { ::new ((void*)__p) _Tp(__a0, __a1, __a2); }#endif // _LIBCPP_HAS_NO_VARIADICS template <class _Tp> _LIBCPP_INLINE_VISIBILITY static void destroy(allocator_type& __a, _Tp* __p) {__destroy(__has_destroy<allocator_type, _Tp*>(), __a, __p);} _LIBCPP_INLINE_VISIBILITY static size_type max_size(const allocator_type& __a) _NOEXCEPT {return __max_size(__has_max_size<const allocator_type>(), __a);} _LIBCPP_INLINE_VISIBILITY static allocator_type select_on_container_copy_construction(const allocator_type& __a) {return __select_on_container_copy_construction( __has_select_on_container_copy_construction<const allocator_type>(), __a);} template <class _Ptr> _LIBCPP_INLINE_VISIBILITY static void __construct_forward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2) { for (; __begin1 != __end1; ++__begin1, ++__begin2) construct(__a, _VSTD::__to_raw_pointer(__begin2), _VSTD::move_if_noexcept(*__begin1)); } template <class _Tp> _LIBCPP_INLINE_VISIBILITY static typename enable_if < (is_same<allocator_type, allocator<_Tp> >::value || !__has_construct<allocator_type, _Tp*, _Tp>::value) && is_trivially_move_constructible<_Tp>::value, void >::type __construct_forward(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2) { ptrdiff_t _Np = __end1 - __begin1; if (_Np > 0) { _VSTD::memcpy(__begin2, __begin1, _Np * sizeof(_Tp)); __begin2 += _Np; } } template <class _Iter, class _Ptr> _LIBCPP_INLINE_VISIBILITY static void __construct_range_forward(allocator_type& __a, _Iter __begin1, _Iter __end1, _Ptr& __begin2) { for (; __begin1 != __end1; ++__begin1, (void) ++__begin2) construct(__a, _VSTD::__to_raw_pointer(__begin2), *__begin1); } template <class _Tp> _LIBCPP_INLINE_VISIBILITY static typename enable_if < (is_same<allocator_type, allocator<_Tp> >::value || !__has_construct<allocator_type, _Tp*, _Tp>::value) && is_trivially_move_constructible<_Tp>::value, void >::type __construct_range_forward(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2) { typedef typename remove_const<_Tp>::type _Vp; ptrdiff_t _Np = __end1 - __begin1; if (_Np > 0) { _VSTD::memcpy(const_cast<_Vp*>(__begin2), __begin1, _Np * sizeof(_Tp)); __begin2 += _Np; } } template <class _Ptr> _LIBCPP_INLINE_VISIBILITY static void __construct_backward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __end2) { while (__end1 != __begin1) { construct(__a, _VSTD::__to_raw_pointer(__end2-1), _VSTD::move_if_noexcept(*--__end1)); --__end2; } } template <class _Tp> _LIBCPP_INLINE_VISIBILITY static typename enable_if < (is_same<allocator_type, allocator<_Tp> >::value || !__has_construct<allocator_type, _Tp*, _Tp>::value) && is_trivially_move_constructible<_Tp>::value, void >::type __construct_backward(allocator_type&, _Tp* __begin1, _Tp* __end1, _Tp*& __end2) { ptrdiff_t _Np = __end1 - __begin1; __end2 -= _Np; if (_Np > 0) _VSTD::memcpy(__end2, __begin1, _Np * sizeof(_Tp)); }private: _LIBCPP_INLINE_VISIBILITY static pointer __allocate(allocator_type& __a, size_type __n, const_void_pointer __hint, true_type) {return __a.allocate(__n, __hint);} _LIBCPP_INLINE_VISIBILITY static pointer __allocate(allocator_type& __a, size_type __n, const_void_pointer, false_type) {return __a.allocate(__n);}#ifndef _LIBCPP_HAS_NO_VARIADICS template <class _Tp, class... _Args> _LIBCPP_INLINE_VISIBILITY static void __construct(true_type, allocator_type& __a, _Tp* __p, _Args&&... __args) {__a.construct(__p, _VSTD::forward<_Args>(__args)...);} template <class _Tp, class... _Args> _LIBCPP_INLINE_VISIBILITY static void __construct(false_type, allocator_type&, _Tp* __p, _Args&&... __args) { ::new ((void*)__p) _Tp(_VSTD::forward<_Args>(__args)...); }#endif // _LIBCPP_HAS_NO_VARIADICS template <class _Tp> _LIBCPP_INLINE_VISIBILITY static void __destroy(true_type, allocator_type& __a, _Tp* __p) {__a.destroy(__p);} template <class _Tp> _LIBCPP_INLINE_VISIBILITY static void __destroy(false_type, allocator_type&, _Tp* __p) { __p->~_Tp(); } _LIBCPP_INLINE_VISIBILITY static size_type __max_size(true_type, const allocator_type& __a) {return __a.max_size();} _LIBCPP_INLINE_VISIBILITY static size_type __max_size(false_type, const allocator_type&) {return numeric_limits<size_type>::max() / sizeof(value_type);} _LIBCPP_INLINE_VISIBILITY static allocator_type __select_on_container_copy_construction(true_type, const allocator_type& __a) {return __a.select_on_container_copy_construction();} _LIBCPP_INLINE_VISIBILITY static allocator_type __select_on_container_copy_construction(false_type, const allocator_type& __a) {return __a;}};template <class _Traits, class _Tp>struct __rebind_alloc_helper{#ifndef _LIBCPP_CXX03_LANG typedef typename _Traits::template rebind_alloc<_Tp> type;#else typedef typename _Traits::template rebind_alloc<_Tp>::other type;#endif};// allocatortemplate <class _Tp>class _LIBCPP_TEMPLATE_VIS allocator{public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef _Tp* pointer; typedef const _Tp* const_pointer; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp value_type; typedef true_type propagate_on_container_move_assignment; typedef true_type is_always_equal; template <class _Up> struct rebind {typedef allocator<_Up> other;}; _LIBCPP_INLINE_VISIBILITY allocator() _NOEXCEPT {} template <class _Up> _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY pointer address(reference __x) const _NOEXCEPT {return _VSTD::addressof(__x);} _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT {return _VSTD::addressof(__x);} _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator<void>::const_pointer = 0) { if (__n > max_size()) __throw_length_error("allocator<T>::allocate(size_t n)" " 'n' exceeds maximum supported size"); return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp))); } _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT {_VSTD::__libcpp_deallocate((void*)__p);} _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT {return size_type(~0) / sizeof(_Tp);}#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) template <class _Up, class... _Args> _LIBCPP_INLINE_VISIBILITY void construct(_Up* __p, _Args&&... __args) { ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...); }#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) _LIBCPP_INLINE_VISIBILITY void construct(pointer __p) { ::new((void*)__p) _Tp(); }# if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) template <class _A0> _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, _A0& __a0) { ::new((void*)__p) _Tp(__a0); } template <class _A0> _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, const _A0& __a0) { ::new((void*)__p) _Tp(__a0); }# endif // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) template <class _A0, class _A1> _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, _A0& __a0, _A1& __a1) { ::new((void*)__p) _Tp(__a0, __a1); } template <class _A0, class _A1> _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, const _A0& __a0, _A1& __a1) { ::new((void*)__p) _Tp(__a0, __a1); } template <class _A0, class _A1> _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, _A0& __a0, const _A1& __a1) { ::new((void*)__p) _Tp(__a0, __a1); } template <class _A0, class _A1> _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, const _A0& __a0, const _A1& __a1) { ::new((void*)__p) _Tp(__a0, __a1); }#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) _LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();}};template <class _Tp>class _LIBCPP_TEMPLATE_VIS allocator<const _Tp>{public: typedef size_t size_type; typedef ptrdiff_t difference_type; typedef const _Tp* pointer; typedef const _Tp* const_pointer; typedef const _Tp& reference; typedef const _Tp& const_reference; typedef const _Tp value_type; typedef true_type propagate_on_container_move_assignment; typedef true_type is_always_equal; template <class _Up> struct rebind {typedef allocator<_Up> other;}; _LIBCPP_INLINE_VISIBILITY allocator() _NOEXCEPT {} template <class _Up> _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT {return _VSTD::addressof(__x);} _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator<void>::const_pointer = 0) { if (__n > max_size()) __throw_length_error("allocator<const T>::allocate(size_t n)" " 'n' exceeds maximum supported size"); return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp))); } _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT {_VSTD::__libcpp_deallocate((void*) const_cast<_Tp *>(__p));} _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT {return size_type(~0) / sizeof(_Tp);}#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) template <class _Up, class... _Args> _LIBCPP_INLINE_VISIBILITY void construct(_Up* __p, _Args&&... __args) { ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...); }#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) _LIBCPP_INLINE_VISIBILITY void construct(pointer __p) { ::new((void*) const_cast<_Tp *>(__p)) _Tp(); }# if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) template <class _A0> _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, _A0& __a0) { ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0); } template <class _A0> _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, const _A0& __a0) { ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0); }# endif // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) template <class _A0, class _A1> _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, _A0& __a0, _A1& __a1) { ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); } template <class _A0, class _A1> _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, const _A0& __a0, _A1& __a1) { ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); } template <class _A0, class _A1> _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, _A0& __a0, const _A1& __a1) { ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); } template <class _A0, class _A1> _LIBCPP_INLINE_VISIBILITY void construct(pointer __p, const _A0& __a0, const _A1& __a1) { ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1); }#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) _LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();}};template <class _Tp, class _Up>inline _LIBCPP_INLINE_VISIBILITYbool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return true;}template <class _Tp, class _Up>inline _LIBCPP_INLINE_VISIBILITYbool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;}template <class _OutputIterator, class _Tp>class _LIBCPP_TEMPLATE_VIS raw_storage_iterator : public iterator<output_iterator_tag, _Tp, // purposefully not C++03 ptrdiff_t, // purposefully not C++03 _Tp*, // purposefully not C++03 raw_storage_iterator<_OutputIterator, _Tp>&> // purposefully not C++03{private: _OutputIterator __x_;public: _LIBCPP_INLINE_VISIBILITY explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {} _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element) {::new(&*__x_) _Tp(__element); return *this;}#if _LIBCPP_STD_VER >= 14 _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element) {::new(&*__x_) _Tp(_VSTD::move(__element)); return *this;}#endif _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;} _LIBCPP_INLINE_VISIBILITY raw_storage_iterator operator++(int) {raw_storage_iterator __t(*this); ++__x_; return __t;}#if _LIBCPP_STD_VER >= 14 _LIBCPP_INLINE_VISIBILITY _OutputIterator base() const { return __x_; } #endif};template <class _Tp>pair<_Tp*, ptrdiff_t>get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT{ pair<_Tp*, ptrdiff_t> __r(0, 0); const ptrdiff_t __m = (~ptrdiff_t(0) ^ ptrdiff_t(ptrdiff_t(1) << (sizeof(ptrdiff_t) * __CHAR_BIT__ - 1))) / sizeof(_Tp); if (__n > __m) __n = __m; while (__n > 0) { __r.first = static_cast<_Tp*>(::operator new(__n * sizeof(_Tp), nothrow)); if (__r.first) { __r.second = __n; break; } __n /= 2; } return __r;}template <class _Tp>inline _LIBCPP_INLINE_VISIBILITYvoid return_temporary_buffer(_Tp* __p) _NOEXCEPT {::operator delete(__p);}#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)template <class _Tp>struct auto_ptr_ref{ _Tp* __ptr_;};template<class _Tp>class _LIBCPP_TEMPLATE_VIS auto_ptr{private: _Tp* __ptr_;public: typedef _Tp element_type; _LIBCPP_INLINE_VISIBILITY explicit auto_ptr(_Tp* __p = 0) throw() : __ptr_(__p) {} _LIBCPP_INLINE_VISIBILITY auto_ptr(auto_ptr& __p) throw() : __ptr_(__p.release()) {} template<class _Up> _LIBCPP_INLINE_VISIBILITY auto_ptr(auto_ptr<_Up>& __p) throw() : __ptr_(__p.release()) {} _LIBCPP_INLINE_VISIBILITY auto_ptr& operator=(auto_ptr& __p) throw() {reset(__p.release()); return *this;} template<class _Up> _LIBCPP_INLINE_VISIBILITY auto_ptr& operator=(auto_ptr<_Up>& __p) throw() {reset(__p.release()); return *this;} _LIBCPP_INLINE_VISIBILITY auto_ptr& operator=(auto_ptr_ref<_Tp> __p) throw() {reset(__p.__ptr_); return *this;} _LIBCPP_INLINE_VISIBILITY ~auto_ptr() throw() {delete __ptr_;} _LIBCPP_INLINE_VISIBILITY _Tp& operator*() const throw() {return *__ptr_;} _LIBCPP_INLINE_VISIBILITY _Tp* operator->() const throw() {return __ptr_;} _LIBCPP_INLINE_VISIBILITY _Tp* get() const throw() {return __ptr_;} _LIBCPP_INLINE_VISIBILITY _Tp* release() throw() { _Tp* __t = __ptr_; __ptr_ = 0; return __t; } _LIBCPP_INLINE_VISIBILITY void reset(_Tp* __p = 0) throw() { if (__ptr_ != __p) delete __ptr_; __ptr_ = __p; } _LIBCPP_INLINE_VISIBILITY auto_ptr(auto_ptr_ref<_Tp> __p) throw() : __ptr_(__p.__ptr_) {} template<class _Up> _LIBCPP_INLINE_VISIBILITY operator auto_ptr_ref<_Up>() throw() {auto_ptr_ref<_Up> __t; __t.__ptr_ = release(); return __t;} template<class _Up> _LIBCPP_INLINE_VISIBILITY operator auto_ptr<_Up>() throw() {return auto_ptr<_Up>(release());}};template <>class _LIBCPP_TEMPLATE_VIS auto_ptr<void>{public: typedef void element_type;};#endiftemplate <class _Tp, int _Idx, bool _CanBeEmptyBase = is_empty<_Tp>::value && !__libcpp_is_final<_Tp>::value>struct __compressed_pair_elem { typedef _Tp _ParamT; typedef _Tp& reference; typedef const _Tp& const_reference;#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair_elem() : __value_() {} template <class _Up, class = typename enable_if< !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value >::type> _LIBCPP_INLINE_VISIBILITY constexpr explicit __compressed_pair_elem(_Up&& __u) : __value_(_VSTD::forward<_Up>(__u)){}; template <class... _Args, size_t... _Indexes> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, __tuple_indices<_Indexes...>) : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}#else _LIBCPP_INLINE_VISIBILITY __compressed_pair_elem() : __value_() {} _LIBCPP_INLINE_VISIBILITY __compressed_pair_elem(_ParamT __p) : __value_(std::forward<_ParamT>(__p)) {}#endif _LIBCPP_INLINE_VISIBILITY reference __get() _NOEXCEPT { return __value_; } _LIBCPP_INLINE_VISIBILITY const_reference __get() const _NOEXCEPT { return __value_; }private: _Tp __value_;};template <class _Tp, int _Idx>struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp { typedef _Tp _ParamT; typedef _Tp& reference; typedef const _Tp& const_reference; typedef _Tp __value_type;#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair_elem() = default; template <class _Up, class = typename enable_if< !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value >::type> _LIBCPP_INLINE_VISIBILITY constexpr explicit __compressed_pair_elem(_Up&& __u) : __value_type(_VSTD::forward<_Up>(__u)){}; template <class... _Args, size_t... _Indexes> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args, __tuple_indices<_Indexes...>) : __value_type(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}#else _LIBCPP_INLINE_VISIBILITY __compressed_pair_elem() : __value_type() {} _LIBCPP_INLINE_VISIBILITY __compressed_pair_elem(_ParamT __p) : __value_type(std::forward<_ParamT>(__p)) {}#endif _LIBCPP_INLINE_VISIBILITY reference __get() _NOEXCEPT { return *this; } _LIBCPP_INLINE_VISIBILITY const_reference __get() const _NOEXCEPT { return *this; }};// Tag used to construct the second element of the compressed pair.struct __second_tag {};template <class _T1, class _T2>class __compressed_pair : private __compressed_pair_elem<_T1, 0>, private __compressed_pair_elem<_T2, 1> { typedef __compressed_pair_elem<_T1, 0> _Base1; typedef __compressed_pair_elem<_T2, 1> _Base2; // NOTE: This static assert should never fire because __compressed_pair // is *almost never* used in a scenario where it's possible for T1 == T2. // (The exception is std::function where it is possible that the function // object and the allocator have the same type). static_assert((!is_same<_T1, _T2>::value), "__compressed_pair cannot be instantated when T1 and T2 are the same type; " "The current implementation is NOT ABI-compatible with the previous " "implementation for this configuration");public:#ifndef _LIBCPP_CXX03_LANG template <bool _Dummy = true, class = typename enable_if< __dependent_type<is_default_constructible<_T1>, _Dummy>::value && __dependent_type<is_default_constructible<_T2>, _Dummy>::value >::type > _LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair() {} template <class _Tp, typename enable_if<!is_same<typename decay<_Tp>::type, __compressed_pair>::value, bool>::type = true> _LIBCPP_INLINE_VISIBILITY constexpr explicit __compressed_pair(_Tp&& __t) : _Base1(std::forward<_Tp>(__t)), _Base2() {} template <class _Tp> _LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair(__second_tag, _Tp&& __t) : _Base1(), _Base2(std::forward<_Tp>(__t)) {} template <class _U1, class _U2> _LIBCPP_INLINE_VISIBILITY constexpr __compressed_pair(_U1&& __t1, _U2&& __t2) : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {} template <class... _Args1, class... _Args2> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) : _Base1(__pc, _VSTD::move(__first_args), typename __make_tuple_indices<sizeof...(_Args1)>::type()), _Base2(__pc, _VSTD::move(__second_args), typename __make_tuple_indices<sizeof...(_Args2)>::type()) {}#else _LIBCPP_INLINE_VISIBILITY __compressed_pair() {} _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1 __t1) : _Base1(_VSTD::forward<_T1>(__t1)) {} _LIBCPP_INLINE_VISIBILITY __compressed_pair(__second_tag, _T2 __t2) : _Base1(), _Base2(_VSTD::forward<_T2>(__t2)) {} _LIBCPP_INLINE_VISIBILITY __compressed_pair(_T1 __t1, _T2 __t2) : _Base1(_VSTD::forward<_T1>(__t1)), _Base2(_VSTD::forward<_T2>(__t2)) {}#endif _LIBCPP_INLINE_VISIBILITY typename _Base1::reference first() _NOEXCEPT { return static_cast<_Base1&>(*this).__get(); } _LIBCPP_INLINE_VISIBILITY typename _Base1::const_reference first() const _NOEXCEPT { return static_cast<_Base1 const&>(*this).__get(); } _LIBCPP_INLINE_VISIBILITY typename _Base2::reference second() _NOEXCEPT { return static_cast<_Base2&>(*this).__get(); } _LIBCPP_INLINE_VISIBILITY typename _Base2::const_reference second() const _NOEXCEPT { return static_cast<_Base2 const&>(*this).__get(); } _LIBCPP_INLINE_VISIBILITY void swap(__compressed_pair& __x) _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value) { using std::swap; swap(first(), __x.first()); swap(second(), __x.second()); }};template <class _T1, class _T2>inline _LIBCPP_INLINE_VISIBILITYvoid swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y) _NOEXCEPT_(__is_nothrow_swappable<_T1>::value && __is_nothrow_swappable<_T2>::value) { __x.swap(__y);}// default_deletetemplate <class _Tp>struct _LIBCPP_TEMPLATE_VIS default_delete { static_assert(!is_function<_Tp>::value, "default_delete cannot be instantiated for function types");#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;#else _LIBCPP_INLINE_VISIBILITY default_delete() {}#endif template <class _Up> _LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up>&, typename enable_if<is_convertible<_Up*, _Tp*>::value>::type* = 0) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __ptr) const _NOEXCEPT { static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type"); static_assert(!is_void<_Tp>::value, "default_delete can not delete incomplete type"); delete __ptr; }};template <class _Tp>struct _LIBCPP_TEMPLATE_VIS default_delete<_Tp[]> {private: template <class _Up> struct _EnableIfConvertible : enable_if<is_convertible<_Up(*)[], _Tp(*)[]>::value> {};public:#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;#else _LIBCPP_INLINE_VISIBILITY default_delete() {}#endif template <class _Up> _LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up[]>&, typename _EnableIfConvertible<_Up>::type* = 0) _NOEXCEPT {} template <class _Up> _LIBCPP_INLINE_VISIBILITY typename _EnableIfConvertible<_Up>::type operator()(_Up* __ptr) const _NOEXCEPT { static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type"); static_assert(!is_void<_Tp>::value, "default_delete can not delete void type"); delete[] __ptr; }};#ifndef _LIBCPP_CXX03_LANGtemplate <class _Deleter>struct __unique_ptr_deleter_sfinae { static_assert(!is_reference<_Deleter>::value, "incorrect specialization"); typedef const _Deleter& __lval_ref_type; typedef _Deleter&& __good_rval_ref_type; typedef true_type __enable_rval_overload;};template <class _Deleter>struct __unique_ptr_deleter_sfinae<_Deleter const&> { typedef const _Deleter& __lval_ref_type; typedef const _Deleter&& __bad_rval_ref_type; typedef false_type __enable_rval_overload;};template <class _Deleter>struct __unique_ptr_deleter_sfinae<_Deleter&> { typedef _Deleter& __lval_ref_type; typedef _Deleter&& __bad_rval_ref_type; typedef false_type __enable_rval_overload;};#endif // !defined(_LIBCPP_CXX03_LANG)template <class _Tp, class _Dp = default_delete<_Tp> >class _LIBCPP_TEMPLATE_VIS unique_ptr {public: typedef _Tp element_type; typedef _Dp deleter_type; typedef typename __pointer_type<_Tp, deleter_type>::type pointer; static_assert(!is_rvalue_reference<deleter_type>::value, "the specified deleter type cannot be an rvalue reference");private: __compressed_pair<pointer, deleter_type> __ptr_; struct __nat { int __for_bool_; };#ifndef _LIBCPP_CXX03_LANG typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE; template <bool _Dummy> using _LValRefType = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type; template <bool _Dummy> using _GoodRValRefType = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type; template <bool _Dummy> using _BadRValRefType = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type; template <bool _Dummy, class _Deleter = typename __dependent_type< __identity<deleter_type>, _Dummy>::type> using _EnableIfDeleterDefaultConstructible = typename enable_if<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>::type; template <class _ArgType> using _EnableIfDeleterConstructible = typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type; template <class _UPtr, class _Up> using _EnableIfMoveConvertible = typename enable_if< is_convertible<typename _UPtr::pointer, pointer>::value && !is_array<_Up>::value >::type; template <class _UDel> using _EnableIfDeleterConvertible = typename enable_if< (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) || (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value) >::type; template <class _UDel> using _EnableIfDeleterAssignable = typename enable_if< is_assignable<_Dp&, _UDel&&>::value >::type;public: template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>> _LIBCPP_INLINE_VISIBILITY constexpr unique_ptr() noexcept : __ptr_(pointer()) {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>> _LIBCPP_INLINE_VISIBILITY constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>> _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(pointer __p) noexcept : __ptr_(__p) {} template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>> _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, _LValRefType<_Dummy> __d) noexcept : __ptr_(__p, __d) {} template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>> _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) noexcept : __ptr_(__p, _VSTD::move(__d)) { static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); } template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy>>> _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete; _LIBCPP_INLINE_VISIBILITY unique_ptr(unique_ptr&& __u) noexcept : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) { } template <class _Up, class _Ep, class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, class = _EnableIfDeleterConvertible<_Ep> > _LIBCPP_INLINE_VISIBILITY unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {}#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) template <class _Up> _LIBCPP_INLINE_VISIBILITY unique_ptr(auto_ptr<_Up>&& __p, typename enable_if<is_convertible<_Up*, _Tp*>::value && is_same<_Dp, default_delete<_Tp>>::value, __nat>::type = __nat()) _NOEXCEPT : __ptr_(__p.release()) {}#endif _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { reset(__u.release()); __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter()); return *this; } template <class _Up, class _Ep, class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, class = _EnableIfDeleterAssignable<_Ep> > _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT { reset(__u.release()); __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); return *this; }#else // _LIBCPP_CXX03_LANGprivate: unique_ptr(unique_ptr&); template <class _Up, class _Ep> unique_ptr(unique_ptr<_Up, _Ep>&); unique_ptr& operator=(unique_ptr&); template <class _Up, class _Ep> unique_ptr& operator=(unique_ptr<_Up, _Ep>&);public: _LIBCPP_INLINE_VISIBILITY unique_ptr() : __ptr_(pointer()) { static_assert(!is_pointer<deleter_type>::value, "unique_ptr constructed with null function pointer deleter"); static_assert(is_default_constructible<deleter_type>::value, "unique_ptr::deleter_type is not default constructible"); } _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t) : __ptr_(pointer()) { static_assert(!is_pointer<deleter_type>::value, "unique_ptr constructed with null function pointer deleter"); } _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(pointer __p) : __ptr_(_VSTD::move(__p)) { static_assert(!is_pointer<deleter_type>::value, "unique_ptr constructed with null function pointer deleter"); } _LIBCPP_INLINE_VISIBILITY operator __rv<unique_ptr>() { return __rv<unique_ptr>(*this); } _LIBCPP_INLINE_VISIBILITY unique_ptr(__rv<unique_ptr> __u) : __ptr_(__u->release(), _VSTD::forward<deleter_type>(__u->get_deleter())) {} template <class _Up, class _Ep> _LIBCPP_INLINE_VISIBILITY typename enable_if< !is_array<_Up>::value && is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value && is_assignable<deleter_type&, _Ep&>::value, unique_ptr&>::type operator=(unique_ptr<_Up, _Ep> __u) { reset(__u.release()); __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); return *this; } _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, deleter_type __d) : __ptr_(_VSTD::move(__p), _VSTD::move(__d)) {}#endif // _LIBCPP_CXX03_LANG#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) template <class _Up> _LIBCPP_INLINE_VISIBILITY typename enable_if<is_convertible<_Up*, _Tp*>::value && is_same<_Dp, default_delete<_Tp> >::value, unique_ptr&>::type operator=(auto_ptr<_Up> __p) { reset(__p.release()); return *this; }#endif _LIBCPP_INLINE_VISIBILITY ~unique_ptr() { reset(); } _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(nullptr_t) _NOEXCEPT { reset(); return *this; } _LIBCPP_INLINE_VISIBILITY typename add_lvalue_reference<_Tp>::type operator*() const { return *__ptr_.first(); } _LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT { return __ptr_.first(); } _LIBCPP_INLINE_VISIBILITY pointer get() const _NOEXCEPT { return __ptr_.first(); } _LIBCPP_INLINE_VISIBILITY deleter_type& get_deleter() _NOEXCEPT { return __ptr_.second(); } _LIBCPP_INLINE_VISIBILITY const deleter_type& get_deleter() const _NOEXCEPT { return __ptr_.second(); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT { return __ptr_.first() != nullptr; } _LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT { pointer __t = __ptr_.first(); __ptr_.first() = pointer(); return __t; } _LIBCPP_INLINE_VISIBILITY void reset(pointer __p = pointer()) _NOEXCEPT { pointer __tmp = __ptr_.first(); __ptr_.first() = __p; if (__tmp) __ptr_.second()(__tmp); } _LIBCPP_INLINE_VISIBILITY void swap(unique_ptr& __u) _NOEXCEPT { __ptr_.swap(__u.__ptr_); }};template <class _Tp, class _Dp>class _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp> {public: typedef _Tp element_type; typedef _Dp deleter_type; typedef typename __pointer_type<_Tp, deleter_type>::type pointer;private: __compressed_pair<pointer, deleter_type> __ptr_; template <class _From> struct _CheckArrayPointerConversion : is_same<_From, pointer> {}; template <class _FromElem> struct _CheckArrayPointerConversion<_FromElem*> : integral_constant<bool, is_same<_FromElem*, pointer>::value || (is_same<pointer, element_type*>::value && is_convertible<_FromElem(*)[], element_type(*)[]>::value) > {};#ifndef _LIBCPP_CXX03_LANG typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE; template <bool _Dummy> using _LValRefType = typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type; template <bool _Dummy> using _GoodRValRefType = typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type; template <bool _Dummy> using _BadRValRefType = typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type; template <bool _Dummy, class _Deleter = typename __dependent_type< __identity<deleter_type>, _Dummy>::type> using _EnableIfDeleterDefaultConstructible = typename enable_if<is_default_constructible<_Deleter>::value && !is_pointer<_Deleter>::value>::type; template <class _ArgType> using _EnableIfDeleterConstructible = typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type; template <class _Pp> using _EnableIfPointerConvertible = typename enable_if< _CheckArrayPointerConversion<_Pp>::value >::type; template <class _UPtr, class _Up, class _ElemT = typename _UPtr::element_type> using _EnableIfMoveConvertible = typename enable_if< is_array<_Up>::value && is_same<pointer, element_type*>::value && is_same<typename _UPtr::pointer, _ElemT*>::value && is_convertible<_ElemT(*)[], element_type(*)[]>::value >::type; template <class _UDel> using _EnableIfDeleterConvertible = typename enable_if< (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) || (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value) >::type; template <class _UDel> using _EnableIfDeleterAssignable = typename enable_if< is_assignable<_Dp&, _UDel&&>::value >::type;public: template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>> _LIBCPP_INLINE_VISIBILITY constexpr unique_ptr() noexcept : __ptr_(pointer()) {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>> _LIBCPP_INLINE_VISIBILITY constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {} template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>, class = _EnableIfPointerConvertible<_Pp>> _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_Pp __p) noexcept : __ptr_(__p) {} template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>, class = _EnableIfPointerConvertible<_Pp>> _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) noexcept : __ptr_(__p, __d) {} template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>> _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) noexcept : __ptr_(nullptr, __d) {} template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>, class = _EnableIfPointerConvertible<_Pp>> _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) noexcept : __ptr_(__p, _VSTD::move(__d)) { static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); } template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>> _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) noexcept : __ptr_(nullptr, _VSTD::move(__d)) { static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); } template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy>>, class = _EnableIfPointerConvertible<_Pp>> _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete; _LIBCPP_INLINE_VISIBILITY unique_ptr(unique_ptr&& __u) noexcept : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) { } _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr&& __u) noexcept { reset(__u.release()); __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter()); return *this; } template <class _Up, class _Ep, class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, class = _EnableIfDeleterConvertible<_Ep> > _LIBCPP_INLINE_VISIBILITY unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) { } template <class _Up, class _Ep, class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, class = _EnableIfDeleterAssignable<_Ep> > _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) noexcept { reset(__u.release()); __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); return *this; }#else // _LIBCPP_CXX03_LANGprivate: template <class _Up> explicit unique_ptr(_Up); unique_ptr(unique_ptr&); template <class _Up> unique_ptr(unique_ptr<_Up>&); unique_ptr& operator=(unique_ptr&); template <class _Up> unique_ptr& operator=(unique_ptr<_Up>&); template <class _Up> unique_ptr(_Up __u, typename conditional< is_reference<deleter_type>::value, deleter_type, typename add_lvalue_reference<const deleter_type>::type>::type, typename enable_if<is_convertible<_Up, pointer>::value, __nat>::type = __nat());public: _LIBCPP_INLINE_VISIBILITY unique_ptr() : __ptr_(pointer()) { static_assert(!is_pointer<deleter_type>::value, "unique_ptr constructed with null function pointer deleter"); } _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t) : __ptr_(pointer()) { static_assert(!is_pointer<deleter_type>::value, "unique_ptr constructed with null function pointer deleter"); } _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(pointer __p) : __ptr_(__p) { static_assert(!is_pointer<deleter_type>::value, "unique_ptr constructed with null function pointer deleter"); } _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, deleter_type __d) : __ptr_(__p, _VSTD::forward<deleter_type>(__d)) {} _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, deleter_type __d) : __ptr_(pointer(), _VSTD::forward<deleter_type>(__d)) {} _LIBCPP_INLINE_VISIBILITY operator __rv<unique_ptr>() { return __rv<unique_ptr>(*this); } _LIBCPP_INLINE_VISIBILITY unique_ptr(__rv<unique_ptr> __u) : __ptr_(__u->release(), _VSTD::forward<deleter_type>(__u->get_deleter())) {} _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(__rv<unique_ptr> __u) { reset(__u->release()); __ptr_.second() = _VSTD::forward<deleter_type>(__u->get_deleter()); return *this; }#endif // _LIBCPP_CXX03_LANGpublic: _LIBCPP_INLINE_VISIBILITY ~unique_ptr() { reset(); } _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(nullptr_t) _NOEXCEPT { reset(); return *this; } _LIBCPP_INLINE_VISIBILITY typename add_lvalue_reference<_Tp>::type operator[](size_t __i) const { return __ptr_.first()[__i]; } _LIBCPP_INLINE_VISIBILITY pointer get() const _NOEXCEPT { return __ptr_.first(); } _LIBCPP_INLINE_VISIBILITY deleter_type& get_deleter() _NOEXCEPT { return __ptr_.second(); } _LIBCPP_INLINE_VISIBILITY const deleter_type& get_deleter() const _NOEXCEPT { return __ptr_.second(); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT { return __ptr_.first() != nullptr; } _LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT { pointer __t = __ptr_.first(); __ptr_.first() = pointer(); return __t; } template <class _Pp> _LIBCPP_INLINE_VISIBILITY typename enable_if< _CheckArrayPointerConversion<_Pp>::value >::type reset(_Pp __p) _NOEXCEPT { pointer __tmp = __ptr_.first(); __ptr_.first() = __p; if (__tmp) __ptr_.second()(__tmp); } _LIBCPP_INLINE_VISIBILITY void reset(nullptr_t = nullptr) _NOEXCEPT { pointer __tmp = __ptr_.first(); __ptr_.first() = nullptr; if (__tmp) __ptr_.second()(__tmp); } _LIBCPP_INLINE_VISIBILITY void swap(unique_ptr& __u) _NOEXCEPT { __ptr_.swap(__u.__ptr_); }};template <class _Tp, class _Dp>inline _LIBCPP_INLINE_VISIBILITYtypename enable_if< __is_swappable<_Dp>::value, void>::typeswap(unique_ptr<_Tp, _Dp>& __x, unique_ptr<_Tp, _Dp>& __y) _NOEXCEPT {__x.swap(__y);}template <class _T1, class _D1, class _T2, class _D2>inline _LIBCPP_INLINE_VISIBILITYbooloperator==(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __x.get() == __y.get();}template <class _T1, class _D1, class _T2, class _D2>inline _LIBCPP_INLINE_VISIBILITYbooloperator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x == __y);}template <class _T1, class _D1, class _T2, class _D2>inline _LIBCPP_INLINE_VISIBILITYbooloperator< (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y){ typedef typename unique_ptr<_T1, _D1>::pointer _P1; typedef typename unique_ptr<_T2, _D2>::pointer _P2; typedef typename common_type<_P1, _P2>::type _Vp; return less<_Vp>()(__x.get(), __y.get());}template <class _T1, class _D1, class _T2, class _D2>inline _LIBCPP_INLINE_VISIBILITYbooloperator> (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __y < __x;}template <class _T1, class _D1, class _T2, class _D2>inline _LIBCPP_INLINE_VISIBILITYbooloperator<=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__y < __x);}template <class _T1, class _D1, class _T2, class _D2>inline _LIBCPP_INLINE_VISIBILITYbooloperator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x < __y);}template <class _T1, class _D1>inline _LIBCPP_INLINE_VISIBILITYbooloperator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT{ return !__x;}template <class _T1, class _D1>inline _LIBCPP_INLINE_VISIBILITYbooloperator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT{ return !__x;}template <class _T1, class _D1>inline _LIBCPP_INLINE_VISIBILITYbooloperator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT{ return static_cast<bool>(__x);}template <class _T1, class _D1>inline _LIBCPP_INLINE_VISIBILITYbooloperator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT{ return static_cast<bool>(__x);}template <class _T1, class _D1>inline _LIBCPP_INLINE_VISIBILITYbooloperator<(const unique_ptr<_T1, _D1>& __x, nullptr_t){ typedef typename unique_ptr<_T1, _D1>::pointer _P1; return less<_P1>()(__x.get(), nullptr);}template <class _T1, class _D1>inline _LIBCPP_INLINE_VISIBILITYbooloperator<(nullptr_t, const unique_ptr<_T1, _D1>& __x){ typedef typename unique_ptr<_T1, _D1>::pointer _P1; return less<_P1>()(nullptr, __x.get());}template <class _T1, class _D1>inline _LIBCPP_INLINE_VISIBILITYbooloperator>(const unique_ptr<_T1, _D1>& __x, nullptr_t){ return nullptr < __x;}template <class _T1, class _D1>inline _LIBCPP_INLINE_VISIBILITYbooloperator>(nullptr_t, const unique_ptr<_T1, _D1>& __x){ return __x < nullptr;}template <class _T1, class _D1>inline _LIBCPP_INLINE_VISIBILITYbooloperator<=(const unique_ptr<_T1, _D1>& __x, nullptr_t){ return !(nullptr < __x);}template <class _T1, class _D1>inline _LIBCPP_INLINE_VISIBILITYbooloperator<=(nullptr_t, const unique_ptr<_T1, _D1>& __x){ return !(__x < nullptr);}template <class _T1, class _D1>inline _LIBCPP_INLINE_VISIBILITYbooloperator>=(const unique_ptr<_T1, _D1>& __x, nullptr_t){ return !(__x < nullptr);}template <class _T1, class _D1>inline _LIBCPP_INLINE_VISIBILITYbooloperator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x){ return !(nullptr < __x);}#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCEStemplate <class _Tp, class _Dp>inline _LIBCPP_INLINE_VISIBILITYunique_ptr<_Tp, _Dp>move(unique_ptr<_Tp, _Dp>& __t){ return unique_ptr<_Tp, _Dp>(__rv<unique_ptr<_Tp, _Dp> >(__t));}#endif#if _LIBCPP_STD_VER > 11template<class _Tp>struct __unique_if{ typedef unique_ptr<_Tp> __unique_single;};template<class _Tp>struct __unique_if<_Tp[]>{ typedef unique_ptr<_Tp[]> __unique_array_unknown_bound;};template<class _Tp, size_t _Np>struct __unique_if<_Tp[_Np]>{ typedef void __unique_array_known_bound;};template<class _Tp, class... _Args>inline _LIBCPP_INLINE_VISIBILITYtypename __unique_if<_Tp>::__unique_singlemake_unique(_Args&&... __args){ return unique_ptr<_Tp>(new _Tp(_VSTD::forward<_Args>(__args)...));}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYtypename __unique_if<_Tp>::__unique_array_unknown_boundmake_unique(size_t __n){ typedef typename remove_extent<_Tp>::type _Up; return unique_ptr<_Tp>(new _Up[__n]());}template<class _Tp, class... _Args> typename __unique_if<_Tp>::__unique_array_known_bound make_unique(_Args&&...) = delete;#endif // _LIBCPP_STD_VER > 11template <class _Tp, class _Dp>#ifdef _LIBCPP_CXX03_LANGstruct _LIBCPP_TEMPLATE_VIS hash<unique_ptr<_Tp, _Dp> >#elsestruct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper< unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer>>#endif{ typedef unique_ptr<_Tp, _Dp> argument_type; typedef size_t result_type; _LIBCPP_INLINE_VISIBILITY result_type operator()(const argument_type& __ptr) const { typedef typename argument_type::pointer pointer; return hash<pointer>()(__ptr.get()); }};struct __destruct_n{private: size_t __size_; template <class _Tp> _LIBCPP_INLINE_VISIBILITY void __process(_Tp* __p, false_type) _NOEXCEPT {for (size_t __i = 0; __i < __size_; ++__i, ++__p) __p->~_Tp();} template <class _Tp> _LIBCPP_INLINE_VISIBILITY void __process(_Tp*, true_type) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void __incr(false_type) _NOEXCEPT {++__size_;} _LIBCPP_INLINE_VISIBILITY void __incr(true_type) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void __set(size_t __s, false_type) _NOEXCEPT {__size_ = __s;} _LIBCPP_INLINE_VISIBILITY void __set(size_t, true_type) _NOEXCEPT {}public: _LIBCPP_INLINE_VISIBILITY explicit __destruct_n(size_t __s) _NOEXCEPT : __size_(__s) {} template <class _Tp> _LIBCPP_INLINE_VISIBILITY void __incr(_Tp*) _NOEXCEPT {__incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());} template <class _Tp> _LIBCPP_INLINE_VISIBILITY void __set(size_t __s, _Tp*) _NOEXCEPT {__set(__s, integral_constant<bool, is_trivially_destructible<_Tp>::value>());} template <class _Tp> _LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __p) _NOEXCEPT {__process(__p, integral_constant<bool, is_trivially_destructible<_Tp>::value>());}};template <class _Alloc>class __allocator_destructor{ typedef allocator_traits<_Alloc> __alloc_traits;public: typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::size_type size_type;private: _Alloc& __alloc_; size_type __s_;public: _LIBCPP_INLINE_VISIBILITY __allocator_destructor(_Alloc& __a, size_type __s) _NOEXCEPT : __alloc_(__a), __s_(__s) {} _LIBCPP_INLINE_VISIBILITY void operator()(pointer __p) _NOEXCEPT {__alloc_traits::deallocate(__alloc_, __p, __s_);}};template <class _InputIterator, class _ForwardIterator>_ForwardIteratoruninitialized_copy(_InputIterator __f, _InputIterator __l, _ForwardIterator __r){ typedef typename iterator_traits<_ForwardIterator>::value_type value_type;#ifndef _LIBCPP_NO_EXCEPTIONS _ForwardIterator __s = __r; try {#endif for (; __f != __l; ++__f, (void) ++__r) ::new (static_cast<void*>(_VSTD::addressof(*__r))) value_type(*__f);#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { for (; __s != __r; ++__s) __s->~value_type(); throw; }#endif return __r;}template <class _InputIterator, class _Size, class _ForwardIterator>_ForwardIteratoruninitialized_copy_n(_InputIterator __f, _Size __n, _ForwardIterator __r){ typedef typename iterator_traits<_ForwardIterator>::value_type value_type;#ifndef _LIBCPP_NO_EXCEPTIONS _ForwardIterator __s = __r; try {#endif for (; __n > 0; ++__f, (void) ++__r, (void) --__n) ::new (static_cast<void*>(_VSTD::addressof(*__r))) value_type(*__f);#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { for (; __s != __r; ++__s) __s->~value_type(); throw; }#endif return __r;}template <class _ForwardIterator, class _Tp>voiduninitialized_fill(_ForwardIterator __f, _ForwardIterator __l, const _Tp& __x){ typedef typename iterator_traits<_ForwardIterator>::value_type value_type;#ifndef _LIBCPP_NO_EXCEPTIONS _ForwardIterator __s = __f; try {#endif for (; __f != __l; ++__f) ::new (static_cast<void*>(_VSTD::addressof(*__f))) value_type(__x);#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { for (; __s != __f; ++__s) __s->~value_type(); throw; }#endif}template <class _ForwardIterator, class _Size, class _Tp>_ForwardIteratoruninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x){ typedef typename iterator_traits<_ForwardIterator>::value_type value_type;#ifndef _LIBCPP_NO_EXCEPTIONS _ForwardIterator __s = __f; try {#endif for (; __n > 0; ++__f, (void) --__n) ::new (static_cast<void*>(_VSTD::addressof(*__f))) value_type(__x);#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { for (; __s != __f; ++__s) __s->~value_type(); throw; }#endif return __f;}#if _LIBCPP_STD_VER > 14template <class _Tp>inline _LIBCPP_INLINE_VISIBILITYvoid destroy_at(_Tp* __loc) { _LIBCPP_ASSERT(__loc, "null pointer given to destroy_at"); __loc->~_Tp();}template <class _ForwardIterator>inline _LIBCPP_INLINE_VISIBILITYvoid destroy(_ForwardIterator __first, _ForwardIterator __last) { for (; __first != __last; ++__first) _VSTD::destroy_at(_VSTD::addressof(*__first));}template <class _ForwardIterator, class _Size>inline _LIBCPP_INLINE_VISIBILITY_ForwardIterator destroy_n(_ForwardIterator __first, _Size __n) { for (; __n > 0; (void)++__first, --__n) _VSTD::destroy_at(_VSTD::addressof(*__first)); return __first;}template <class _ForwardIterator>inline _LIBCPP_INLINE_VISIBILITYvoid uninitialized_default_construct(_ForwardIterator __first, _ForwardIterator __last) { using _Vt = typename iterator_traits<_ForwardIterator>::value_type; auto __idx = __first;#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif for (; __idx != __last; ++__idx) ::new((void*)_VSTD::addressof(*__idx)) _Vt;#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { _VSTD::destroy(__first, __idx); throw; }#endif}template <class _ForwardIterator, class _Size>inline _LIBCPP_INLINE_VISIBILITY_ForwardIterator uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) { using _Vt = typename iterator_traits<_ForwardIterator>::value_type; auto __idx = __first;#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif for (; __n > 0; (void)++__idx, --__n) ::new((void*)_VSTD::addressof(*__idx)) _Vt; return __idx;#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { _VSTD::destroy(__first, __idx); throw; }#endif}template <class _ForwardIterator>inline _LIBCPP_INLINE_VISIBILITYvoid uninitialized_value_construct(_ForwardIterator __first, _ForwardIterator __last) { using _Vt = typename iterator_traits<_ForwardIterator>::value_type; auto __idx = __first;#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif for (; __idx != __last; ++__idx) ::new((void*)_VSTD::addressof(*__idx)) _Vt();#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { _VSTD::destroy(__first, __idx); throw; }#endif}template <class _ForwardIterator, class _Size>inline _LIBCPP_INLINE_VISIBILITY_ForwardIterator uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) { using _Vt = typename iterator_traits<_ForwardIterator>::value_type; auto __idx = __first;#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif for (; __n > 0; (void)++__idx, --__n) ::new((void*)_VSTD::addressof(*__idx)) _Vt(); return __idx;#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { _VSTD::destroy(__first, __idx); throw; }#endif}template <class _InputIt, class _ForwardIt>inline _LIBCPP_INLINE_VISIBILITY_ForwardIt uninitialized_move(_InputIt __first, _InputIt __last, _ForwardIt __first_res) { using _Vt = typename iterator_traits<_ForwardIt>::value_type; auto __idx = __first_res;#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif for (; __first != __last; (void)++__idx, ++__first) ::new((void*)_VSTD::addressof(*__idx)) _Vt(std::move(*__first)); return __idx;#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { _VSTD::destroy(__first_res, __idx); throw; }#endif}template <class _InputIt, class _Size, class _ForwardIt>inline _LIBCPP_INLINE_VISIBILITYpair<_InputIt, _ForwardIt>uninitialized_move_n(_InputIt __first, _Size __n, _ForwardIt __first_res) { using _Vt = typename iterator_traits<_ForwardIt>::value_type; auto __idx = __first_res;#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif for (; __n > 0; ++__idx, (void)++__first, --__n) ::new((void*)_VSTD::addressof(*__idx)) _Vt(std::move(*__first)); return {__first, __idx};#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { _VSTD::destroy(__first_res, __idx); throw; }#endif}#endif // _LIBCPP_STD_VER > 14// NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively)// should be sufficient for thread safety.// See https://bugs.llvm.org/show_bug.cgi?id=22803#if defined(__clang__) && __has_builtin(__atomic_add_fetch) \ && defined(__ATOMIC_RELAXED) \ && defined(__ATOMIC_ACQ_REL)# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT#elif !defined(__clang__) && defined(_GNUC_VER) && _GNUC_VER >= 407# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT#endiftemplate <class _Tp>inline _LIBCPP_INLINE_VISIBILITY _Tp__libcpp_atomic_refcount_increment(_Tp& __t) _NOEXCEPT{#if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && !defined(_LIBCPP_HAS_NO_THREADS) return __atomic_add_fetch(&__t, 1, __ATOMIC_RELAXED);#else return __t += 1;#endif}template <class _Tp>inline _LIBCPP_INLINE_VISIBILITY _Tp__libcpp_atomic_refcount_decrement(_Tp& __t) _NOEXCEPT{#if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && !defined(_LIBCPP_HAS_NO_THREADS) return __atomic_add_fetch(&__t, -1, __ATOMIC_ACQ_REL);#else return __t -= 1;#endif}class _LIBCPP_EXCEPTION_ABI bad_weak_ptr : public std::exception{public: virtual ~bad_weak_ptr() _NOEXCEPT; virtual const char* what() const _NOEXCEPT;};_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINEvoid __throw_bad_weak_ptr(){#ifndef _LIBCPP_NO_EXCEPTIONS throw bad_weak_ptr();#else _VSTD::abort();#endif}template<class _Tp> class _LIBCPP_TEMPLATE_VIS weak_ptr;class _LIBCPP_TYPE_VIS __shared_count{ __shared_count(const __shared_count&); __shared_count& operator=(const __shared_count&);protected: long __shared_owners_; virtual ~__shared_count();private: virtual void __on_zero_shared() _NOEXCEPT = 0;public: _LIBCPP_INLINE_VISIBILITY explicit __shared_count(long __refs = 0) _NOEXCEPT : __shared_owners_(__refs) {}#if defined(_LIBCPP_BUILDING_MEMORY) && \ defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS) void __add_shared() _NOEXCEPT; bool __release_shared() _NOEXCEPT;#else _LIBCPP_INLINE_VISIBILITY void __add_shared() _NOEXCEPT { __libcpp_atomic_refcount_increment(__shared_owners_); } _LIBCPP_INLINE_VISIBILITY bool __release_shared() _NOEXCEPT { if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1) { __on_zero_shared(); return true; } return false; }#endif _LIBCPP_INLINE_VISIBILITY long use_count() const _NOEXCEPT { return __libcpp_relaxed_load(&__shared_owners_) + 1; }};class _LIBCPP_TYPE_VIS __shared_weak_count : private __shared_count{ long __shared_weak_owners_;public: _LIBCPP_INLINE_VISIBILITY explicit __shared_weak_count(long __refs = 0) _NOEXCEPT : __shared_count(__refs), __shared_weak_owners_(__refs) {}protected: virtual ~__shared_weak_count();public:#if defined(_LIBCPP_BUILDING_MEMORY) && \ defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS) void __add_shared() _NOEXCEPT; void __add_weak() _NOEXCEPT; void __release_shared() _NOEXCEPT;#else _LIBCPP_INLINE_VISIBILITY void __add_shared() _NOEXCEPT { __shared_count::__add_shared(); } _LIBCPP_INLINE_VISIBILITY void __add_weak() _NOEXCEPT { __libcpp_atomic_refcount_increment(__shared_weak_owners_); } _LIBCPP_INLINE_VISIBILITY void __release_shared() _NOEXCEPT { if (__shared_count::__release_shared()) __release_weak(); }#endif void __release_weak() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY long use_count() const _NOEXCEPT {return __shared_count::use_count();} __shared_weak_count* lock() _NOEXCEPT; // Define the function out only if we build static libc++ without RTTI. // Otherwise we may break clients who need to compile their projects with // -fno-rtti and yet link against a libc++.dylib compiled // without -fno-rtti.#if !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC) virtual const void* __get_deleter(const type_info&) const _NOEXCEPT;#endifprivate: virtual void __on_zero_shared_weak() _NOEXCEPT = 0;};template <class _Tp, class _Dp, class _Alloc>class __shared_ptr_pointer : public __shared_weak_count{ __compressed_pair<__compressed_pair<_Tp, _Dp>, _Alloc> __data_;public: _LIBCPP_INLINE_VISIBILITY __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a) : __data_(__compressed_pair<_Tp, _Dp>(__p, _VSTD::move(__d)), _VSTD::move(__a)) {}#ifndef _LIBCPP_NO_RTTI virtual const void* __get_deleter(const type_info&) const _NOEXCEPT;#endifprivate: virtual void __on_zero_shared() _NOEXCEPT; virtual void __on_zero_shared_weak() _NOEXCEPT;};#ifndef _LIBCPP_NO_RTTItemplate <class _Tp, class _Dp, class _Alloc>const void*__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT{ return __t == typeid(_Dp) ? _VSTD::addressof(__data_.first().second()) : nullptr;}#endif // _LIBCPP_NO_RTTItemplate <class _Tp, class _Dp, class _Alloc>void__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared() _NOEXCEPT{ __data_.first().second()(__data_.first().first()); __data_.first().second().~_Dp();}template <class _Tp, class _Dp, class _Alloc>void__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT{ typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_pointer>::type _Al; typedef allocator_traits<_Al> _ATraits; typedef pointer_traits<typename _ATraits::pointer> _PTraits; _Al __a(__data_.second()); __data_.second().~_Alloc(); __a.deallocate(_PTraits::pointer_to(*this), 1);}template <class _Tp, class _Alloc>class __shared_ptr_emplace : public __shared_weak_count{ __compressed_pair<_Alloc, _Tp> __data_;public:#ifndef _LIBCPP_HAS_NO_VARIADICS _LIBCPP_INLINE_VISIBILITY __shared_ptr_emplace(_Alloc __a) : __data_(_VSTD::move(__a)) {} template <class ..._Args> _LIBCPP_INLINE_VISIBILITY __shared_ptr_emplace(_Alloc __a, _Args&& ...__args) : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a), _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)) {}#else // _LIBCPP_HAS_NO_VARIADICS _LIBCPP_INLINE_VISIBILITY __shared_ptr_emplace(_Alloc __a) : __data_(__a) {} template <class _A0> _LIBCPP_INLINE_VISIBILITY __shared_ptr_emplace(_Alloc __a, _A0& __a0) : __data_(__a, _Tp(__a0)) {} template <class _A0, class _A1> _LIBCPP_INLINE_VISIBILITY __shared_ptr_emplace(_Alloc __a, _A0& __a0, _A1& __a1) : __data_(__a, _Tp(__a0, __a1)) {} template <class _A0, class _A1, class _A2> _LIBCPP_INLINE_VISIBILITY __shared_ptr_emplace(_Alloc __a, _A0& __a0, _A1& __a1, _A2& __a2) : __data_(__a, _Tp(__a0, __a1, __a2)) {}#endif // _LIBCPP_HAS_NO_VARIADICSprivate: virtual void __on_zero_shared() _NOEXCEPT; virtual void __on_zero_shared_weak() _NOEXCEPT;public: _LIBCPP_INLINE_VISIBILITY _Tp* get() _NOEXCEPT {return &__data_.second();}};template <class _Tp, class _Alloc>void__shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared() _NOEXCEPT{ __data_.second().~_Tp();}template <class _Tp, class _Alloc>void__shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT{ typedef typename __allocator_traits_rebind<_Alloc, __shared_ptr_emplace>::type _Al; typedef allocator_traits<_Al> _ATraits; typedef pointer_traits<typename _ATraits::pointer> _PTraits; _Al __a(__data_.first()); __data_.first().~_Alloc(); __a.deallocate(_PTraits::pointer_to(*this), 1);}struct __shared_ptr_dummy_rebind_allocator_type;template <>class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type>{public: template <class _Other> struct rebind { typedef allocator<_Other> other; };};template<class _Tp> class _LIBCPP_TEMPLATE_VIS enable_shared_from_this;template<class _Tp>class _LIBCPP_TEMPLATE_VIS shared_ptr{public: typedef _Tp element_type;#if _LIBCPP_STD_VER > 14 typedef weak_ptr<_Tp> weak_type;#endifprivate: element_type* __ptr_; __shared_weak_count* __cntrl_; struct __nat {int __for_bool_;};public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT; template<class _Yp> explicit shared_ptr(_Yp* __p, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat()); template<class _Yp, class _Dp> shared_ptr(_Yp* __p, _Dp __d, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat()); template<class _Yp, class _Dp, class _Alloc> shared_ptr(_Yp* __p, _Dp __d, _Alloc __a, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat()); template <class _Dp> shared_ptr(nullptr_t __p, _Dp __d); template <class _Dp, class _Alloc> shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a); template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY shared_ptr(const shared_ptr& __r) _NOEXCEPT; template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(const shared_ptr<_Yp>& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat()) _NOEXCEPT;#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY shared_ptr(shared_ptr&& __r) _NOEXCEPT; template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(shared_ptr<_Yp>&& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat()) _NOEXCEPT;#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template<class _Yp> explicit shared_ptr(const weak_ptr<_Yp>& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type= __nat());#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template<class _Yp> shared_ptr(auto_ptr<_Yp>&& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());#else template<class _Yp> shared_ptr(auto_ptr<_Yp> __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());#endif#endif#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _Yp, class _Dp> shared_ptr(unique_ptr<_Yp, _Dp>&&, typename enable_if < !is_lvalue_reference<_Dp>::value && !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, __nat >::type = __nat()); template <class _Yp, class _Dp> shared_ptr(unique_ptr<_Yp, _Dp>&&, typename enable_if < is_lvalue_reference<_Dp>::value && !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, __nat >::type = __nat());#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _Yp, class _Dp> shared_ptr(unique_ptr<_Yp, _Dp>, typename enable_if < !is_lvalue_reference<_Dp>::value && !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, __nat >::type = __nat()); template <class _Yp, class _Dp> shared_ptr(unique_ptr<_Yp, _Dp>, typename enable_if < is_lvalue_reference<_Dp>::value && !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, __nat >::type = __nat());#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES ~shared_ptr(); _LIBCPP_INLINE_VISIBILITY shared_ptr& operator=(const shared_ptr& __r) _NOEXCEPT; template<class _Yp> typename enable_if < is_convertible<_Yp*, element_type*>::value, shared_ptr& >::type _LIBCPP_INLINE_VISIBILITY operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT;#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY shared_ptr& operator=(shared_ptr&& __r) _NOEXCEPT; template<class _Yp> typename enable_if < is_convertible<_Yp*, element_type*>::value, shared_ptr<_Tp>& >::type _LIBCPP_INLINE_VISIBILITY operator=(shared_ptr<_Yp>&& __r);#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) template<class _Yp> _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_array<_Yp>::value && is_convertible<_Yp*, element_type*>::value, shared_ptr >::type& operator=(auto_ptr<_Yp>&& __r);#endif#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) template<class _Yp> _LIBCPP_INLINE_VISIBILITY typename enable_if < !is_array<_Yp>::value && is_convertible<_Yp*, element_type*>::value, shared_ptr& >::type operator=(auto_ptr<_Yp> __r);#endif#endif template <class _Yp, class _Dp> typename enable_if < !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, shared_ptr& >::type#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY operator=(unique_ptr<_Yp, _Dp>&& __r);#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY operator=(unique_ptr<_Yp, _Dp> __r);#endif _LIBCPP_INLINE_VISIBILITY void swap(shared_ptr& __r) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY void reset() _NOEXCEPT; template<class _Yp> typename enable_if < is_convertible<_Yp*, element_type*>::value, void >::type _LIBCPP_INLINE_VISIBILITY reset(_Yp* __p); template<class _Yp, class _Dp> typename enable_if < is_convertible<_Yp*, element_type*>::value, void >::type _LIBCPP_INLINE_VISIBILITY reset(_Yp* __p, _Dp __d); template<class _Yp, class _Dp, class _Alloc> typename enable_if < is_convertible<_Yp*, element_type*>::value, void >::type _LIBCPP_INLINE_VISIBILITY reset(_Yp* __p, _Dp __d, _Alloc __a); _LIBCPP_INLINE_VISIBILITY element_type* get() const _NOEXCEPT {return __ptr_;} _LIBCPP_INLINE_VISIBILITY typename add_lvalue_reference<element_type>::type operator*() const _NOEXCEPT {return *__ptr_;} _LIBCPP_INLINE_VISIBILITY element_type* operator->() const _NOEXCEPT {return __ptr_;} _LIBCPP_INLINE_VISIBILITY long use_count() const _NOEXCEPT {return __cntrl_ ? __cntrl_->use_count() : 0;} _LIBCPP_INLINE_VISIBILITY bool unique() const _NOEXCEPT {return use_count() == 1;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != 0;} template <class _Up> _LIBCPP_INLINE_VISIBILITY bool owner_before(shared_ptr<_Up> const& __p) const _NOEXCEPT {return __cntrl_ < __p.__cntrl_;} template <class _Up> _LIBCPP_INLINE_VISIBILITY bool owner_before(weak_ptr<_Up> const& __p) const _NOEXCEPT {return __cntrl_ < __p.__cntrl_;} _LIBCPP_INLINE_VISIBILITY bool __owner_equivalent(const shared_ptr& __p) const {return __cntrl_ == __p.__cntrl_;}#ifndef _LIBCPP_NO_RTTI template <class _Dp> _LIBCPP_INLINE_VISIBILITY _Dp* __get_deleter() const _NOEXCEPT {return static_cast<_Dp*>(__cntrl_ ? const_cast<void *>(__cntrl_->__get_deleter(typeid(_Dp))) : nullptr);}#endif // _LIBCPP_NO_RTTI#ifndef _LIBCPP_HAS_NO_VARIADICS template<class ..._Args> static shared_ptr<_Tp> make_shared(_Args&& ...__args); template<class _Alloc, class ..._Args> static shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&& ...__args);#else // _LIBCPP_HAS_NO_VARIADICS static shared_ptr<_Tp> make_shared(); template<class _A0> static shared_ptr<_Tp> make_shared(_A0&); template<class _A0, class _A1> static shared_ptr<_Tp> make_shared(_A0&, _A1&); template<class _A0, class _A1, class _A2> static shared_ptr<_Tp> make_shared(_A0&, _A1&, _A2&); template<class _Alloc> static shared_ptr<_Tp> allocate_shared(const _Alloc& __a); template<class _Alloc, class _A0> static shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _A0& __a0); template<class _Alloc, class _A0, class _A1> static shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1); template<class _Alloc, class _A0, class _A1, class _A2> static shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2);#endif // _LIBCPP_HAS_NO_VARIADICSprivate: template <class _Yp, bool = is_function<_Yp>::value> struct __shared_ptr_default_allocator { typedef allocator<_Yp> type; }; template <class _Yp> struct __shared_ptr_default_allocator<_Yp, true> { typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type; }; template <class _Yp, class _OrigPtr> _LIBCPP_INLINE_VISIBILITY typename enable_if<is_convertible<_OrigPtr*, const enable_shared_from_this<_Yp>* >::value, void>::type __enable_weak_this(const enable_shared_from_this<_Yp>* __e, _OrigPtr* __ptr) _NOEXCEPT { typedef typename remove_cv<_Yp>::type _RawYp; if (__e && __e->__weak_this_.expired()) { __e->__weak_this_ = shared_ptr<_RawYp>(*this, const_cast<_RawYp*>(static_cast<const _Yp*>(__ptr))); } } _LIBCPP_INLINE_VISIBILITY void __enable_weak_this(...) _NOEXCEPT {} template <class _Up> friend class _LIBCPP_TEMPLATE_VIS shared_ptr; template <class _Up> friend class _LIBCPP_TEMPLATE_VIS weak_ptr;};template<class _Tp>inline_LIBCPP_CONSTEXPRshared_ptr<_Tp>::shared_ptr() _NOEXCEPT : __ptr_(0), __cntrl_(0){}template<class _Tp>inline_LIBCPP_CONSTEXPRshared_ptr<_Tp>::shared_ptr(nullptr_t) _NOEXCEPT : __ptr_(0), __cntrl_(0){}template<class _Tp>template<class _Yp>shared_ptr<_Tp>::shared_ptr(_Yp* __p, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) : __ptr_(__p){ unique_ptr<_Yp> __hold(__p); typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, _AllocT > _CntrlBlk; __cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), _AllocT()); __hold.release(); __enable_weak_this(__p, __p);}template<class _Tp>template<class _Yp, class _Dp>shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) : __ptr_(__p){#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif // _LIBCPP_NO_EXCEPTIONS typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk; __cntrl_ = new _CntrlBlk(__p, __d, _AllocT()); __enable_weak_this(__p, __p);#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { __d(__p); throw; }#endif // _LIBCPP_NO_EXCEPTIONS}template<class _Tp>template<class _Dp>shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d) : __ptr_(0){#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif // _LIBCPP_NO_EXCEPTIONS typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT; typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT > _CntrlBlk; __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { __d(__p); throw; }#endif // _LIBCPP_NO_EXCEPTIONS}template<class _Tp>template<class _Yp, class _Dp, class _Alloc>shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, _Alloc __a, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) : __ptr_(__p){#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif // _LIBCPP_NO_EXCEPTIONS typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2; typedef __allocator_destructor<_A2> _D2; _A2 __a2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get()))) _CntrlBlk(__p, __d, __a); __cntrl_ = _VSTD::addressof(*__hold2.release()); __enable_weak_this(__p, __p);#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { __d(__p); throw; }#endif // _LIBCPP_NO_EXCEPTIONS}template<class _Tp>template<class _Dp, class _Alloc>shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a) : __ptr_(0){#ifndef _LIBCPP_NO_EXCEPTIONS try {#endif // _LIBCPP_NO_EXCEPTIONS typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2; typedef __allocator_destructor<_A2> _D2; _A2 __a2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get()))) _CntrlBlk(__p, __d, __a); __cntrl_ = _VSTD::addressof(*__hold2.release());#ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { __d(__p); throw; }#endif // _LIBCPP_NO_EXCEPTIONS}template<class _Tp>template<class _Yp>inlineshared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r, element_type *__p) _NOEXCEPT : __ptr_(__p), __cntrl_(__r.__cntrl_){ if (__cntrl_) __cntrl_->__add_shared();}template<class _Tp>inlineshared_ptr<_Tp>::shared_ptr(const shared_ptr& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_){ if (__cntrl_) __cntrl_->__add_shared();}template<class _Tp>template<class _Yp>inlineshared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_){ if (__cntrl_) __cntrl_->__add_shared();}#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCEStemplate<class _Tp>inlineshared_ptr<_Tp>::shared_ptr(shared_ptr&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_){ __r.__ptr_ = 0; __r.__cntrl_ = 0;}template<class _Tp>template<class _Yp>inlineshared_ptr<_Tp>::shared_ptr(shared_ptr<_Yp>&& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_){ __r.__ptr_ = 0; __r.__cntrl_ = 0;}#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)template<class _Tp>template<class _Yp>#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCESshared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp>&& __r,#elseshared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp> __r,#endif typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) : __ptr_(__r.get()){ typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk; __cntrl_ = new _CntrlBlk(__r.get(), default_delete<_Yp>(), allocator<_Yp>()); __enable_weak_this(__r.get(), __r.get()); __r.release();}#endiftemplate<class _Tp>template <class _Yp, class _Dp>#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCESshared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r,#elseshared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,#endif typename enable_if < !is_lvalue_reference<_Dp>::value && !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, __nat >::type) : __ptr_(__r.get()){#if _LIBCPP_STD_VER > 11 if (__ptr_ == nullptr) __cntrl_ = nullptr; else#endif { typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk; __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), _AllocT()); __enable_weak_this(__r.get(), __r.get()); } __r.release();}template<class _Tp>template <class _Yp, class _Dp>#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCESshared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r,#elseshared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,#endif typename enable_if < is_lvalue_reference<_Dp>::value && !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value, __nat >::type) : __ptr_(__r.get()){#if _LIBCPP_STD_VER > 11 if (__ptr_ == nullptr) __cntrl_ = nullptr; else#endif { typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; typedef __shared_ptr_pointer<_Yp*, reference_wrapper<typename remove_reference<_Dp>::type>, _AllocT > _CntrlBlk; __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), _AllocT()); __enable_weak_this(__r.get(), __r.get()); } __r.release();}#ifndef _LIBCPP_HAS_NO_VARIADICStemplate<class _Tp>template<class ..._Args>shared_ptr<_Tp>shared_ptr<_Tp>::make_shared(_Args&& ...__args){ typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; typedef allocator<_CntrlBlk> _A2; typedef __allocator_destructor<_A2> _D2; _A2 __a2; unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...); shared_ptr<_Tp> __r; __r.__ptr_ = __hold2.get()->get(); __r.__cntrl_ = __hold2.release(); __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); return __r;}template<class _Tp>template<class _Alloc, class ..._Args>shared_ptr<_Tp>shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args){ typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2; typedef __allocator_destructor<_A2> _D2; _A2 __a2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get()))) _CntrlBlk(__a, _VSTD::forward<_Args>(__args)...); shared_ptr<_Tp> __r; __r.__ptr_ = __hold2.get()->get(); __r.__cntrl_ = _VSTD::addressof(*__hold2.release()); __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); return __r;}#else // _LIBCPP_HAS_NO_VARIADICStemplate<class _Tp>shared_ptr<_Tp>shared_ptr<_Tp>::make_shared(){ typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; typedef allocator<_CntrlBlk> _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; _Alloc2 __alloc2; unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); ::new(__hold2.get()) _CntrlBlk(__alloc2); shared_ptr<_Tp> __r; __r.__ptr_ = __hold2.get()->get(); __r.__cntrl_ = __hold2.release(); __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); return __r;}template<class _Tp>template<class _A0>shared_ptr<_Tp>shared_ptr<_Tp>::make_shared(_A0& __a0){ typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; typedef allocator<_CntrlBlk> _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; _Alloc2 __alloc2; unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0); shared_ptr<_Tp> __r; __r.__ptr_ = __hold2.get()->get(); __r.__cntrl_ = __hold2.release(); __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); return __r;}template<class _Tp>template<class _A0, class _A1>shared_ptr<_Tp>shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1){ typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; typedef allocator<_CntrlBlk> _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; _Alloc2 __alloc2; unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0, __a1); shared_ptr<_Tp> __r; __r.__ptr_ = __hold2.get()->get(); __r.__cntrl_ = __hold2.release(); __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); return __r;}template<class _Tp>template<class _A0, class _A1, class _A2>shared_ptr<_Tp>shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1, _A2& __a2){ typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk; typedef allocator<_CntrlBlk> _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; _Alloc2 __alloc2; unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0, __a1, __a2); shared_ptr<_Tp> __r; __r.__ptr_ = __hold2.get()->get(); __r.__cntrl_ = __hold2.release(); __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); return __r;}template<class _Tp>template<class _Alloc>shared_ptr<_Tp>shared_ptr<_Tp>::allocate_shared(const _Alloc& __a){ typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; _Alloc2 __alloc2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get()))) _CntrlBlk(__a); shared_ptr<_Tp> __r; __r.__ptr_ = __hold2.get()->get(); __r.__cntrl_ = _VSTD::addressof(*__hold2.release()); __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); return __r;}template<class _Tp>template<class _Alloc, class _A0>shared_ptr<_Tp>shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0){ typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; _Alloc2 __alloc2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get()))) _CntrlBlk(__a, __a0); shared_ptr<_Tp> __r; __r.__ptr_ = __hold2.get()->get(); __r.__cntrl_ = _VSTD::addressof(*__hold2.release()); __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); return __r;}template<class _Tp>template<class _Alloc, class _A0, class _A1>shared_ptr<_Tp>shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1){ typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; _Alloc2 __alloc2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get()))) _CntrlBlk(__a, __a0, __a1); shared_ptr<_Tp> __r; __r.__ptr_ = __hold2.get()->get(); __r.__cntrl_ = _VSTD::addressof(*__hold2.release()); __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); return __r;}template<class _Tp>template<class _Alloc, class _A0, class _A1, class _A2>shared_ptr<_Tp>shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2){ typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2; typedef __allocator_destructor<_Alloc2> _D2; _Alloc2 __alloc2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1)); ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get()))) _CntrlBlk(__a, __a0, __a1, __a2); shared_ptr<_Tp> __r; __r.__ptr_ = __hold2.get()->get(); __r.__cntrl_ = _VSTD::addressof(*__hold2.release()); __r.__enable_weak_this(__r.__ptr_, __r.__ptr_); return __r;}#endif // _LIBCPP_HAS_NO_VARIADICStemplate<class _Tp>shared_ptr<_Tp>::~shared_ptr(){ if (__cntrl_) __cntrl_->__release_shared();}template<class _Tp>inlineshared_ptr<_Tp>&shared_ptr<_Tp>::operator=(const shared_ptr& __r) _NOEXCEPT{ shared_ptr(__r).swap(*this); return *this;}template<class _Tp>template<class _Yp>inlinetypename enable_if< is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, shared_ptr<_Tp>&>::typeshared_ptr<_Tp>::operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT{ shared_ptr(__r).swap(*this); return *this;}#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCEStemplate<class _Tp>inlineshared_ptr<_Tp>&shared_ptr<_Tp>::operator=(shared_ptr&& __r) _NOEXCEPT{ shared_ptr(_VSTD::move(__r)).swap(*this); return *this;}template<class _Tp>template<class _Yp>inlinetypename enable_if< is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, shared_ptr<_Tp>&>::typeshared_ptr<_Tp>::operator=(shared_ptr<_Yp>&& __r){ shared_ptr(_VSTD::move(__r)).swap(*this); return *this;}#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)template<class _Tp>template<class _Yp>inlinetypename enable_if< !is_array<_Yp>::value && is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, shared_ptr<_Tp>>::type&shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r){ shared_ptr(_VSTD::move(__r)).swap(*this); return *this;}#endiftemplate<class _Tp>template <class _Yp, class _Dp>inlinetypename enable_if< !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, typename shared_ptr<_Tp>::element_type*>::value, shared_ptr<_Tp>&>::typeshared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp>&& __r){ shared_ptr(_VSTD::move(__r)).swap(*this); return *this;}#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)template<class _Tp>template<class _Yp>inline _LIBCPP_INLINE_VISIBILITYtypename enable_if< !is_array<_Yp>::value && is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, shared_ptr<_Tp>&>::typeshared_ptr<_Tp>::operator=(auto_ptr<_Yp> __r){ shared_ptr(__r).swap(*this); return *this;}#endiftemplate<class _Tp>template <class _Yp, class _Dp>inline _LIBCPP_INLINE_VISIBILITYtypename enable_if< !is_array<_Yp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, typename shared_ptr<_Tp>::element_type*>::value, shared_ptr<_Tp>&>::typeshared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp> __r){ shared_ptr(_VSTD::move(__r)).swap(*this); return *this;}#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCEStemplate<class _Tp>inlinevoidshared_ptr<_Tp>::swap(shared_ptr& __r) _NOEXCEPT{ _VSTD::swap(__ptr_, __r.__ptr_); _VSTD::swap(__cntrl_, __r.__cntrl_);}template<class _Tp>inlinevoidshared_ptr<_Tp>::reset() _NOEXCEPT{ shared_ptr().swap(*this);}template<class _Tp>template<class _Yp>inlinetypename enable_if< is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, void>::typeshared_ptr<_Tp>::reset(_Yp* __p){ shared_ptr(__p).swap(*this);}template<class _Tp>template<class _Yp, class _Dp>inlinetypename enable_if< is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, void>::typeshared_ptr<_Tp>::reset(_Yp* __p, _Dp __d){ shared_ptr(__p, __d).swap(*this);}template<class _Tp>template<class _Yp, class _Dp, class _Alloc>inlinetypename enable_if< is_convertible<_Yp*, typename shared_ptr<_Tp>::element_type*>::value, void>::typeshared_ptr<_Tp>::reset(_Yp* __p, _Dp __d, _Alloc __a){ shared_ptr(__p, __d, __a).swap(*this);}#ifndef _LIBCPP_HAS_NO_VARIADICStemplate<class _Tp, class ..._Args>inline _LIBCPP_INLINE_VISIBILITYtypename enable_if< !is_array<_Tp>::value, shared_ptr<_Tp>>::typemake_shared(_Args&& ...__args){ return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);}template<class _Tp, class _Alloc, class ..._Args>inline _LIBCPP_INLINE_VISIBILITYtypename enable_if< !is_array<_Tp>::value, shared_ptr<_Tp>>::typeallocate_shared(const _Alloc& __a, _Args&& ...__args){ return shared_ptr<_Tp>::allocate_shared(__a, _VSTD::forward<_Args>(__args)...);}#else // _LIBCPP_HAS_NO_VARIADICStemplate<class _Tp>inline _LIBCPP_INLINE_VISIBILITYshared_ptr<_Tp>make_shared(){ return shared_ptr<_Tp>::make_shared();}template<class _Tp, class _A0>inline _LIBCPP_INLINE_VISIBILITYshared_ptr<_Tp>make_shared(_A0& __a0){ return shared_ptr<_Tp>::make_shared(__a0);}template<class _Tp, class _A0, class _A1>inline _LIBCPP_INLINE_VISIBILITYshared_ptr<_Tp>make_shared(_A0& __a0, _A1& __a1){ return shared_ptr<_Tp>::make_shared(__a0, __a1);}template<class _Tp, class _A0, class _A1, class _A2>inline _LIBCPP_INLINE_VISIBILITYshared_ptr<_Tp>make_shared(_A0& __a0, _A1& __a1, _A2& __a2){ return shared_ptr<_Tp>::make_shared(__a0, __a1, __a2);}template<class _Tp, class _Alloc>inline _LIBCPP_INLINE_VISIBILITYshared_ptr<_Tp>allocate_shared(const _Alloc& __a){ return shared_ptr<_Tp>::allocate_shared(__a);}template<class _Tp, class _Alloc, class _A0>inline _LIBCPP_INLINE_VISIBILITYshared_ptr<_Tp>allocate_shared(const _Alloc& __a, _A0& __a0){ return shared_ptr<_Tp>::allocate_shared(__a, __a0);}template<class _Tp, class _Alloc, class _A0, class _A1>inline _LIBCPP_INLINE_VISIBILITYshared_ptr<_Tp>allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1){ return shared_ptr<_Tp>::allocate_shared(__a, __a0, __a1);}template<class _Tp, class _Alloc, class _A0, class _A1, class _A2>inline _LIBCPP_INLINE_VISIBILITYshared_ptr<_Tp>allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2){ return shared_ptr<_Tp>::allocate_shared(__a, __a0, __a1, __a2);}#endif // _LIBCPP_HAS_NO_VARIADICStemplate<class _Tp, class _Up>inline _LIBCPP_INLINE_VISIBILITYbooloperator==(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT{ return __x.get() == __y.get();}template<class _Tp, class _Up>inline _LIBCPP_INLINE_VISIBILITYbooloperator!=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT{ return !(__x == __y);}template<class _Tp, class _Up>inline _LIBCPP_INLINE_VISIBILITYbooloperator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT{ typedef typename common_type<_Tp*, _Up*>::type _Vp; return less<_Vp>()(__x.get(), __y.get());}template<class _Tp, class _Up>inline _LIBCPP_INLINE_VISIBILITYbooloperator>(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT{ return __y < __x;}template<class _Tp, class _Up>inline _LIBCPP_INLINE_VISIBILITYbooloperator<=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT{ return !(__y < __x);}template<class _Tp, class _Up>inline _LIBCPP_INLINE_VISIBILITYbooloperator>=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT{ return !(__x < __y);}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYbooloperator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT{ return !__x;}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYbooloperator==(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT{ return !__x;}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYbooloperator!=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT{ return static_cast<bool>(__x);}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYbooloperator!=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT{ return static_cast<bool>(__x);}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYbooloperator<(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT{ return less<_Tp*>()(__x.get(), nullptr);}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYbooloperator<(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT{ return less<_Tp*>()(nullptr, __x.get());}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYbooloperator>(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT{ return nullptr < __x;}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYbooloperator>(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT{ return __x < nullptr;}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYbooloperator<=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT{ return !(nullptr < __x);}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYbooloperator<=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT{ return !(__x < nullptr);}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYbooloperator>=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT{ return !(__x < nullptr);}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYbooloperator>=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT{ return !(nullptr < __x);}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYvoidswap(shared_ptr<_Tp>& __x, shared_ptr<_Tp>& __y) _NOEXCEPT{ __x.swap(__y);}template<class _Tp, class _Up>inline _LIBCPP_INLINE_VISIBILITYtypename enable_if< !is_array<_Tp>::value && !is_array<_Up>::value, shared_ptr<_Tp>>::typestatic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT{ return shared_ptr<_Tp>(__r, static_cast<_Tp*>(__r.get()));}template<class _Tp, class _Up>inline _LIBCPP_INLINE_VISIBILITYtypename enable_if< !is_array<_Tp>::value && !is_array<_Up>::value, shared_ptr<_Tp>>::typedynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT{ _Tp* __p = dynamic_cast<_Tp*>(__r.get()); return __p ? shared_ptr<_Tp>(__r, __p) : shared_ptr<_Tp>();}template<class _Tp, class _Up>typename enable_if< is_array<_Tp>::value == is_array<_Up>::value, shared_ptr<_Tp>>::typeconst_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT{ typedef typename remove_extent<_Tp>::type _RTp; return shared_ptr<_Tp>(__r, const_cast<_RTp*>(__r.get()));}#ifndef _LIBCPP_NO_RTTItemplate<class _Dp, class _Tp>inline _LIBCPP_INLINE_VISIBILITY_Dp*get_deleter(const shared_ptr<_Tp>& __p) _NOEXCEPT{ return __p.template __get_deleter<_Dp>();}#endif // _LIBCPP_NO_RTTItemplate<class _Tp>class _LIBCPP_TEMPLATE_VIS weak_ptr{public: typedef _Tp element_type;private: element_type* __ptr_; __shared_weak_count* __cntrl_;public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT; template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(shared_ptr<_Yp> const& __r, typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr const& __r) _NOEXCEPT; template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp> const& __r, typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0) _NOEXCEPT;#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr&& __r) _NOEXCEPT; template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp>&& __r, typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0) _NOEXCEPT;#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES ~weak_ptr(); _LIBCPP_INLINE_VISIBILITY weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT; template<class _Yp> typename enable_if < is_convertible<_Yp*, element_type*>::value, weak_ptr& >::type _LIBCPP_INLINE_VISIBILITY operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT; template<class _Yp> typename enable_if < is_convertible<_Yp*, element_type*>::value, weak_ptr& >::type _LIBCPP_INLINE_VISIBILITY operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template<class _Yp> typename enable_if < is_convertible<_Yp*, element_type*>::value, weak_ptr& >::type _LIBCPP_INLINE_VISIBILITY operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY void swap(weak_ptr& __r) _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY void reset() _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY long use_count() const _NOEXCEPT {return __cntrl_ ? __cntrl_->use_count() : 0;} _LIBCPP_INLINE_VISIBILITY bool expired() const _NOEXCEPT {return __cntrl_ == 0 || __cntrl_->use_count() == 0;} shared_ptr<_Tp> lock() const _NOEXCEPT; template<class _Up> _LIBCPP_INLINE_VISIBILITY bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT {return __cntrl_ < __r.__cntrl_;} template<class _Up> _LIBCPP_INLINE_VISIBILITY bool owner_before(const weak_ptr<_Up>& __r) const _NOEXCEPT {return __cntrl_ < __r.__cntrl_;} template <class _Up> friend class _LIBCPP_TEMPLATE_VIS weak_ptr; template <class _Up> friend class _LIBCPP_TEMPLATE_VIS shared_ptr;};template<class _Tp>inline_LIBCPP_CONSTEXPRweak_ptr<_Tp>::weak_ptr() _NOEXCEPT : __ptr_(0), __cntrl_(0){}template<class _Tp>inlineweak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_){ if (__cntrl_) __cntrl_->__add_weak();}template<class _Tp>template<class _Yp>inlineweak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r, typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_){ if (__cntrl_) __cntrl_->__add_weak();}template<class _Tp>template<class _Yp>inlineweak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r, typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_){ if (__cntrl_) __cntrl_->__add_weak();}#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCEStemplate<class _Tp>inlineweak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_){ __r.__ptr_ = 0; __r.__cntrl_ = 0;}template<class _Tp>template<class _Yp>inlineweak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r, typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_){ __r.__ptr_ = 0; __r.__cntrl_ = 0;}#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCEStemplate<class _Tp>weak_ptr<_Tp>::~weak_ptr(){ if (__cntrl_) __cntrl_->__release_weak();}template<class _Tp>inlineweak_ptr<_Tp>&weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT{ weak_ptr(__r).swap(*this); return *this;}template<class _Tp>template<class _Yp>inlinetypename enable_if< is_convertible<_Yp*, _Tp*>::value, weak_ptr<_Tp>&>::typeweak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT{ weak_ptr(__r).swap(*this); return *this;}#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCEStemplate<class _Tp>inlineweak_ptr<_Tp>&weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT{ weak_ptr(_VSTD::move(__r)).swap(*this); return *this;}template<class _Tp>template<class _Yp>inlinetypename enable_if< is_convertible<_Yp*, _Tp*>::value, weak_ptr<_Tp>&>::typeweak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT{ weak_ptr(_VSTD::move(__r)).swap(*this); return *this;}#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCEStemplate<class _Tp>template<class _Yp>inlinetypename enable_if< is_convertible<_Yp*, _Tp*>::value, weak_ptr<_Tp>&>::typeweak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT{ weak_ptr(__r).swap(*this); return *this;}template<class _Tp>inlinevoidweak_ptr<_Tp>::swap(weak_ptr& __r) _NOEXCEPT{ _VSTD::swap(__ptr_, __r.__ptr_); _VSTD::swap(__cntrl_, __r.__cntrl_);}template<class _Tp>inline _LIBCPP_INLINE_VISIBILITYvoidswap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT{ __x.swap(__y);}template<class _Tp>inlinevoidweak_ptr<_Tp>::reset() _NOEXCEPT{ weak_ptr().swap(*this);}template<class _Tp>template<class _Yp>shared_ptr<_Tp>::shared_ptr(const weak_ptr<_Yp>& __r, typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type) : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_){ if (__cntrl_ == 0) __throw_bad_weak_ptr();}template<class _Tp>shared_ptr<_Tp>weak_ptr<_Tp>::lock() const _NOEXCEPT{ shared_ptr<_Tp> __r; __r.__cntrl_ = __cntrl_ ? __cntrl_->lock() : __cntrl_; if (__r.__cntrl_) __r.__ptr_ = __ptr_; return __r;}#if _LIBCPP_STD_VER > 14template <class _Tp = void> struct owner_less;#elsetemplate <class _Tp> struct owner_less;#endiftemplate <class _Tp>struct _LIBCPP_TEMPLATE_VIS owner_less<shared_ptr<_Tp> > : binary_function<shared_ptr<_Tp>, shared_ptr<_Tp>, bool>{ typedef bool result_type; _LIBCPP_INLINE_VISIBILITY bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} _LIBCPP_INLINE_VISIBILITY bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} _LIBCPP_INLINE_VISIBILITY bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);}};template <class _Tp>struct _LIBCPP_TEMPLATE_VIS owner_less<weak_ptr<_Tp> > : binary_function<weak_ptr<_Tp>, weak_ptr<_Tp>, bool>{ typedef bool result_type; _LIBCPP_INLINE_VISIBILITY bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} _LIBCPP_INLINE_VISIBILITY bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} _LIBCPP_INLINE_VISIBILITY bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);}};#if _LIBCPP_STD_VER > 14template <>struct _LIBCPP_TEMPLATE_VIS owner_less<void>{ template <class _Tp, class _Up> _LIBCPP_INLINE_VISIBILITY bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} template <class _Tp, class _Up> _LIBCPP_INLINE_VISIBILITY bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} template <class _Tp, class _Up> _LIBCPP_INLINE_VISIBILITY bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} template <class _Tp, class _Up> _LIBCPP_INLINE_VISIBILITY bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} typedef void is_transparent;};#endiftemplate<class _Tp>class _LIBCPP_TEMPLATE_VIS enable_shared_from_this{ mutable weak_ptr<_Tp> __weak_this_;protected: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR enable_shared_from_this() _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY enable_shared_from_this(enable_shared_from_this const&) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY enable_shared_from_this& operator=(enable_shared_from_this const&) _NOEXCEPT {return *this;} _LIBCPP_INLINE_VISIBILITY ~enable_shared_from_this() {}public: _LIBCPP_INLINE_VISIBILITY shared_ptr<_Tp> shared_from_this() {return shared_ptr<_Tp>(__weak_this_);} _LIBCPP_INLINE_VISIBILITY shared_ptr<_Tp const> shared_from_this() const {return shared_ptr<const _Tp>(__weak_this_);}#if _LIBCPP_STD_VER > 14 _LIBCPP_INLINE_VISIBILITY weak_ptr<_Tp> weak_from_this() _NOEXCEPT { return __weak_this_; } _LIBCPP_INLINE_VISIBILITY weak_ptr<const _Tp> weak_from_this() const _NOEXCEPT { return __weak_this_; }#endif // _LIBCPP_STD_VER > 14 template <class _Up> friend class shared_ptr;};template <class _Tp>struct _LIBCPP_TEMPLATE_VIS hash<shared_ptr<_Tp> >{ typedef shared_ptr<_Tp> argument_type; typedef size_t result_type; _LIBCPP_INLINE_VISIBILITY result_type operator()(const argument_type& __ptr) const _NOEXCEPT { return hash<_Tp*>()(__ptr.get()); }};template<class _CharT, class _Traits, class _Yp>inline _LIBCPP_INLINE_VISIBILITYbasic_ostream<_CharT, _Traits>&operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)class _LIBCPP_TYPE_VIS __sp_mut{ void* __lx;public: void lock() _NOEXCEPT; void unlock() _NOEXCEPT;private: _LIBCPP_CONSTEXPR __sp_mut(void*) _NOEXCEPT; __sp_mut(const __sp_mut&); __sp_mut& operator=(const __sp_mut&); friend _LIBCPP_FUNC_VIS __sp_mut& __get_sp_mut(const void*);};_LIBCPP_FUNC_VIS _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR__sp_mut& __get_sp_mut(const void*);template <class _Tp>inline _LIBCPP_INLINE_VISIBILITYboolatomic_is_lock_free(const shared_ptr<_Tp>*){ return false;}template <class _Tp>_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTRshared_ptr<_Tp>atomic_load(const shared_ptr<_Tp>* __p){ __sp_mut& __m = __get_sp_mut(__p); __m.lock(); shared_ptr<_Tp> __q = *__p; __m.unlock(); return __q;} template <class _Tp>inline _LIBCPP_INLINE_VISIBILITY_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTRshared_ptr<_Tp>atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order){ return atomic_load(__p);}template <class _Tp>_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTRvoidatomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r){ __sp_mut& __m = __get_sp_mut(__p); __m.lock(); __p->swap(__r); __m.unlock();}template <class _Tp>inline _LIBCPP_INLINE_VISIBILITY_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTRvoidatomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order){ atomic_store(__p, __r);}template <class _Tp>_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTRshared_ptr<_Tp>atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r){ __sp_mut& __m = __get_sp_mut(__p); __m.lock(); __p->swap(__r); __m.unlock(); return __r;} template <class _Tp>inline _LIBCPP_INLINE_VISIBILITY_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTRshared_ptr<_Tp>atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order){ return atomic_exchange(__p, __r);}template <class _Tp>_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTRboolatomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w){ shared_ptr<_Tp> __temp; __sp_mut& __m = __get_sp_mut(__p); __m.lock(); if (__p->__owner_equivalent(*__v)) { _VSTD::swap(__temp, *__p); *__p = __w; __m.unlock(); return true; } _VSTD::swap(__temp, *__v); *__v = *__p; __m.unlock(); return false;}template <class _Tp>inline _LIBCPP_INLINE_VISIBILITY_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTRboolatomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w){ return atomic_compare_exchange_strong(__p, __v, __w);}template <class _Tp>inline _LIBCPP_INLINE_VISIBILITY_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTRboolatomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order){ return atomic_compare_exchange_strong(__p, __v, __w);}template <class _Tp>inline _LIBCPP_INLINE_VISIBILITY_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTRboolatomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order){ return atomic_compare_exchange_weak(__p, __v, __w);}#endif // !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)//enum class#if defined(_LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE)# ifndef _LIBCPP_CXX03_LANGenum class pointer_safety : unsigned char { relaxed, preferred, strict};# endif#elsestruct _LIBCPP_TYPE_VIS pointer_safety{ enum __lx { relaxed, preferred, strict }; __lx __v_; _LIBCPP_INLINE_VISIBILITY pointer_safety() : __v_() {} _LIBCPP_INLINE_VISIBILITY pointer_safety(__lx __v) : __v_(__v) {} _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}};#endif#if !defined(_LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE) && \ defined(_LIBCPP_BUILDING_MEMORY)_LIBCPP_FUNC_VIS pointer_safety get_pointer_safety() _NOEXCEPT;#else// This function is only offered in C++03 under ABI v1.# if !defined(_LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE) || !defined(_LIBCPP_CXX03_LANG)inline _LIBCPP_INLINE_VISIBILITYpointer_safety get_pointer_safety() _NOEXCEPT { return pointer_safety::relaxed;}# endif#endif_LIBCPP_FUNC_VIS void declare_reachable(void* __p);_LIBCPP_FUNC_VIS void declare_no_pointers(char* __p, size_t __n);_LIBCPP_FUNC_VIS void undeclare_no_pointers(char* __p, size_t __n);_LIBCPP_FUNC_VIS void* __undeclare_reachable(void* __p);template <class _Tp>inline _LIBCPP_INLINE_VISIBILITY_Tp*undeclare_reachable(_Tp* __p){ return static_cast<_Tp*>(__undeclare_reachable(__p));}_LIBCPP_FUNC_VIS void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space);// --- Helper for container swap --template <typename _Alloc>inline _LIBCPP_INLINE_VISIBILITYvoid __swap_allocator(_Alloc & __a1, _Alloc & __a2)#if _LIBCPP_STD_VER >= 14 _NOEXCEPT#else _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value)#endif{ __swap_allocator(__a1, __a2, integral_constant<bool, _VSTD::allocator_traits<_Alloc>::propagate_on_container_swap::value>());}template <typename _Alloc>_LIBCPP_INLINE_VISIBILITYvoid __swap_allocator(_Alloc & __a1, _Alloc & __a2, true_type)#if _LIBCPP_STD_VER >= 14 _NOEXCEPT#else _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value)#endif{ using _VSTD::swap; swap(__a1, __a2);}template <typename _Alloc>inline _LIBCPP_INLINE_VISIBILITYvoid __swap_allocator(_Alloc &, _Alloc &, false_type) _NOEXCEPT {}template <typename _Alloc, typename _Traits=allocator_traits<_Alloc> >struct __noexcept_move_assign_container : public integral_constant<bool, _Traits::propagate_on_container_move_assignment::value#if _LIBCPP_STD_VER > 14 || _Traits::is_always_equal::value#else && is_nothrow_move_assignable<_Alloc>::value#endif > {};#ifndef _LIBCPP_HAS_NO_VARIADICStemplate <class _Tp, class _Alloc>struct __temp_value { typedef allocator_traits<_Alloc> _Traits; typename aligned_storage<sizeof(_Tp), alignof(_Tp)>::type __v; _Alloc &__a; _Tp *__addr() { return reinterpret_cast<_Tp *>(addressof(__v)); } _Tp & get() { return *__addr(); } template<class... _Args> __temp_value(_Alloc &__alloc, _Args&& ... __args) : __a(__alloc) { _Traits::construct(__a, __addr(), _VSTD::forward<_Args>(__args)...); } ~__temp_value() { _Traits::destroy(__a, __addr()); } };#endif_LIBCPP_END_NAMESPACE_STD_LIBCPP_POP_MACROS#endif // _LIBCPP_MEMORY