123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531 |
- #ifndef BOOST_STATIC_STRING_STATIC_STRING_HPP
- #define BOOST_STATIC_STRING_STATIC_STRING_HPP
- #ifndef BOOST_STATIC_STRING_CONFIG_HPP
- #include <boost/static_string/config.hpp>
- #endif
- #include <algorithm>
- #include <cstdint>
- #include <cstdio>
- #include <cwchar>
- #include <functional>
- #include <initializer_list>
- #include <iosfwd>
- #include <type_traits>
- namespace boost {
- namespace static_strings {
- #ifndef BOOST_STATIC_STRING_DOCS
- template<std::size_t N, typename CharT, typename Traits>
- class basic_static_string;
- template<std::size_t N>
- using static_string =
- basic_static_string<N, char, std::char_traits<char>>;
- template<std::size_t N>
- using static_wstring =
- basic_static_string<N, wchar_t, std::char_traits<wchar_t>>;
- template<std::size_t N>
- using static_u16string =
- basic_static_string<N, char16_t, std::char_traits<char16_t>>;
- template<std::size_t N>
- using static_u32string =
- basic_static_string<N, char32_t, std::char_traits<char32_t>>;
- #ifdef BOOST_STATIC_STRING_CPP20
- template<std::size_t N>
- using static_u8string =
- basic_static_string<N, char8_t, std::char_traits<char8_t>>;
- #endif
- namespace detail {
- template<std::size_t N>
- using smallest_width =
- typename std::conditional<(N <= (std::numeric_limits<unsigned char>::max)()), unsigned char,
- typename std::conditional<(N <= (std::numeric_limits<unsigned short>::max)()), unsigned short,
- typename std::conditional<(N <= (std::numeric_limits<unsigned int>::max)()), unsigned int,
- typename std::conditional<(N <= (std::numeric_limits<unsigned long>::max)()), unsigned long,
- typename std::conditional<(N <= (std::numeric_limits<unsigned long long>::max)()), unsigned long long,
- std::size_t>::type>::type>::type>::type>::type;
- template<typename To>
- void is_nothrow_convertible_helper(To) noexcept;
- template<typename From, typename To, typename =
- decltype(is_nothrow_convertible_helper<To>(std::declval<From>()))>
- struct is_nothrow_convertible_msvc_helper
- {
- static const bool value =
- noexcept(is_nothrow_convertible_helper<To>(std::declval<From>()));
- };
- template<typename From, typename To, typename = void>
- struct is_nothrow_convertible
- : std::false_type { };
- template<typename From, typename To>
- struct is_nothrow_convertible<From, To, typename std::enable_if<
- is_nothrow_convertible_msvc_helper<From, To>::value>::type>
- : std::true_type { };
- template<typename...>
- struct void_t_helper
- {
- using type = void;
- };
- template<typename... Ts>
- using void_t = typename void_t_helper<Ts...>::type;
- template<typename T, typename CharT, typename Traits, typename = void>
- struct enable_if_viewable { };
- template<typename T, typename CharT, typename Traits>
- struct enable_if_viewable<T, CharT, Traits,
- typename std::enable_if<
- std::is_convertible<const T&, basic_string_view<CharT, Traits>>::value &&
- !std::is_convertible<const T&, const CharT*>::value>::type>
- {
- using type = void;
- };
- template<typename T, typename CharT, typename Traits>
- using enable_if_viewable_t = typename enable_if_viewable<T, CharT, Traits>::type;
- template<typename T, typename = void>
- struct is_iterator : std::false_type { };
- template<typename T>
- struct is_iterator<T,
- typename std::enable_if<std::is_class<T>::value,
- void_t<typename T::iterator_category>>::type>
- : std::true_type { };
- template<typename T>
- struct is_iterator<T*, void>
- : std::true_type { };
- template<typename T, typename = void>
- struct is_input_iterator : std::false_type { };
- template<typename T>
- struct is_input_iterator<T, typename std::enable_if<is_iterator<T>::value &&
- std::is_convertible<typename std::iterator_traits<T>::iterator_category,
- std::input_iterator_tag>::value>::type>
- : std::true_type { };
- template<typename T, typename = void>
- struct is_forward_iterator : std::false_type { };
- template<typename T>
- struct is_forward_iterator<T, typename std::enable_if<is_iterator<T>::value &&
- std::is_convertible<typename std::iterator_traits<T>::iterator_category,
- std::forward_iterator_tag>::value>::type>
- : std::true_type { };
- template<typename T, typename = void>
- struct is_subtractable
- : std::false_type { };
- template<typename T>
- struct is_subtractable<T, void_t<decltype(std::declval<T&>() - std::declval<T&>())>>
- : std::true_type { };
- template<
- typename ForwardIt,
- typename std::enable_if<!is_subtractable<ForwardIt>::value>::type* = nullptr>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- std::size_t
- distance(ForwardIt first, ForwardIt last)
- {
- std::size_t dist = 0;
- for (; first != last; ++first, ++dist);
- return dist;
- }
- template<
- typename RandomIt,
- typename std::enable_if<is_subtractable<RandomIt>::value>::type* = nullptr>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- std::size_t
- distance(RandomIt first, RandomIt last)
- {
- return last - first;
- }
- template<typename Traits, typename InputIt, typename CharT>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- copy_with_traits(
- InputIt first,
- InputIt last,
- CharT* out)
- {
- for (; first != last; ++first, ++out)
- Traits::assign(*out, *first);
- }
- template<std::size_t N, typename CharT, typename Traits>
- class static_string_base
- {
- private:
- using size_type = smallest_width<N>;
- using value_type = typename Traits::char_type;
- using pointer = value_type*;
- using const_pointer = const value_type*;
- public:
- BOOST_STATIC_STRING_CPP11_CONSTEXPR
- static_string_base() noexcept { };
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- pointer
- data_impl() noexcept
- {
- return data_;
- }
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- const_pointer
- data_impl() const noexcept
- {
- return data_;
- }
- BOOST_STATIC_STRING_CPP11_CONSTEXPR
- std::size_t
- size_impl() const noexcept
- {
- return size_;
- }
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- std::size_t
- set_size(std::size_t n) noexcept
- {
-
-
-
-
- return size_ = size_type(n);
- }
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- term_impl() noexcept
- {
- Traits::assign(data_[size_], value_type());
- }
- size_type size_ = 0;
- #ifdef BOOST_STATIC_STRING_CPP20
- value_type data_[N + 1];
- #else
- value_type data_[N + 1]{};
- #endif
- };
- template<typename CharT, typename Traits>
- class static_string_base<0, CharT, Traits>
- {
- private:
- using value_type = typename Traits::char_type;
- using pointer = value_type*;
- public:
- BOOST_STATIC_STRING_CPP11_CONSTEXPR
- static_string_base() noexcept { }
-
- BOOST_STATIC_STRING_CPP11_CONSTEXPR
- pointer
- data_impl() const noexcept
- {
- return const_cast<pointer>(&null_);
- }
- BOOST_STATIC_STRING_CPP11_CONSTEXPR
- std::size_t
- size_impl() const noexcept
- {
- return 0;
- }
- BOOST_STATIC_STRING_CPP11_CONSTEXPR
- std::size_t
- set_size(std::size_t) const noexcept
- {
- return 0;
- }
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- term_impl() const noexcept { }
- private:
- static constexpr const value_type null_{};
- };
- #ifndef BOOST_STATIC_STRING_CPP17
- template<typename CharT, typename Traits>
- constexpr
- const
- typename static_string_base<0, CharT, Traits>::value_type
- static_string_base<0, CharT, Traits>::
- null_;
- #endif
- template<typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- int
- lexicographical_compare(
- const CharT* s1,
- std::size_t n1,
- const CharT* s2,
- std::size_t n2) noexcept
- {
- if(n1 < n2)
- return Traits::compare(
- s1, s2, n1) <= 0 ? -1 : 1;
- if(n1 > n2)
- return Traits::compare(
- s1, s2, n2) >= 0 ? 1 : -1;
- return Traits::compare(s1, s2, n1);
- }
- template<typename Traits, typename Integer>
- inline
- char*
- integer_to_string(
- char* str_end,
- Integer value,
- std::true_type) noexcept
- {
- if (value == 0)
- {
- Traits::assign(*--str_end, '0');
- return str_end;
- }
- if (value < 0)
- {
- const bool is_min = value == std::numeric_limits<Integer>::min();
-
- if (is_min)
- value = std::numeric_limits<Integer>::max();
- else
- value = -value;
- const auto last_char = str_end - 1;
- for (; value > 0; value /= 10)
- Traits::assign(*--str_end, "0123456789"[value % 10]);
-
-
- if (is_min)
- Traits::assign(*last_char, Traits::to_char_type(
- Traits::to_int_type(*last_char) + 1));
- Traits::assign(*--str_end, '-');
- return str_end;
- }
- for (; value > 0; value /= 10)
- Traits::assign(*--str_end, "0123456789"[value % 10]);
- return str_end;
- }
- template<typename Traits, typename Integer>
- inline
- char*
- integer_to_string(
- char* str_end,
- Integer value,
- std::false_type) noexcept
- {
- if (value == 0)
- {
- Traits::assign(*--str_end, '0');
- return str_end;
- }
- for (; value > 0; value /= 10)
- Traits::assign(*--str_end, "0123456789"[value % 10]);
- return str_end;
- }
- template<typename Traits, typename Integer>
- inline
- wchar_t*
- integer_to_wstring(
- wchar_t* str_end,
- Integer value,
- std::true_type) noexcept
- {
- if (value == 0)
- {
- Traits::assign(*--str_end, L'0');
- return str_end;
- }
- if (value < 0)
- {
- const bool is_min = value == std::numeric_limits<Integer>::min();
-
- if (is_min)
- value = std::numeric_limits<Integer>::max();
- else
- value = -value;
- const auto last_char = str_end - 1;
- for (; value > 0; value /= 10)
- Traits::assign(*--str_end, L"0123456789"[value % 10]);
-
-
- if (is_min)
- Traits::assign(*last_char, Traits::to_char_type(
- Traits::to_int_type(*last_char) + 1));
- Traits::assign(*--str_end, L'-');
- return str_end;
- }
- for (; value > 0; value /= 10)
- Traits::assign(*--str_end, L"0123456789"[value % 10]);
- return str_end;
- }
- template<typename Traits, typename Integer>
- inline
- wchar_t*
- integer_to_wstring(
- wchar_t* str_end,
- Integer value,
- std::false_type) noexcept
- {
- if (value == 0)
- {
- Traits::assign(*--str_end, L'0');
- return str_end;
- }
- for (; value > 0; value /= 10)
- Traits::assign(*--str_end, L"0123456789"[value % 10]);
- return str_end;
- }
- template<std::size_t N, typename Integer>
- inline
- static_string<N>
- to_static_string_int_impl(Integer value) noexcept
- {
- char buffer[N];
- const auto digits_end = std::end(buffer);
- const auto digits_begin = integer_to_string<std::char_traits<char>, Integer>(
- digits_end, value, std::is_signed<Integer>{});
- return static_string<N>(digits_begin, std::distance(digits_begin, digits_end));
- }
- template<std::size_t N, typename Integer>
- inline
- static_wstring<N>
- to_static_wstring_int_impl(Integer value) noexcept
- {
- wchar_t buffer[N];
- const auto digits_end = std::end(buffer);
- const auto digits_begin = integer_to_wstring<std::char_traits<wchar_t>, Integer>(
- digits_end, value, std::is_signed<Integer>{});
- return static_wstring<N>(digits_begin, std::distance(digits_begin, digits_end));
- }
- BOOST_STATIC_STRING_CPP11_CONSTEXPR
- inline
- int
- count_digits(std::size_t value)
- {
- return value < 10 ? 1 : count_digits(value / 10) + 1;
- }
- #if defined(__GNUC__) && __GNUC__ >= 7
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wformat-truncation"
- #endif
- template<std::size_t N>
- inline
- static_string<N>
- to_static_string_float_impl(double value) noexcept
- {
-
-
- const long long narrow =
- static_cast<long long>(N);
-
- char buffer[N + 1];
-
-
- if (std::size_t(std::snprintf(buffer, N + 1, "%f", value)) > N)
- {
-
-
- const int reserved_count =
- (std::max)(2, count_digits(
- std::numeric_limits<double>::max_exponent10)) + 4;
- const int precision = narrow > reserved_count ?
- N - reserved_count : 0;
-
- std::snprintf(buffer, N + 1, "%.*e", precision, value);
- }
-
- return static_string<N>(buffer);
- }
- template<std::size_t N>
- inline
- static_string<N>
- to_static_string_float_impl(long double value) noexcept
- {
-
-
- const long long narrow =
- static_cast<long long>(N);
-
- char buffer[N + 1];
-
-
-
-
- if (std::size_t(std::snprintf(buffer, N + 1, "%Lf", value)) > N)
- {
-
-
- const int reserved_count =
- (std::max)(2, count_digits(
- std::numeric_limits<long double>::max_exponent10)) + 4;
- const int precision = narrow > reserved_count ?
- N - reserved_count : 0;
-
- std::snprintf(buffer, N + 1, "%.*Le", precision, value);
- }
-
- return static_string<N>(buffer);
- }
- template<std::size_t N>
- inline
- static_wstring<N>
- to_static_wstring_float_impl(double value) noexcept
- {
-
-
- const long long narrow =
- static_cast<long long>(N);
-
- wchar_t buffer[N + 1];
-
-
-
-
-
-
-
- const long long num_written =
- std::swprintf(buffer, N + 1, L"%f", value);
- if (num_written < 0 ||
- num_written > narrow)
- {
-
-
- const int reserved_count =
- (std::max)(2, count_digits(
- std::numeric_limits<double>::max_exponent10)) + 4;
- const int precision = narrow > reserved_count ?
- N - reserved_count : 0;
-
- std::swprintf(buffer, N + 1, L"%.*e", precision, value);
- }
-
- return static_wstring<N>(buffer);
- }
- template<std::size_t N>
- inline
- static_wstring<N>
- to_static_wstring_float_impl(long double value) noexcept
- {
-
-
- const long long narrow =
- static_cast<long long>(N);
-
- wchar_t buffer[N + 1];
-
-
-
-
-
-
-
- const long long num_written =
- std::swprintf(buffer, N + 1, L"%Lf", value);
- if (num_written < 0 ||
- num_written > narrow)
- {
-
-
- const int reserved_count =
- (std::max)(2, count_digits(
- std::numeric_limits<long double>::max_exponent10)) + 4;
- const int precision = narrow > reserved_count ?
- N - reserved_count : 0;
-
- std::swprintf(buffer, N + 1, L"%.*Le", precision, value);
- }
-
- return static_wstring<N>(buffer);
- }
- #if defined(__GNUC__) && __GNUC__ >= 7
- #pragma GCC diagnostic pop
- #endif
- template<typename Traits, typename CharT, typename ForwardIterator>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- ForwardIterator
- find_not_of(
- ForwardIterator first,
- ForwardIterator last,
- const CharT* str,
- std::size_t n) noexcept
- {
- for (; first != last; ++first)
- if (!Traits::find(str, n, *first))
- return first;
- return last;
- }
- template<typename ForwardIt1, typename ForwardIt2, typename BinaryPredicate>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- ForwardIt1
- search(
- ForwardIt1 first,
- ForwardIt1 last,
- ForwardIt2 s_first,
- ForwardIt2 s_last,
- BinaryPredicate p)
- {
- for (; ; ++first)
- {
- ForwardIt1 it = first;
- for (ForwardIt2 s_it = s_first; ; ++it, ++s_it)
- {
- if (s_it == s_last)
- return first;
- if (it == last)
- return last;
- if (!p(*it, *s_it))
- break;
- }
- }
- }
- template<typename InputIt, typename ForwardIt, typename BinaryPredicate>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- InputIt
- find_first_of(
- InputIt first,
- InputIt last,
- ForwardIt s_first,
- ForwardIt s_last,
- BinaryPredicate p)
- {
- for (; first != last; ++first)
- for (ForwardIt it = s_first; it != s_last; ++it)
- if (p(*first, *it))
- return first;
- return last;
- }
- template<typename T>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- ptr_in_range(
- const T* src_first,
- const T* src_last,
- const T* ptr)
- {
- #if defined(BOOST_STATIC_STRING_CPP14) && \
- defined(BOOST_STATIC_STRING_IS_CONST_EVAL)
-
-
-
- if (BOOST_STATIC_STRING_IS_CONST_EVAL)
- {
- for (; src_first != src_last; ++src_first)
- if (ptr == src_first)
- return true;
- return false;
- }
- #endif
-
-
-
-
-
-
- #if defined(BOOST_STATIC_STRING_CPP14) && \
- defined(BOOST_STATIC_STRING_NO_PTR_COMP_FUNCTIONS)
-
-
- return ptr >= src_first && ptr < src_last;
- #else
-
-
- return std::greater_equal<const T*>()(ptr, src_first) &&
- std::less<const T*>()(ptr, src_last);
- #endif
- }
- #ifdef BOOST_STATIC_STRING_GCC5_BAD_CONSTEXPR
- template<typename Exception>
- struct throw_exception
- {
- BOOST_STATIC_STRING_NORETURN
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- throw_exception(const char* msg)
- {
- BOOST_STATIC_STRING_THROW(Exception(msg));
- }
- };
- #else
- template<typename Exception>
- BOOST_STATIC_STRING_NORETURN
- inline
- void
- throw_exception(const char* msg)
- {
- BOOST_STATIC_STRING_THROW(Exception(msg));
- }
- #endif
- }
- #endif
- template<std::size_t N, typename CharT,
- typename Traits = std::char_traits<CharT>>
- class basic_static_string
- #ifndef BOOST_STATIC_STRING_DOCS
- : private detail::static_string_base<N, CharT, Traits>
- #endif
- {
- private:
- template<std::size_t, class, class>
- friend class basic_static_string;
- public:
-
-
-
-
-
-
- using traits_type = Traits;
-
- using value_type = typename traits_type::char_type;
-
- using size_type = std::size_t;
-
- using difference_type = std::ptrdiff_t;
-
- using pointer = value_type*;
-
- using reference = value_type&;
-
- using const_pointer = const value_type*;
-
- using const_reference = const value_type&;
-
- using iterator = value_type*;
-
- using const_iterator = const value_type*;
-
-
- using reverse_iterator =
- std::reverse_iterator<iterator>;
-
-
- using const_reverse_iterator =
- std::reverse_iterator<const_iterator>;
-
- using string_view_type =
- basic_string_view<value_type, traits_type>;
-
-
-
-
-
-
- static constexpr size_type static_capacity = N;
-
- static constexpr size_type npos = size_type(-1);
-
-
-
-
-
-
- BOOST_STATIC_STRING_CPP11_CONSTEXPR
- basic_static_string() noexcept
- {
- #ifdef BOOST_STATIC_STRING_CPP20
- term();
- #endif
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string(
- size_type count,
- value_type ch)
- {
- assign(count, ch);
- }
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string(
- const basic_static_string<M, CharT, Traits>& other,
- size_type pos)
- {
- assign(other, pos);
- }
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string(
- const basic_static_string<M, CharT, Traits>& other,
- size_type pos,
- size_type count)
- {
- assign(other, pos, count);
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string(
- const_pointer s,
- size_type count)
- {
- assign(s, count);
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string(const_pointer s)
- {
- assign(s);
- }
-
- template<typename InputIterator
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename std::enable_if<
- detail::is_input_iterator<InputIterator>
- ::value>::type* = nullptr
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string(
- InputIterator first,
- InputIterator last)
- {
-
- assign(first, last);
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string(const basic_static_string& other) noexcept
- {
- assign(other);
- }
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string(
- const basic_static_string<M, CharT, Traits>& other)
- {
- assign(other);
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string(std::initializer_list<value_type> init)
- {
- assign(init.begin(), init.size());
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- explicit
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string(const T& t)
- {
- assign(t);
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string(
- const T& t,
- size_type pos,
- size_type n)
- {
- assign(t, pos, n);
- }
-
-
-
-
-
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- operator=(const basic_static_string<M, CharT, Traits>& s)
- {
- return assign(s);
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- operator=(const_pointer s)
- {
- return assign(s);
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- operator=(value_type ch)
- {
- return assign_char(ch,
- std::integral_constant<bool, (N > 0)>{});
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- operator=(std::initializer_list<value_type> ilist)
- {
- return assign(ilist);
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- operator=(const T& t)
- {
- return assign(t);
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- assign(
- size_type count,
- value_type ch);
-
- template<std::size_t M
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename std::enable_if<(M < N)>::type* = nullptr
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- assign(const basic_static_string<M, CharT, Traits>& s)
- {
- return assign_unchecked(s.data(), s.size());
- }
- #ifndef BOOST_STATIC_STRING_DOCS
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- assign(const basic_static_string& s) noexcept
- {
- if (this == &s)
- return *this;
- return assign_unchecked(s.data(), s.size());
- }
- template<std::size_t M,
- typename std::enable_if<(M > N)>::type* = nullptr>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- assign(const basic_static_string<M, CharT, Traits>& s)
- {
- return assign(s.data(), s.size());
- }
- #endif
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- assign(
- const basic_static_string<M, CharT, Traits>& s,
- size_type pos,
- size_type count = npos)
- {
- return assign(s.data() + pos, s.capped_length(pos, count));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- assign(
- const_pointer s,
- size_type count);
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- assign(const_pointer s)
- {
- return assign(s, traits_type::length(s));
- }
-
- template<typename InputIterator>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- #ifdef BOOST_STATIC_STRING_DOCS
- basic_static_string&
- #else
- typename std::enable_if<
- detail::is_input_iterator<InputIterator>::value,
- basic_static_string&>::type
- #endif
- assign(
- InputIterator first,
- InputIterator last);
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- assign(
- std::initializer_list<value_type> ilist)
- {
- return assign(ilist.begin(), ilist.end());
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- assign(const T& t)
- {
- const string_view_type sv = t;
- return assign(sv.data(), sv.size());
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- basic_static_string&
- assign(
- const T& t,
- size_type pos,
- size_type count = npos)
- {
- const auto sv = string_view_type(t).substr(pos, count);
- return assign(sv.data(), sv.size());
- }
-
-
-
-
-
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- reference
- at(size_type pos)
- {
- if (pos >= size())
- detail::throw_exception<std::out_of_range>(
- "pos >= size()");
- return data()[pos];
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- const_reference
- at(size_type pos) const
- {
- if (pos >= size())
- detail::throw_exception<std::out_of_range>(
- "pos >= size()");
- return data()[pos];
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- reference
- operator[](size_type pos) noexcept
- {
- return data()[pos];
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- const_reference
- operator[](size_type pos) const noexcept
- {
- return data()[pos];
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- reference
- front() noexcept
- {
- return data()[0];
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- const_reference
- front() const noexcept
- {
- return data()[0];
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- reference
- back() noexcept
- {
- return data()[size() - 1];
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- const_reference
- back() const noexcept
- {
- return data()[size() - 1];
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- pointer
- data() noexcept
- {
- return this->data_impl();
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- const_pointer
- data() const noexcept
- {
- return this->data_impl();
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- const_pointer
- c_str() const noexcept
- {
- return data();
- }
-
- BOOST_STATIC_STRING_CPP11_CONSTEXPR
- operator string_view_type() const noexcept
- {
- return string_view_type(data(), size());
- }
-
-
-
-
-
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- iterator
- begin() noexcept
- {
- return data();
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- const_iterator
- begin() const noexcept
- {
- return data();
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- const_iterator
- cbegin() const noexcept
- {
- return data();
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- iterator
- end() noexcept
- {
- return data() + size();
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- const_iterator
- end() const noexcept
- {
- return data() + size();
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- const_iterator
- cend() const noexcept
- {
- return data() + size();
- }
-
- BOOST_STATIC_STRING_CPP17_CONSTEXPR
- reverse_iterator
- rbegin() noexcept
- {
- return reverse_iterator{end()};
- }
-
- BOOST_STATIC_STRING_CPP17_CONSTEXPR
- const_reverse_iterator
- rbegin() const noexcept
- {
- return const_reverse_iterator{cend()};
- }
-
- BOOST_STATIC_STRING_CPP17_CONSTEXPR
- const_reverse_iterator
- crbegin() const noexcept
- {
- return const_reverse_iterator{cend()};
- }
-
- BOOST_STATIC_STRING_CPP17_CONSTEXPR
- reverse_iterator
- rend() noexcept
- {
- return reverse_iterator{begin()};
- }
-
- BOOST_STATIC_STRING_CPP17_CONSTEXPR
- const_reverse_iterator
- rend() const noexcept
- {
- return const_reverse_iterator{cbegin()};
- }
-
- BOOST_STATIC_STRING_CPP17_CONSTEXPR
- const_reverse_iterator
- crend() const noexcept
- {
- return const_reverse_iterator{cbegin()};
- }
-
-
-
-
-
-
- BOOST_STATIC_STRING_NODISCARD
- BOOST_STATIC_STRING_CPP11_CONSTEXPR
- bool
- empty() const noexcept
- {
- return size() == 0;
- }
-
- BOOST_STATIC_STRING_CPP11_CONSTEXPR
- size_type
- size() const noexcept
- {
- return this->size_impl();
- }
-
- BOOST_STATIC_STRING_CPP11_CONSTEXPR
- size_type
- length() const noexcept
- {
- return size();
- }
-
- BOOST_STATIC_STRING_CPP11_CONSTEXPR
- size_type
- max_size() const noexcept
- {
- return N;
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- reserve(size_type n)
- {
- if (n > max_size())
- detail::throw_exception<std::length_error>(
- "n > max_size()");
- }
-
- BOOST_STATIC_STRING_CPP11_CONSTEXPR
- size_type
- capacity() const noexcept
- {
- return max_size();
- }
-
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- shrink_to_fit() noexcept { }
-
-
-
-
-
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- clear() noexcept
- {
- this->set_size(0);
- term();
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- insert(
- size_type index,
- size_type count,
- value_type ch)
- {
- if (index > size())
- detail::throw_exception<std::out_of_range>(
- "index > size()");
- insert(begin() + index, count, ch);
- return *this;
- }
-
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- insert(
- size_type index,
- const_pointer s)
- {
- return insert(index, s, traits_type::length(s));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- insert(
- size_type index,
- const_pointer s,
- size_type count)
- {
- if (index > size())
- detail::throw_exception<std::out_of_range>(
- "index > size()");
- insert(data() + index, s, s + count);
- return *this;
- }
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- insert(
- size_type index,
- const basic_static_string<M, CharT, Traits>& str)
- {
- return insert_unchecked(index, str.data(), str.size());
- }
- #ifndef BOOST_STATIC_STRING_DOCS
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- insert(
- size_type index,
- const basic_static_string& str)
- {
- return insert(index, str.data(), str.size());
- }
- #endif
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- insert(
- size_type index,
- const basic_static_string<M, CharT, Traits>& str,
- size_type index_str,
- size_type count = npos)
- {
- return insert_unchecked(index, str.data() + index_str, str.capped_length(index_str, count));
- }
- #ifndef BOOST_STATIC_STRING_DOCS
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- insert(
- size_type index,
- const basic_static_string& str,
- size_type index_str,
- size_type count = npos)
- {
- return insert(index, str.data() + index_str, str.capped_length(index_str, count));
- }
- #endif
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- iterator
- insert(
- const_iterator pos,
- value_type ch)
- {
- return insert(pos, 1, ch);
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- iterator
- insert(
- const_iterator pos,
- size_type count,
- value_type ch);
-
- template<typename InputIterator>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- #ifdef BOOST_STATIC_STRING_DOCS
- iterator
- #else
- typename std::enable_if<
- detail::is_input_iterator<
- InputIterator>::value &&
- !detail::is_forward_iterator<
- InputIterator>::value, iterator>::type
- #endif
- insert(
- const_iterator pos,
- InputIterator first,
- InputIterator last);
- #ifndef BOOST_STATIC_STRING_DOCS
- template<typename ForwardIterator>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- typename std::enable_if<
- detail::is_forward_iterator<
- ForwardIterator>::value,
- iterator>::type
- insert(
- const_iterator pos,
- ForwardIterator first,
- ForwardIterator last);
- #endif
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- iterator
- insert(
- const_iterator pos,
- std::initializer_list<value_type> ilist)
- {
- return insert_unchecked(pos, ilist.begin(), ilist.size());
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- insert(
- size_type index,
- const T& t)
- {
- const string_view_type sv = t;
- return insert(index, sv.data(), sv.size());
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- insert(
- size_type index,
- const T& t,
- size_type index_str,
- size_type count = npos)
- {
- const auto sv = string_view_type(t).substr(index_str, count);
- return insert(index, sv.data(), sv.size());
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- erase(
- size_type index = 0,
- size_type count = npos)
- {
- erase(data() + index, data() + index + capped_length(index, count));
- return *this;
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- iterator
- erase(const_iterator pos)
- {
- BOOST_STATIC_STRING_ASSERT(!empty());
- return erase(pos, pos + 1);
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- iterator
- erase(
- const_iterator first,
- const_iterator last);
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- push_back(value_type ch);
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- pop_back() noexcept
- {
- BOOST_STATIC_STRING_ASSERT(!empty());
- this->set_size(size() - 1);
- term();
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- append(
- size_type count,
- value_type ch);
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- append(
- const basic_static_string<M, CharT, Traits>& s)
- {
- return append(s.data(), s.size());
- }
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- append(
- const basic_static_string<M, CharT, Traits>& s,
- size_type pos,
- size_type count = npos)
- {
- return append(s.data() + pos, s.capped_length(pos, count));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- append(
- const_pointer s,
- size_type count);
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- append(const_pointer s)
- {
- return append(s, traits_type::length(s));
- }
-
-
- template<typename InputIterator>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- #ifdef BOOST_STATIC_STRING_DOCS
- basic_static_string&
- #else
- typename std::enable_if<
- detail::is_input_iterator<InputIterator>::value,
- basic_static_string&>::type
- #endif
- append(
- InputIterator first,
- InputIterator last)
- {
- this->set_size(size() + read_back(true, first, last));
- return term();
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- append(
- std::initializer_list<value_type> ilist)
- {
- return append(ilist.begin(), ilist.size());
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- append(const T& t)
- {
- const string_view_type sv = t;
- return append(sv.data(), sv.size());
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- append(
- const T& t,
- size_type pos,
- size_type count = npos)
- {
- const auto sv = string_view_type(t).substr(pos, count);
- return append(sv.data(), sv.size());
- }
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- operator+=(
- const basic_static_string<M, CharT, Traits>& s)
- {
- return append(s);
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- operator+=(value_type ch)
- {
- push_back(ch);
- return *this;
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- operator+=(const_pointer s)
- {
- return append(s);
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- operator+=(
- std::initializer_list<value_type> ilist)
- {
- return append(ilist);
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- operator+=(const T& t)
- {
- return append(t);
- }
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- int
- compare(
- const basic_static_string<M, CharT, Traits>& s) const noexcept
- {
- return detail::lexicographical_compare<CharT, Traits>(
- data(), size(), s.data(), s.size());
- }
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- int
- compare(
- size_type pos1,
- size_type count1,
- const basic_static_string<M, CharT, Traits>& s) const
- {
- return detail::lexicographical_compare<CharT, Traits>(
- data() + pos1, capped_length(pos1, count1), s.data(), s.size());
- }
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- int
- compare(
- size_type pos1,
- size_type count1,
- const basic_static_string<M, CharT, Traits>& s,
- size_type pos2,
- size_type count2 = npos) const
- {
- return detail::lexicographical_compare<CharT, Traits>(
- data() + pos1, capped_length(pos1, count1),
- s.data() + pos2, s.capped_length(pos2, count2));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- int
- compare(const_pointer s) const noexcept
- {
- return detail::lexicographical_compare<CharT, Traits>(
- data(), size(), s, traits_type::length(s));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- int
- compare(
- size_type pos1,
- size_type count1,
- const_pointer s) const
- {
- return detail::lexicographical_compare<CharT, Traits>(
- data() + pos1, capped_length(pos1, count1), s, traits_type::length(s));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- int
- compare(
- size_type pos1,
- size_type count1,
- const_pointer s,
- size_type count2) const
- {
- return detail::lexicographical_compare<CharT, Traits>(
- data() + pos1, capped_length(pos1, count1), s, count2);
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- int
- compare(const T& t) const noexcept
- {
- const string_view_type sv = t;
- return detail::lexicographical_compare<CharT, Traits>(
- data(), size(), sv.data(), sv.size());
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- int
- compare(
- size_type pos1,
- size_type count1,
- const T& t) const
- {
- const string_view_type sv = t;
- return detail::lexicographical_compare<CharT, Traits>(
- data() + pos1, capped_length(pos1, count1), sv.data(), sv.size());
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- int
- compare(
- size_type pos1,
- size_type count1,
- const T& t,
- size_type pos2,
- size_type count2 = npos) const
- {
- const auto sv = string_view_type(t).substr(pos2, count2);
- return compare(pos1, count1,
- sv.data(), sv.size());
- }
-
- #ifndef BOOST_STATIC_STRING_GCC5_BAD_CONSTEXPR
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- #endif
- basic_static_string
- substr(
- size_type pos = 0,
- size_type count = npos) const
- {
- return basic_static_string(
- data() + pos, capped_length(pos, count));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- string_view_type
- subview(
- size_type pos = 0,
- size_type count = npos) const
- {
- return string_view_type(
- data() + pos, capped_length(pos, count));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- copy(
- pointer dest,
- size_type count,
- size_type pos = 0) const
- {
- const auto num_copied = capped_length(pos, count);
- traits_type::copy(dest, data() + pos, num_copied);
- return num_copied;
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- resize(size_type n)
- {
- resize(n, value_type());
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- resize(
- size_type n,
- value_type c);
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- swap(basic_static_string& s) noexcept;
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- swap(basic_static_string<M, CharT, Traits>& s);
-
- template<size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- size_type pos1,
- size_type n1,
- const basic_static_string<M, CharT, Traits>& str)
- {
- return replace_unchecked(pos1, n1, str.data(), str.size());
- }
- #ifndef BOOST_STATIC_STRING_DOCS
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- size_type pos1,
- size_type n1,
- const basic_static_string& str)
- {
- return replace(pos1, n1, str.data(), str.size());
- }
- #endif
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- size_type pos1,
- size_type n1,
- const basic_static_string<M, CharT, Traits>& str,
- size_type pos2,
- size_type n2 = npos)
- {
- return replace_unchecked(pos1, n1, str.data() + pos2, str.capped_length(pos2, n2));
- }
- #ifndef BOOST_STATIC_STRING_DOCS
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- size_type pos1,
- size_type n1,
- const basic_static_string& str,
- size_type pos2,
- size_type n2 = npos)
- {
- return replace(pos1, n1, str.data() + pos2, str.capped_length(pos2, n2));
- }
- #endif
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- size_type pos1,
- size_type n1,
- const T& t)
- {
- const string_view_type sv = t;
- return replace(pos1, n1, sv.data(), sv.size());
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- size_type pos1,
- size_type n1,
- const T& t,
- size_type pos2,
- size_type n2 = npos)
- {
- const string_view_type sv = t;
- return replace(pos1, n1, sv.substr(pos2, n2));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- size_type pos,
- size_type n1,
- const_pointer s,
- size_type n2)
- {
- return replace(data() + pos, data() + pos + capped_length(pos, n1), s, n2);
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- size_type pos,
- size_type n1,
- const_pointer s)
- {
- return replace(pos, n1, s, traits_type::length(s));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- size_type pos,
- size_type n1,
- size_type n2,
- value_type c)
- {
- return replace(data() + pos, data() + pos + capped_length(pos, n1), n2, c);
- }
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- const_iterator i1,
- const_iterator i2,
- const basic_static_string<M, CharT, Traits>& str)
- {
- return replace_unchecked(i1, i2, str.data(), str.size());
- }
- #ifndef BOOST_STATIC_STRING_DOCS
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- const_iterator i1,
- const_iterator i2,
- const basic_static_string& str)
- {
- return replace(i1, i2, str.data(), str.size());
- }
- #endif
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- const_iterator i1,
- const_iterator i2,
- const T& t)
- {
- const string_view_type sv = t;
- return replace(i1, i2, sv.begin(), sv.end());
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- const_iterator i1,
- const_iterator i2,
- const_pointer s,
- size_type n)
- {
- return replace(i1, i2, s, s + n);
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- const_iterator i1,
- const_iterator i2,
- const_pointer s)
- {
- return replace(i1, i2, s, traits_type::length(s));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- const_iterator i1,
- const_iterator i2,
- size_type n,
- value_type c);
-
- template<typename InputIterator>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- #ifdef BOOST_STATIC_STRING_DOCS
- basic_static_string&
- #else
- typename std::enable_if<
- detail::is_input_iterator<
- InputIterator>::value &&
- !detail::is_forward_iterator<
- InputIterator>::value,
- basic_static_string<N, CharT, Traits>&>::type
- #endif
- replace(
- const_iterator i1,
- const_iterator i2,
- InputIterator j1,
- InputIterator j2);
- #ifndef BOOST_STATIC_STRING_DOCS
- template<typename ForwardIterator>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- typename std::enable_if<
- detail::is_forward_iterator<
- ForwardIterator>::value,
- basic_static_string<N, CharT, Traits>&>::type
- replace(
- const_iterator i1,
- const_iterator i2,
- ForwardIterator j1,
- ForwardIterator j2);
- #endif
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace(
- const_iterator i1,
- const_iterator i2,
- std::initializer_list<value_type> il)
- {
- return replace_unchecked(i1, i2, il.begin(), il.size());
- }
-
-
-
-
-
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find(
- const T& t,
- size_type pos = 0) const
- noexcept(detail::is_nothrow_convertible<const T&, string_view_type>::value)
- {
- const string_view_type sv = t;
- return find(sv.data(), pos, sv.size());
- }
-
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find(
- const basic_static_string<M, CharT, Traits>& str,
- size_type pos = 0) const noexcept
- {
- return find(str.data(), pos, str.size());
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find(
- const_pointer s,
- size_type pos,
- size_type n) const noexcept;
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find(
- const_pointer s,
- size_type pos = 0) const noexcept
- {
- return find(s, pos, traits_type::length(s));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find(
- value_type c,
- size_type pos = 0) const noexcept
- {
- return find(&c, pos, 1);
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- rfind(
- const T& t,
- size_type pos = npos) const
- noexcept(detail::is_nothrow_convertible<const T&, string_view_type>::value)
- {
- const string_view_type sv = t;
- return rfind(sv.data(), pos, sv.size());
- }
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- rfind(
- const basic_static_string<M, CharT, Traits>& str,
- size_type pos = npos) const noexcept
- {
- return rfind(str.data(), pos, str.size());
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- rfind(
- const_pointer s,
- size_type pos,
- size_type n) const noexcept;
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- rfind(
- const_pointer s,
- size_type pos = npos) const noexcept
- {
- return rfind(s, pos, traits_type::length(s));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- rfind(
- value_type c,
- size_type pos = npos) const noexcept
- {
- return rfind(&c, pos, 1);
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_first_of(
- const T& t,
- size_type pos = 0) const
- noexcept(detail::is_nothrow_convertible<const T&, string_view_type>::value)
- {
- const string_view_type sv = t;
- return find_first_of(sv.data(), pos, sv.size());
- }
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_first_of(
- const basic_static_string<M, CharT, Traits>& str,
- size_type pos = 0) const noexcept
- {
- return find_first_of(str.data(), pos, str.size());
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_first_of(
- const_pointer s,
- size_type pos,
- size_type n) const noexcept;
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_first_of(
- const_pointer s,
- size_type pos = 0) const noexcept
- {
- return find_first_of(s, pos, traits_type::length(s));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_first_of(
- value_type c,
- size_type pos = 0) const noexcept
- {
- return find_first_of(&c, pos, 1);
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_last_of(
- const T& t,
- size_type pos = npos) const
- noexcept(detail::is_nothrow_convertible<const T&, string_view_type>::value)
- {
- const string_view_type sv = t;
- return find_last_of(sv.data(), pos, sv.size());
- }
-
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_last_of(
- const basic_static_string<M, CharT, Traits>& str,
- size_type pos = npos) const noexcept
- {
- return find_last_of(str.data(), pos, str.size());
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_last_of(
- const_pointer s,
- size_type pos,
- size_type n) const noexcept;
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_last_of(
- const_pointer s,
- size_type pos = npos) const noexcept
- {
- return find_last_of(s, pos, traits_type::length(s));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_last_of(
- value_type c,
- size_type pos = npos) const noexcept
- {
- return find_last_of(&c, pos, 1);
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_first_not_of(
- const T& t,
- size_type pos = 0) const
- noexcept(detail::is_nothrow_convertible<const T&, string_view_type>::value)
- {
- const string_view_type sv = t;
- return find_first_not_of(sv.data(), pos, sv.size());
- }
-
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_first_not_of(
- const basic_static_string<M, CharT, Traits>& str,
- size_type pos = 0) const noexcept
- {
- return find_first_not_of(str.data(), pos, str.size());
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_first_not_of(
- const_pointer s,
- size_type pos,
- size_type n) const noexcept;
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_first_not_of(
- const_pointer s,
- size_type pos = 0) const noexcept
- {
- return find_first_not_of(s, pos, traits_type::length(s));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_first_not_of(
- value_type c,
- size_type pos = 0) const noexcept
- {
- return find_first_not_of(&c, pos, 1);
- }
-
- template<typename T
- #ifndef BOOST_STATIC_STRING_DOCS
- , typename = detail::enable_if_viewable_t<T, CharT, Traits>
- #endif
- >
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_last_not_of(
- const T& t,
- size_type pos = npos) const
- noexcept(detail::is_nothrow_convertible<const T&, string_view_type>::value)
- {
- const string_view_type sv = t;
- return find_last_not_of(sv.data(), pos, sv.size());
- }
-
- template<size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_last_not_of(
- const basic_static_string<M, CharT, Traits>& str,
- size_type pos = npos) const noexcept
- {
- return find_last_not_of(str.data(), pos, str.size());
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_last_not_of(
- const_pointer s,
- size_type pos,
- size_type n) const noexcept;
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_last_not_of(
- const_pointer s,
- size_type pos = npos) const noexcept
- {
- return find_last_not_of(s, pos, traits_type::length(s));
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- find_last_not_of(
- value_type c,
- size_type pos = npos) const noexcept
- {
- return find_last_not_of(&c, pos, 1);
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- bool
- starts_with(
- string_view_type s) const noexcept
- {
- const size_type len = s.size();
- return size() >= len && !traits_type::compare(data(), s.data(), len);
- }
-
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- bool
- starts_with(
- value_type c) const noexcept
- {
- return !empty() && traits_type::eq(front(), c);
- }
-
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- bool
- starts_with(
- const_pointer s) const noexcept
- {
- const size_type len = traits_type::length(s);
- return size() >= len && !traits_type::compare(data(), s, len);
- }
-
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- bool
- ends_with(
- string_view_type s) const noexcept
- {
- const size_type len = s.size();
- return size() >= len && !traits_type::compare(data() + (size() - len), s.data(), len);
- }
-
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- bool
- ends_with(
- value_type c) const noexcept
- {
- return !empty() && traits_type::eq(back(), c);
- }
-
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- bool
- ends_with(
- const_pointer s) const noexcept
- {
- const size_type len = traits_type::length(s);
- return size() >= len && !traits_type::compare(data() + (size() - len), s, len);
- }
- private:
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- term() noexcept
- {
- this->term_impl();
- return *this;
- }
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- assign_char(value_type ch, std::true_type) noexcept
- {
- this->set_size(1);
- traits_type::assign(data()[0], ch);
- return term();
- }
- BOOST_STATIC_STRING_NORETURN
- basic_static_string&
- assign_char(value_type, std::false_type)
- {
- detail::throw_exception<std::length_error>("max_size() == 0");
-
- #ifdef BOOST_STATIC_STRING_NO_NORETURN
- return *this;
- #endif
- }
-
- template<typename InputIterator>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- read_back(
- bool overwrite_null,
- InputIterator first,
- InputIterator last);
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace_unchecked(
- size_type pos,
- size_type n1,
- const_pointer s,
- size_type n2)
- {
- if (pos > size())
- detail::throw_exception<std::out_of_range>(
- "pos > size()");
- return replace_unchecked(data() + pos, data() + pos + capped_length(pos, n1), s, n2);
- }
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- replace_unchecked(
- const_iterator i1,
- const_iterator i2,
- const_pointer s,
- size_type n2);
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- insert_unchecked(
- size_type index,
- const_pointer s,
- size_type count)
- {
- if (index > size())
- detail::throw_exception<std::out_of_range>(
- "index > size()");
- insert_unchecked(data() + index, s, count);
- return *this;
- }
-
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- iterator
- insert_unchecked(
- const_iterator pos,
- const_pointer s,
- size_type count);
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- basic_static_string&
- assign_unchecked(
- const_pointer s,
- size_type count) noexcept
- {
- this->set_size(count);
- traits_type::copy(data(), s, size() + 1);
- return *this;
- }
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- size_type
- capped_length(
- size_type index,
- size_type length) const
- {
- if (index > size())
- detail::throw_exception<std::out_of_range>(
- "index > size()");
- return (std::min)(size() - index, length);
- }
- };
- template<
- std::size_t N, std::size_t M,
- typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator==(
- const basic_static_string<N, CharT, Traits>& lhs,
- const basic_static_string<M, CharT, Traits>& rhs)
- {
- return lhs.compare(rhs) == 0;
- }
- template<
- std::size_t N, std::size_t M,
- typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator!=(
- const basic_static_string<N, CharT, Traits>& lhs,
- const basic_static_string<M, CharT, Traits>& rhs)
- {
- return lhs.compare(rhs) != 0;
- }
- template<
- std::size_t N, std::size_t M,
- typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator<(
- const basic_static_string<N, CharT, Traits>& lhs,
- const basic_static_string<M, CharT, Traits>& rhs)
- {
- return lhs.compare(rhs) < 0;
- }
- template<
- std::size_t N, std::size_t M,
- typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator<=(
- const basic_static_string<N, CharT, Traits>& lhs,
- const basic_static_string<M, CharT, Traits>& rhs)
- {
- return lhs.compare(rhs) <= 0;
- }
- template<
- std::size_t N, std::size_t M,
- typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator>(
- const basic_static_string<N, CharT, Traits>& lhs,
- const basic_static_string<M, CharT, Traits>& rhs)
- {
- return lhs.compare(rhs) > 0;
- }
- template<
- std::size_t N, std::size_t M,
- typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator>=(
- const basic_static_string<N, CharT, Traits>& lhs,
- const basic_static_string<M, CharT, Traits>& rhs)
- {
- return lhs.compare(rhs) >= 0;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator==(
- const CharT* lhs,
- const basic_static_string<N, CharT, Traits>& rhs)
- {
- return detail::lexicographical_compare<CharT, Traits>(
- lhs, Traits::length(lhs),
- rhs.data(), rhs.size()) == 0;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator==(
- const basic_static_string<N, CharT, Traits>& lhs,
- const CharT* rhs)
- {
- return detail::lexicographical_compare<CharT, Traits>(
- lhs.data(), lhs.size(),
- rhs, Traits::length(rhs)) == 0;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator!=(
- const CharT* lhs,
- const basic_static_string<N, CharT, Traits>& rhs)
- {
- return detail::lexicographical_compare<CharT, Traits>(
- lhs, Traits::length(lhs),
- rhs.data(), rhs.size()) != 0;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator!=(
- const basic_static_string<N, CharT, Traits>& lhs,
- const CharT* rhs)
- {
- return detail::lexicographical_compare<CharT, Traits>(
- lhs.data(), lhs.size(),
- rhs, Traits::length(rhs)) != 0;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator<(
- const CharT* lhs,
- const basic_static_string<N, CharT, Traits>& rhs)
- {
- return detail::lexicographical_compare<CharT, Traits>(
- lhs, Traits::length(lhs),
- rhs.data(), rhs.size()) < 0;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator<(
- const basic_static_string<N, CharT, Traits>& lhs,
- const CharT* rhs)
- {
- return detail::lexicographical_compare<CharT, Traits>(
- lhs.data(), lhs.size(),
- rhs, Traits::length(rhs)) < 0;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator<=(
- const CharT* lhs,
- const basic_static_string<N, CharT, Traits>& rhs)
- {
- return detail::lexicographical_compare<CharT, Traits>(
- lhs, Traits::length(lhs),
- rhs.data(), rhs.size()) <= 0;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator<=(
- const basic_static_string<N, CharT, Traits>& lhs,
- const CharT* rhs)
- {
- return detail::lexicographical_compare<CharT, Traits>(
- lhs.data(), lhs.size(),
- rhs, Traits::length(rhs)) <= 0;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator>(
- const CharT* lhs,
- const basic_static_string<N, CharT, Traits>& rhs)
- {
- return detail::lexicographical_compare<CharT, Traits>(
- lhs, Traits::length(lhs),
- rhs.data(), rhs.size()) > 0;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator>(
- const basic_static_string<N, CharT, Traits>& lhs,
- const CharT* rhs)
- {
- return detail::lexicographical_compare<CharT, Traits>(
- lhs.data(), lhs.size(),
- rhs, Traits::length(rhs)) > 0;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator>=(
- const CharT* lhs,
- const basic_static_string<N, CharT, Traits>& rhs)
- {
- return detail::lexicographical_compare<CharT, Traits>(
- lhs, Traits::length(lhs),
- rhs.data(), rhs.size()) >= 0;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- bool
- operator>=(
- const basic_static_string<N, CharT, Traits>& lhs,
- const CharT* rhs)
- {
- return detail::lexicographical_compare<CharT, Traits>(
- lhs.data(), lhs.size(),
- rhs, Traits::length(rhs)) >= 0;
- }
- template<
- std::size_t N, std::size_t M,
- typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- basic_static_string<N + M, CharT, Traits>
- operator+(
- const basic_static_string<N, CharT, Traits>& lhs,
- const basic_static_string<M, CharT, Traits>& rhs)
- {
- return basic_static_string<N + M, CharT, Traits>(lhs) += rhs;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- basic_static_string<N + 1, CharT, Traits>
- operator+(
- const basic_static_string<N, CharT, Traits>& lhs,
- CharT rhs)
- {
- return basic_static_string<N + 1, CharT, Traits>(lhs) += rhs;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- basic_static_string<N + 1, CharT, Traits>
- operator+(
- CharT lhs,
- const basic_static_string<N, CharT, Traits>& rhs)
- {
-
- return basic_static_string<N + 1, CharT, Traits>(rhs).insert(
- std::size_t(0), 1, lhs);
- }
- template<
- std::size_t N, std::size_t M,
- typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- basic_static_string<N + M, CharT, Traits>
- operator+(
- const basic_static_string<N, CharT, Traits>& lhs,
- const CharT(&rhs)[M])
- {
- return basic_static_string<N + M, CharT, Traits>(lhs).append(+rhs);
- }
- template<
- std::size_t N, std::size_t M,
- typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- basic_static_string<N + M, CharT, Traits>
- operator+(
- const CharT(&lhs)[N],
- const basic_static_string<M, CharT, Traits>& rhs)
- {
-
- return basic_static_string<N + M, CharT, Traits>(rhs).insert(
- std::size_t(0), +lhs);
- }
- template<
- std::size_t N, typename CharT,
- typename Traits, typename UnaryPredicate>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- typename
- basic_static_string<N, CharT, Traits>::size_type
- erase_if(
- basic_static_string<N, CharT, Traits>& str,
- UnaryPredicate pred)
- {
- auto first = str.begin();
- for (auto it = first; it != str.end(); ++it)
- if (!pred(*it))
- *first++ = std::move(*it);
- const auto count = str.end() - first;
- str.erase(first, str.end());
- return count;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- void
- swap(
- basic_static_string<N, CharT, Traits>& lhs,
- basic_static_string<N, CharT, Traits>& rhs)
- {
- lhs.swap(rhs);
- }
- template<
- std::size_t N, std::size_t M,
- typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- inline
- void
- swap(
- basic_static_string<N, CharT, Traits>& lhs,
- basic_static_string<M, CharT, Traits>& rhs)
- {
- lhs.swap(rhs);
- }
- template<std::size_t N, typename CharT, typename Traits>
- inline
- std::basic_ostream<CharT, Traits>&
- operator<<(
- std::basic_ostream<CharT, Traits>& os,
- const basic_static_string<N, CharT, Traits>& s)
- {
- return os << basic_string_view<CharT, Traits>(s.data(), s.size());
- }
- static_string<std::numeric_limits<int>::digits10 + 2>
- inline
- to_static_string(int value) noexcept
- {
- return detail::to_static_string_int_impl<
- std::numeric_limits<int>::digits10 + 2>(value);
- }
- static_string<std::numeric_limits<long>::digits10 + 2>
- inline
- to_static_string(long value) noexcept
- {
- return detail::to_static_string_int_impl<
- std::numeric_limits<long>::digits10 + 2>(value);
- }
- static_string<std::numeric_limits<long long>::digits10 + 2>
- inline
- to_static_string(long long value) noexcept
- {
- return detail::to_static_string_int_impl<
- std::numeric_limits<long long>::digits10 + 2>(value);
- }
- static_string<std::numeric_limits<unsigned int>::digits10 + 1>
- inline
- to_static_string(unsigned int value) noexcept
- {
- return detail::to_static_string_int_impl<
- std::numeric_limits<unsigned int>::digits10 + 1>(value);
- }
- static_string<std::numeric_limits<unsigned long>::digits10 + 1>
- inline
- to_static_string(unsigned long value) noexcept
- {
- return detail::to_static_string_int_impl<
- std::numeric_limits<unsigned long>::digits10 + 1>(value);
- }
- static_string<std::numeric_limits<unsigned long long>::digits10 + 1>
- inline
- to_static_string(unsigned long long value) noexcept
- {
- return detail::to_static_string_int_impl<
- std::numeric_limits<unsigned long long>::digits10 + 1>(value);
- }
- static_string<std::numeric_limits<float>::max_digits10 + 4>
- inline
- to_static_string(float value) noexcept
- {
- return detail::to_static_string_float_impl<
- std::numeric_limits<float>::max_digits10 + 4>(value);
- }
- static_string<std::numeric_limits<double>::max_digits10 + 4>
- inline
- to_static_string(double value) noexcept
- {
- return detail::to_static_string_float_impl<
- std::numeric_limits<double>::max_digits10 + 4>(value);
- }
- static_string<std::numeric_limits<long double>::max_digits10 + 4>
- inline
- to_static_string(long double value) noexcept
- {
- return detail::to_static_string_float_impl<
- std::numeric_limits<long double>::max_digits10 + 4>(value);
- }
- static_wstring<std::numeric_limits<int>::digits10 + 2>
- inline
- to_static_wstring(int value) noexcept
- {
- return detail::to_static_wstring_int_impl<
- std::numeric_limits<int>::digits10 + 2>(value);
- }
- static_wstring<std::numeric_limits<long>::digits10 + 2>
- inline
- to_static_wstring(long value) noexcept
- {
- return detail::to_static_wstring_int_impl<
- std::numeric_limits<long>::digits10 + 2>(value);
- }
- static_wstring<std::numeric_limits<long long>::digits10 + 2>
- inline
- to_static_wstring(long long value) noexcept
- {
- return detail::to_static_wstring_int_impl<
- std::numeric_limits<long long>::digits10 + 2>(value);
- }
- static_wstring<std::numeric_limits<unsigned int>::digits10 + 1>
- inline
- to_static_wstring(unsigned int value) noexcept
- {
- return detail::to_static_wstring_int_impl<
- std::numeric_limits<unsigned int>::digits10 + 1>(value);
- }
- static_wstring<std::numeric_limits<unsigned long>::digits10 + 1>
- inline
- to_static_wstring(unsigned long value) noexcept
- {
- return detail::to_static_wstring_int_impl<
- std::numeric_limits<unsigned long>::digits10 + 1>(value);
- }
- static_wstring<std::numeric_limits<unsigned long long>::digits10 + 1>
- inline
- to_static_wstring(unsigned long long value) noexcept
- {
- return detail::to_static_wstring_int_impl<
- std::numeric_limits<unsigned long long>::digits10 + 1>(value);
- }
- static_wstring<std::numeric_limits<float>::max_digits10 + 4>
- inline
- to_static_wstring(float value) noexcept
- {
- return detail::to_static_wstring_float_impl<
- std::numeric_limits<float>::max_digits10 + 4>(value);
- }
- static_wstring<std::numeric_limits<double>::max_digits10 + 4>
- inline
- to_static_wstring(double value) noexcept
- {
- return detail::to_static_wstring_float_impl<
- std::numeric_limits<double>::max_digits10 + 4>(value);
- }
- static_wstring<std::numeric_limits<long double>::max_digits10 + 4>
- inline
- to_static_wstring(long double value) noexcept
- {
- return detail::to_static_wstring_float_impl<
- std::numeric_limits<long double>::max_digits10 + 4>(value);
- }
- #ifdef BOOST_STATIC_STRING_USE_DEDUCT
- template<std::size_t N, typename CharT>
- basic_static_string(const CharT(&)[N]) ->
- basic_static_string<N, CharT, std::char_traits<CharT>>;
- #endif
- #ifndef BOOST_STATIC_STRING_STANDALONE
- template <std::size_t N,
- typename CharT,
- typename Traits>
- std::size_t
- hash_value(
- const basic_static_string<N, CharT, Traits>& str)
- {
- return boost::hash_range(str.begin(), str.end());
- }
- #endif
- }
- using static_strings::static_string;
- using static_strings::static_wstring;
- using static_strings::static_u16string;
- using static_strings::static_u32string;
- }
- namespace std {
- template<std::size_t N, typename CharT, typename Traits>
- struct hash<
- #ifdef BOOST_STATIC_STRING_DOCS
- basic_static_string
- #else
- boost::static_strings::basic_static_string<N, CharT, Traits>
- #endif
- >
- {
- std::size_t
- operator()(
- const boost::static_strings::basic_static_string<N, CharT, Traits>& str) const noexcept
- {
- #ifndef BOOST_STATIC_STRING_STANDALONE
- return boost::hash_range(str.begin(), str.end());
- #else
- using view_type = typename
- boost::static_strings::basic_string_view<CharT, Traits>;
- return std::hash<view_type>()(view_type(str.data(), str.size()));
- #endif
- }
- };
- }
- #ifndef BOOST_STATIC_STRING_DOCS
- namespace boost {
- namespace static_strings {
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- assign(
- size_type count,
- value_type ch) ->
- basic_static_string&
- {
- if (count > max_size())
- detail::throw_exception<std::length_error>(
- "count > max_size()");
- this->set_size(count);
- traits_type::assign(data(), size(), ch);
- return term();
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- assign(
- const_pointer s,
- size_type count) ->
- basic_static_string&
- {
- if (count > max_size())
- detail::throw_exception<std::length_error>(
- "count > max_size()");
- this->set_size(count);
- traits_type::move(data(), s, size());
- return term();
- }
- template<std::size_t N, typename CharT, typename Traits>
- template<typename InputIterator>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- assign(
- InputIterator first,
- InputIterator last) ->
- typename std::enable_if<
- detail::is_input_iterator<InputIterator>::value,
- basic_static_string&>::type
- {
- auto ptr = data();
- for (std::size_t i = 0; first != last; ++first, ++ptr, ++i)
- {
- if (i >= max_size())
- {
- this->set_size(i);
- term();
- detail::throw_exception<std::length_error>("n > max_size()");
- }
- traits_type::assign(*ptr, *first);
- }
- this->set_size(ptr - data());
- return term();
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- insert(
- const_iterator pos,
- size_type count,
- value_type ch) ->
- iterator
- {
- const auto curr_size = size();
- const auto curr_data = data();
- if (count > max_size() - curr_size)
- detail::throw_exception<std::length_error>(
- "count > max_size() - curr_size");
- const auto index = pos - curr_data;
- traits_type::move(&curr_data[index + count], &curr_data[index], curr_size - index + 1);
- traits_type::assign(&curr_data[index], count, ch);
- this->set_size(curr_size + count);
- return &curr_data[index];
- }
- template<std::size_t N, typename CharT, typename Traits>
- template<typename ForwardIterator>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- insert(
- const_iterator pos,
- ForwardIterator first,
- ForwardIterator last) ->
- typename std::enable_if<
- detail::is_forward_iterator<
- ForwardIterator>::value, iterator>::type
- {
- const auto curr_size = size();
- const auto curr_data = data();
- const std::size_t count = detail::distance(first, last);
- const std::size_t index = pos - curr_data;
- const auto first_addr = &*first;
- if (count > max_size() - curr_size)
- detail::throw_exception<std::length_error>(
- "count > max_size() - curr_size");
- const bool inside = detail::ptr_in_range(curr_data, curr_data + curr_size, first_addr);
- if (!inside || (inside && (first_addr + count <= pos)))
- {
- traits_type::move(&curr_data[index + count], &curr_data[index], curr_size - index + 1);
- detail::copy_with_traits<Traits>(first, last, &curr_data[index]);
- }
- else
- {
- const size_type offset = first_addr - curr_data;
- traits_type::move(&curr_data[index + count], &curr_data[index], curr_size - index + 1);
- if (offset < index)
- {
- const size_type diff = index - offset;
- traits_type::copy(&curr_data[index], &curr_data[offset], diff);
- traits_type::copy(&curr_data[index + diff], &curr_data[index + count], count - diff);
- }
- else
- {
- traits_type::copy(&curr_data[index], &curr_data[offset + count], count);
- }
- }
- this->set_size(curr_size + count);
- return curr_data + index;
- }
- template<std::size_t N, typename CharT, typename Traits>
- template<typename InputIterator>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- insert(
- const_iterator pos,
- InputIterator first,
- InputIterator last) ->
- typename std::enable_if<
- detail::is_input_iterator<
- InputIterator>::value &&
- !detail::is_forward_iterator<
- InputIterator>::value, iterator>::type
- {
- const auto curr_size = size();
- const auto curr_data = data();
- const auto count = read_back(false, first, last);
- const std::size_t index = pos - curr_data;
- std::rotate(&curr_data[index], &curr_data[curr_size + 1], &curr_data[curr_size + count + 1]);
- this->set_size(curr_size + count);
- return curr_data + index;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- erase(
- const_iterator first,
- const_iterator last) ->
- iterator
- {
- const auto curr_data = data();
- const std::size_t index = first - curr_data;
- traits_type::move(&curr_data[index], last, (end() - last) + 1);
- this->set_size(size() - std::size_t(last - first));
- return curr_data + index;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- basic_static_string<N, CharT, Traits>::
- push_back(
- value_type ch)
- {
- const auto curr_size = size();
- if (curr_size >= max_size())
- detail::throw_exception<std::length_error>(
- "curr_size >= max_size()");
- traits_type::assign(data()[curr_size], ch);
- this->set_size(curr_size + 1);
- term();
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- append(
- size_type count,
- value_type ch) ->
- basic_static_string&
- {
- const auto curr_size = size();
- if (count > max_size() - curr_size)
- detail::throw_exception<std::length_error>(
- "count > max_size() - size()");
- traits_type::assign(end(), count, ch);
- this->set_size(curr_size + count);
- return term();
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- append(
- const_pointer s,
- size_type count) ->
- basic_static_string&
- {
- const auto curr_size = size();
- if (count > max_size() - curr_size)
- detail::throw_exception<std::length_error>(
- "count > max_size() - size()");
- traits_type::copy(end(), s, count);
- this->set_size(curr_size + count);
- return term();
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- basic_static_string<N, CharT, Traits>::
- resize(size_type n, value_type c)
- {
- if (n > max_size())
- detail::throw_exception<std::length_error>(
- "n > max_size()");
- const auto curr_size = size();
- if(n > curr_size)
- traits_type::assign(data() + curr_size, n - curr_size, c);
- this->set_size(n);
- term();
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- basic_static_string<N, CharT, Traits>::
- swap(basic_static_string& s) noexcept
- {
- const auto curr_size = size();
- basic_static_string tmp(s);
- s.set_size(curr_size);
- traits_type::copy(&s.data()[0], data(), curr_size + 1);
- this->set_size(tmp.size());
- traits_type::copy(data(), tmp.data(), size() + 1);
- }
- template<std::size_t N, typename CharT, typename Traits>
- template<std::size_t M>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- void
- basic_static_string<N, CharT, Traits>::
- swap(basic_static_string<M, CharT, Traits>& s)
- {
- const auto curr_size = size();
- if (curr_size > s.max_size())
- detail::throw_exception<std::length_error>(
- "curr_size > s.max_size()");
- if (s.size() > max_size())
- detail::throw_exception<std::length_error>(
- "s.size() > max_size()");
- basic_static_string tmp(s);
- s.set_size(curr_size);
- traits_type::copy(&s.data()[0], data(), curr_size + 1);
- this->set_size(tmp.size());
- traits_type::copy(data(), &tmp.data()[0], size() + 1);
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- replace(
- const_iterator i1,
- const_iterator i2,
- size_type n,
- value_type c) ->
- basic_static_string<N, CharT, Traits>&
- {
- const auto curr_size = size();
- const auto curr_data = data();
- const std::size_t n1 = i2 - i1;
- if (n > max_size() || curr_size - n1 >= max_size() - n)
- detail::throw_exception<std::length_error>(
- "replaced string exceeds max_size()");
- const auto pos = i1 - curr_data;
- traits_type::move(&curr_data[pos + n], i2, (end() - i2) + 1);
- traits_type::assign(&curr_data[pos], n, c);
- this->set_size((curr_size - n1) + n);
- return *this;
- }
- template<std::size_t N, typename CharT, typename Traits>
- template<typename ForwardIterator>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- replace(
- const_iterator i1,
- const_iterator i2,
- ForwardIterator j1,
- ForwardIterator j2) ->
- typename std::enable_if<
- detail::is_forward_iterator<ForwardIterator>::value,
- basic_static_string<N, CharT, Traits>&>::type
- {
- const auto curr_size = size();
- const auto curr_data = data();
- const auto first_addr = &*j1;
- const std::size_t n1 = i2 - i1;
- const std::size_t n2 = detail::distance(j1, j2);
- const std::size_t pos = i1 - curr_data;
- if (n2 > max_size() || curr_size - (std::min)(n1, curr_size - pos) >= max_size() - n2)
- detail::throw_exception<std::length_error>(
- "replaced string exceeds max_size()");
- const bool inside = detail::ptr_in_range(curr_data, curr_data + curr_size, first_addr);
- if (inside && first_addr == i1 && n1 == n2)
- return *this;
-
- if (!inside || (inside && (first_addr + n2 <= i1)))
- {
-
- traits_type::move(&curr_data[pos + n2], &curr_data[pos + n1], curr_size - pos - n1 + 1);
- detail::copy_with_traits<Traits>(j1, j2, &curr_data[pos]);
- }
- else
- {
-
- const size_type offset = first_addr - curr_data;
- if (n2 >= n1)
- {
-
- const size_type diff = offset <= pos + n1 ? (std::min)((pos + n1) - offset, n2) : 0;
-
- traits_type::move(&curr_data[pos + n2], &curr_data[pos + n1], curr_size - pos - n1 + 1);
-
- traits_type::move(&curr_data[pos], &curr_data[offset], diff);
-
- traits_type::move(&curr_data[pos + diff], &curr_data[(offset - n1) + n2 + diff], n2 - diff);
- }
- else
- {
-
-
- traits_type::move(&curr_data[pos], &curr_data[offset], n2);
-
- traits_type::move(&curr_data[pos + n2], &curr_data[pos + n1], curr_size - pos - n1 + 1);
- }
- }
- this->set_size((curr_size - n1) + n2);
- return *this;
- }
- template<std::size_t N, typename CharT, typename Traits>
- template<typename InputIterator>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- replace(
- const_iterator i1,
- const_iterator i2,
- InputIterator j1,
- InputIterator j2) ->
- typename std::enable_if<
- detail::is_input_iterator<
- InputIterator>::value &&
- !detail::is_forward_iterator<
- InputIterator>::value,
- basic_static_string<N, CharT, Traits>&>::type
- {
- const auto curr_size = size();
- const auto curr_data = data();
- const std::size_t n1 = detail::distance(i1, i2);
- const std::size_t n2 = read_back(false, j1, j2);
- const std::size_t pos = i1 - curr_data;
-
-
- std::rotate(&curr_data[pos], &curr_data[curr_size + 1], &curr_data[curr_size + n2 + 1]);
-
-
- traits_type::move(&curr_data[pos + n2], &curr_data[pos + n2 + n1], ((curr_size - n1) + n2) - pos);
- this->set_size((curr_size - n1) + n2);
- return *this;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- find(
- const_pointer s,
- size_type pos,
- size_type n) const noexcept ->
- size_type
- {
- const auto curr_size = size();
- if (pos > curr_size || n > curr_size - pos)
- return npos;
- if (!n)
- return pos;
- const auto res = detail::search(data() + pos, data() + curr_size, s, s + n, traits_type::eq);
- return res == end() ? npos : detail::distance(data(), res);
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- rfind(
- const_pointer s,
- size_type pos,
- size_type n) const noexcept ->
- size_type
- {
- const auto curr_size = size();
- const auto curr_data = data();
- if (curr_size < n)
- return npos;
- if (pos > curr_size - n)
- pos = curr_size - n;
- if (!n)
- return pos;
- for (auto sub = &curr_data[pos]; sub >= curr_data; --sub)
- if (!traits_type::compare(sub, s, n))
- return detail::distance(curr_data, sub);
- return npos;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- find_first_of(
- const_pointer s,
- size_type pos,
- size_type n) const noexcept ->
- size_type
- {
- const auto curr_data = data();
- if (pos >= size() || !n)
- return npos;
- const auto res = detail::find_first_of(&curr_data[pos], &curr_data[size()], s, &s[n], traits_type::eq);
- return res == end() ? npos : detail::distance(curr_data, res);
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- find_last_of(
- const_pointer s,
- size_type pos,
- size_type n) const noexcept ->
- size_type
- {
- const auto curr_size = size();
- if (!n)
- return npos;
- if (pos >= curr_size)
- pos = 0;
- else
- pos = curr_size - (pos + 1);
- const auto res = detail::find_first_of(rbegin() + pos, rend(), s, &s[n], traits_type::eq);
- return res == rend() ? npos : curr_size - 1 - detail::distance(rbegin(), res);
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- find_first_not_of(
- const_pointer s,
- size_type pos,
- size_type n) const noexcept ->
- size_type
- {
- if (pos >= size())
- return npos;
- if (!n)
- return pos;
- const auto res = detail::find_not_of<Traits>(data() + pos, data() + size(), s, n);
- return res == end() ? npos : detail::distance(data(), res);
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- find_last_not_of(
- const_pointer s,
- size_type pos,
- size_type n) const noexcept ->
- size_type
- {
- const auto curr_size = size();
- if (pos >= curr_size)
- pos = curr_size - 1;
- if (!n)
- return pos;
- pos = curr_size - (pos + 1);
- const auto res = detail::find_not_of<Traits>(rbegin() + pos, rend(), s, n);
- return res == rend() ? npos : curr_size - 1 - detail::distance(rbegin(), res);
- }
- template<std::size_t N, typename CharT, typename Traits>
- template<typename InputIterator>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- read_back(
- bool overwrite_null,
- InputIterator first,
- InputIterator last) ->
- size_type
- {
- const auto curr_data = data();
- auto new_size = size();
- for (; first != last; ++first)
- {
- if (new_size >= max_size())
- {
-
-
- if (overwrite_null)
- term();
- detail::throw_exception<std::length_error>(
- "count > max_size() - size()");
- }
- traits_type::assign(curr_data[new_size++ + (!overwrite_null)], *first);
- }
- return new_size - size();
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- replace_unchecked(
- const_iterator i1,
- const_iterator i2,
- const_pointer s,
- size_type n2) ->
- basic_static_string&
- {
- const auto curr_data = data();
- const auto curr_size = size();
- const std::size_t pos = i1 - curr_data;
- const std::size_t n1 = i2 - i1;
- if (n2 > max_size() || curr_size - (std::min)(n1, curr_size - pos) >= max_size() - n2)
- detail::throw_exception<std::length_error>(
- "replaced string exceeds max_size()");
- traits_type::move(&curr_data[pos + n2], i2, (end() - i2) + 1);
- traits_type::copy(&curr_data[pos], s, n2);
- this->set_size((curr_size - n1) + n2);
- return *this;
- }
- template<std::size_t N, typename CharT, typename Traits>
- BOOST_STATIC_STRING_CPP14_CONSTEXPR
- auto
- basic_static_string<N, CharT, Traits>::
- insert_unchecked(
- const_iterator pos,
- const_pointer s,
- size_type count) ->
- iterator
- {
- const auto curr_data = data();
- const auto curr_size = size();
- if (count > max_size() - curr_size)
- detail::throw_exception<std::length_error>(
- "count > max_size() - curr_size");
- const std::size_t index = pos - curr_data;
- traits_type::move(&curr_data[index + count], pos, (end() - pos) + 1);
- traits_type::copy(&curr_data[index], s, count);
- this->set_size(curr_size + count);
- return curr_data + index;
- }
- }
- }
- #endif
- #endif
|