123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398 |
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- The Boost Parameter Library Reference Documentation
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- :Authors: David Abrahams, Daniel Wallin
- :Contact: dave@boost-consulting.com, daniel@boostpro.com
- :organization: `BoostPro Computing`_
- :date: $Date: 2005/07/17 19:53:01 $
- :copyright: Copyright David Abrahams, Daniel Wallin
- 2005-2009. Distributed under the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt
- or copy at http://www.boost.org/LICENSE_1_0.txt)
- |(logo)|__
- .. |(logo)| image:: ../../../../boost.png
- :alt: Boost
- __ ../../../../index.htm
- .. _`BoostPro Computing`: http://www.boostpro.com
- //////////////////////////////////////////////////////////////////////////////
- .. contents::
- :depth: 2
- //////////////////////////////////////////////////////////////////////////////
- .. role:: class
- :class: class
- .. role:: concept
- :class: concept
- .. role:: function
- :class: function
- .. |ArgumentPack| replace:: :concept:`ArgumentPack`
- .. |ForwardSequence| replace:: :concept:`Forward Sequence`
- .. |ParameterSpec| replace:: :concept:`ParameterSpec`
- .. role:: vellipsis
- :class: vellipsis
- .. section-numbering::
- :depth: 2
- Preliminaries
- =============
- This section covers some basic information you'll need to know in order to
- understand this reference.
- Namespaces
- ----------
- In this document, all unqualified identifiers should be assumed to be defined
- in namespace ``boost::parameter`` unless otherwise specified.
- Exceptions
- ----------
- No operation described in this document throws an exception unless otherwise
- specified.
- Thread Safety
- -------------
- All components of this library can be used safely from multiple threads
- without synchronization. [#thread]_
- Typography
- ----------
- Names written in :concept:`sans serif type` represent concepts_.
- In code blocks, *italic type* represents unspecified text that satisfies the
- requirements given in the detailed description that follows the code block.
- In a specification of the tokens generated by a macro, **bold type** is used
- to highlight the position of the expanded macro argument in the result.
- The special character β represents the value of |BOOST_PARAMETER_MAX_ARITY|_.
- //////////////////////////////////////////////////////////////////////////////
- Terminology
- ===========
- .. |kw| replace:: keyword
- .. _kw:
- keyword
- The name of a function parameter.
- .. _keyword tag type:
- .. |keyword tag type| replace:: `keyword tag type`_
- keyword tag type
- A type used to uniquely identify a function parameter. Typically its name
- will be the same as that of the parameter.
- .. _positional:
- .. |positional| replace:: `positional`_
- positional argument
- An argument passed with no explicit |kw|. Its parameter is determined
- in the usual C++ way: by position with respect to a parameter list.
- .. _tag type:
- .. |tag type| replace:: `tag type`_
- tag type
- Shorthand for “\ |keyword tag type|.”
- .. _keyword object:
- .. |keyword object| replace:: `keyword object`_
- keyword object
- An instance of |keyword|_\ ``<T>`` for some |tag type| ``T``.
- .. _tagged reference:
- .. |tagged reference| replace:: `tagged reference`_
- tagged reference
- An object whose type is associated with a |keyword tag type| (the object's
- *keyword*), and that holds a reference (to the object's *value*).
- As a shorthand, a “tagged reference to ``x``\ ” means a tagged reference
- whose *value* is ``x``.
- .. _tagged default:
- .. |tagged default| replace:: `tagged default`_
- tagged default
- A |tagged reference| whose *value* represents the value of a
- default argument.
- .. _tagged lazy default:
- .. |tagged lazy default| replace:: `tagged lazy default`_
- tagged lazy default
- A |tagged reference| whose *value*, when invoked with no arguments,
- computes a default argument value.
- .. _intended argument type:
- .. |intended argument type| replace:: `intended argument type`_
- intended argument type
- The *intended argument type* of a single-element |ArgumentPack|_ is the
- type of its element's *value*. The intended argument type of any other
- type ``X`` is ``X`` itself.
- .. Note::
- In this reference, we will use concept names (and other names) to describe
- both types and objects, depending on context. So for example, “an
- |ArgumentPack|_\ ” can refer to a type that models |ArgumentPack|_
- *or* an object of such a type.
- //////////////////////////////////////////////////////////////////////////////
- Concepts
- ========
- This section describes the generic type concepts used by the Parameter
- library.
- |ArgumentPack|
- --------------
- An |ArgumentPack| is a collection of |tagged reference|\ s to the actual
- arguments passed to a function. Every |ArgumentPack| is also a valid `MPL
- Forward Sequence`_ and `MPL Associative Sequence`_ consisting of the |keyword
- tag type|\ s in its |tagged reference|\ s. If |BOOST_PARAMETER_CAN_USE_MP11|
- is defined, then every |ArgumentPack| is also a valid |Boost_MP11|_ map whose
- keys are |keyword tag type|\ s. The |singular_cpp|_, |compose_cpp|_, and
- |mpl_cpp|_ test programs demonstrate this functionality.
- Requirements
- ............
- In the table below,
- * ``A`` is a model of |ArgumentPack|
- * ``x`` is an instance of ``A``
- * ``u`` is a |keyword object| of type ``K``
- * ``v`` is a |tagged default| with |tag type| ``L`` and *value* of type ``D``
- * ``w`` is a |tagged lazy default| with |tag type| ``M`` and *value* of type ``E const``
- * ``z`` is an |ArgumentPack| containing a single element (as created by |keyword|_\ ``<…>::operator=``)
- Any exceptions thrown from the invocation of ``w``\ 's *value*
- will be propagated to the caller.
- .. table:: |ArgumentPack| requirements
- +------------+---------------------------------+----------------+----------------------+
- | Expression | Type | Requirements | Semantics/Notes |
- +============+=================================+================+======================+
- | ``x[u]`` | ``binding<A, K>::type`` | ``x`` contains | Returns *b*\ 's |
- | | | an element *b* | *value* (by |
- | | | whose |kw|_ is | reference). |
- | | | ``K`` | |
- +------------+---------------------------------+----------------+----------------------+
- | ``x[u]`` | ``binding<A, L, D>::type`` | *none* | If ``x`` contains an |
- | | | | element *b* whose |
- | | | | |kw|_ is the same as |
- | | | | ``u``\ 's, returns |
- | | | | *b*\ 's *value* (by |
- | | | | reference). |
- | | | | Otherwise, returns |
- | | | | ``u``\ 's *value*. |
- +------------+---------------------------------+----------------+----------------------+
- | ``x[w]`` | ``lazy_binding<A, M, E>::type`` | *none* | If ``x`` contains an |
- | | | | element *b* whose |
- | | | | |kw|_ is the same as |
- | | | | ``w``\ 's, returns |
- | | | | *b*\ 's *value* (by |
- | | | | reference). |
- | | | | Otherwise, invokes |
- | | | | ``w``\ 's *value* |
- | | | | and returns the |
- | | | | result. |
- +------------+---------------------------------+----------------+----------------------+
- | ``x, z`` | Model of |ArgumentPack|_ | *none* | Returns an |
- | | | | |ArgumentPack|_ |
- | | | | containing all the |
- | | | | elements of both |
- | | | | ``x`` and ``z``. |
- +------------+---------------------------------+----------------+----------------------+
- .. _parameterspec:
- |ParameterSpec|
- ---------------
- A |ParameterSpec| describes the type requirements for arguments corresponding
- to a given |kw|_ and indicates whether the argument is optional or
- required. The table below details the allowed forms and describes their
- condition for satisfaction by an actual argument type. In each row,
- .. _conditions:
- * ``K`` is the |ParameterSpec|\ 's |keyword tag type|
- * ``A`` is an |intended argument type| associated with ``K``, if any
- * ``P`` is a model of |ArgumentPack| that contains ``A``
- * ``F`` is an `MPL Binary Metafunction Class`_
- .. _`MPL Binary Metafunction Class`: ../../../mpl/doc/refmanual/metafunction-class.html
- .. table:: |ParameterSpec| allowed forms and conditions of satisfaction
- +------------------------+----------+----------------------------------------+
- | Type | ``A`` | Condition ``A`` must satisfy |
- | | required | |
- +========================+==========+========================================+
- | ``K`` | no | *n/a* |
- +------------------------+----------+----------------------------------------+
- | |optional|_\ ``<K,F>`` | no | ``mpl::apply2<F,A,P>::type::value`` is |
- | | | ``true``. |
- +------------------------+----------+----------------------------------------+
- | |required|_\ ``<K,F>`` | yes | ``mpl::apply2<F,A,P>::type::value`` is |
- | | | ``true``. |
- +------------------------+----------+----------------------------------------+
- The information in a |ParameterSpec| is used to `limit`__ the arguments that
- will be matched by `forwarding functions`_.
- __ overloadcontrol_
- .. _overloadcontrol: index.html#controlling-overload-resolution
- .. _forwarding functions: index.html#forwarding-functions
- //////////////////////////////////////////////////////////////////////////////
- Class Templates
- ===============
- .. |keyword| replace:: ``keyword``
- .. _keyword:
- ``keyword``
- -----------
- The type of every |keyword object| is a specialization of |keyword|.
- :Defined in: |keyword_header|_
- .. parsed-literal::
- template <typename Tag>
- struct keyword
- {
- typedef Tag tag;
- template <typename T>
- constexpr typename |boost_enable_if|_\<
- typename |mpl_eval_if|_\<
- |boost_is_scalar|_\<T>
- , |mpl_true|_\ // Enable this overload for scalar types.
- , |mpl_eval_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::in_reference
- >
- , |mpl_true|_\ // Enable this overload for "in" references.
- , |mpl_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::forward_reference
- >
- , |mpl_true|_\ // Enable this overload for "forward" references.
- , |mpl_false|_\ // Disable this overload for all other reference categories.
- >
- >
- >::type
- , |ArgumentPack|_
- >::type
- |assignment operator|_\(T const& value) const;
- template <typename T>
- constexpr typename |boost_enable_if|_\<
- typename |mpl_eval_if|_\<
- typename |mpl_eval_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::out_reference
- >
- , |mpl_true|_\ // The reference category is "out".
- , |mpl_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::forward_reference
- >
- , |mpl_true|_\ // The reference category is "forward".
- , |mpl_false|_\ // The reference category is neither "out" nor "forward".
- >
- >::type
- , |mpl_if|_\<
- |boost_is_const|_\<T>
- , |mpl_false|_\ // Disable this overload for reference-to-const types.
- , |mpl_true|_\ // Enable this overload for referece-to-mutable types.
- >
- , |mpl_false|_\ // Disable this overload for references neither "out" nor "forward".
- >::type
- , |ArgumentPack|_
- >::type
- |assignment operator|_\(T& value) const;
- template <typename T>
- constexpr typename |boost_enable_if|_\<
- typename |mpl_eval_if|_\<
- |boost_is_scalar|_\<T>
- , |mpl_false|_\ // Disable this overload for scalar types.
- , |mpl_eval_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::in_reference
- >
- , |mpl_true|_\ // Enable this overload for "in" references.
- , |mpl_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::forward_reference
- >
- , |mpl_true|_\ // Enable this overload for "forward" references.
- , |mpl_false|_\ // Disable this overload for all other reference categories.
- >
- >
- >::type
- , |ArgumentPack|_
- >::type
- |assignment operator|_\(T const&& value) const;
- template <typename T>
- constexpr typename |boost_enable_if|_\<
- typename |mpl_eval_if|_\<
- |boost_is_scalar|_\<T>
- , |mpl_false|_\ // Disable this overload for scalar types.
- , |mpl_eval_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::consume_reference
- >
- , |mpl_true|_\ // Enable this overload for "consume" references.
- , |mpl_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::forward_reference
- >
- , |mpl_true|_\ // Enable this overload for "forward" references.
- , |mpl_false|_\ // Disable this overload for all other reference categories.
- >
- >
- >::type
- , |ArgumentPack|_
- >::type
- |assignment operator|_\(T&& value) const;
- template <typename T>
- constexpr typename |boost_enable_if|_\<
- typename |mpl_eval_if|_\<
- |boost_is_scalar|_\<T>
- , |mpl_true|_\ // Enable this overload for scalar types.
- , |mpl_eval_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::in_reference
- >
- , |mpl_true|_\ // Enable this overload for "in" references.
- , |mpl_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::forward_reference
- >
- , |mpl_true|_\ // Enable this overload for "forward" references.
- , |mpl_false|_\ // Disable this overload for all other reference categories.
- >
- >
- >::type
- , *tagged default*
- >::type
- |bitwise or operator|_\(T const& x) const;
- template <typename T>
- constexpr typename |boost_enable_if|_\<
- typename |mpl_eval_if|_\<
- typename |mpl_eval_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::out_reference
- >
- , |mpl_true|_\ // The reference category is "out".
- , |mpl_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::forward_reference
- >
- , |mpl_true|_\ // The reference category is "forward".
- , |mpl_false|_\ // The reference category is neither "out" nor "forward".
- >
- >::type
- , |mpl_if|_\<
- |boost_is_const|_\<T>
- , |mpl_false|_\ // Disable this overload for reference-to-const types.
- , |mpl_true|_\ // Enable this overload for referece-to-mutable types.
- >
- , |mpl_false|_\ // Disable this overload for references neither "out" nor "forward".
- >::type
- , *tagged default*
- >::type
- |bitwise or operator|_\(T& x) const;
- template <typename T>
- constexpr typename |boost_enable_if|_\<
- typename |mpl_eval_if|_\<
- |boost_is_scalar|_\<T>
- , |mpl_false|_\ // Disable this overload for scalar types.
- , |mpl_eval_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::in_reference
- >
- , |mpl_true|_\ // Enable this overload for "in" references.
- , |mpl_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::forward_reference
- >
- , |mpl_true|_\ // Enable this overload for "forward" references.
- , |mpl_false|_\ // Disable this overload for all other reference categories.
- >
- >
- >::type
- , *tagged default*
- >::type
- |bitwise or operator|_\(T const&& x) const;
- template <typename T>
- constexpr typename |boost_enable_if|_\<
- typename |mpl_eval_if|_\<
- |boost_is_scalar|_\<T>
- , |mpl_false|_\ // Disable this overload for scalar types.
- , |mpl_eval_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::consume_reference
- >
- , |mpl_true|_\ // Enable this overload for "consume" references.
- , |mpl_if|_\<
- |boost_is_same|_\<
- typename Tag\:\:qualifier
- , boost::parameter::forward_reference
- >
- , |mpl_true|_\ // Enable this overload for "forward" references.
- , |mpl_false|_\ // Disable this overload for all other reference categories.
- >
- >
- >::type
- , *tagged default*
- >::type constexpr
- |bitwise or operator|_\(T&& value) const;
- template <typename F>
- constexpr *tagged lazy default* |logical or operator|_\(F const&) const;
- template <typename F>
- constexpr *tagged lazy default* |logical or operator|_\(F&) const;
- static keyword<Tag> const& instance;
- static keyword<Tag>& get_\();
- };
- .. |assignment operator| replace:: ``operator=``
- .. _assignment operator:
- ``operator=``
- :Synopsis:
- .. parsed-literal::
- template <typename T>
- constexpr |ArgumentPack|_ operator=(T const& value) const;
- template <typename T>
- constexpr |ArgumentPack|_ operator=(T& value) const;
- template <typename T>
- constexpr |ArgumentPack|_ operator=(T const&& value) const;
- template <typename T>
- constexpr |ArgumentPack|_ operator=(T&& value) const;
- :Requires: one of the following:
- * The nested ``qualifier`` type of ``Tag`` must be ``forward_reference``.
- * To use the ``const`` lvalue reference overload, ``T`` must be scalar, or
- the nested ``qualifier`` type of ``Tag`` must be ``in_reference``.
- * To use the mutable lvalue reference overload, the nested ``qualifier``
- type of ``Tag`` must be ``out_reference`` or ``in_out_reference``, and
- ``T`` must not be ``const``-qualified.
- * To use the ``const`` rvalue reference overload for non-scalar ``T``, the
- nested ``qualifier`` type of ``Tag`` must be ``in_reference``.
- * To use the mutable rvalue reference overload for non-scalar ``T``, the
- nested ``qualifier`` type of ``Tag`` must be ``consume_reference`` or
- ``move_from_reference``.
- :Returns: an |ArgumentPack|_ containing a single |tagged reference| to
- ``value`` with |kw|_ ``Tag``
- .. |bitwise or operator| replace:: ``operator|``
- .. _bitwise or operator:
- ``operator|``
- :Synopsis:
- .. parsed-literal::
- template <typename T>
- constexpr *tagged default* operator|(T const& x) const;
- template <typename T>
- constexpr *tagged default* operator|(T& x) const;
- template <typename T>
- constexpr *tagged default* operator|(T const&& x) const;
- template <typename T>
- constexpr *tagged default* operator|(T&& x) const;
- :Requires: one of the following:
- * The nested ``qualifier`` type of ``Tag`` must be ``forward_reference``.
- * To use the ``const`` lvalue reference overload, ``T`` must be scalar, or
- the nested ``qualifier`` type of ``Tag`` must be ``in_reference``.
- * To use the mutable lvalue reference overload, the nested ``qualifier``
- type of ``Tag`` must be ``out_reference`` or ``in_out_reference``, and
- ``T`` must not be ``const``-qualified.
- * To use the ``const`` rvalue reference overload for non-scalar ``T``, the
- nested ``qualifier`` type of ``Tag`` must be ``in_reference``.
- * To use the mutable rvalue reference overload for non-scalar ``T``, the
- nested ``qualifier`` type of ``Tag`` must be ``consume_reference`` or
- ``move_from_reference``.
- :Returns: a |tagged default| with *value* ``x`` and |kw|_ ``Tag``.
- .. |logical or operator| replace:: ``operator||``
- .. _logical or operator:
- ``operator||``
- :Synopsis:
- .. parsed-literal::
- template <typename F>
- constexpr *tagged lazy default* operator||(F const& g) const;
- template <typename F>
- constexpr *tagged lazy default* operator||(F& g) const;
- :Requires: ``g()`` must be valid, with type
- |boost_result_of|_\ ``<F()>::type``. [#no_result_of]_
- :Returns: a |tagged lazy default| with *value* ``g`` and |kw|_ ``Tag``.
- .. _instance:
- ``instance``
- :Synopsis:
- .. parsed-literal::
- static keyword<Tag> const& instance;
- :Returns: a “singleton instance”: the same object will be returned on each
- invocation of ``instance``.
- :Thread Safety:
- ``instance`` can be accessed from multiple threads simultaneously.
- .. _get:
- ``get``
- :Synopsis:
- .. parsed-literal::
- static keyword<Tag>& get\();
- .. admonition:: Deprecated
- This function has been deprecated in favor of ``instance``.
- :Returns: a “singleton instance”: the same object will be returned on each
- invocation of ``get()``.
- :Thread Safety: ``get()`` can be called from multiple threads simultaneously.
- .. |template_keyword| replace:: ``template_keyword``
- .. _template_keyword:
- ``template_keyword``
- --------------------
- This class template encapsulates a named template parameter. Every type
- generated by the |BOOST_PARAMETER_TEMPLATE_KEYWORD|_ macro is a specialization
- of |template_keyword|.
- :Defined in: |template_keyword_header|_
- .. parsed-literal::
- template <typename Tag, typename T>
- struct template_keyword
- {
- typedef Tag key_type;
- typedef T value_type;
- typedef *implementation defined* reference;
- };
- The |ntp_cpp|_ test program demonstrates proper usage of this class template.
- .. |parameters| replace:: ``parameters``
- .. _parameters:
- ``parameters``
- --------------
- Provides an interface for assembling the actual arguments to a `forwarding
- function` into an |ArgumentPack|, in which any |positional| arguments will be
- tagged according to the corresponding template argument to ``parameters``.
- .. _forwarding function: `forwarding functions`_
- :Defined in: |parameters_header|_
- .. parsed-literal::
- template <typename ...PSpec>
- struct parameters
- {
- template <typename ...Args>
- struct |match|_
- {
- typedef … type;
- };
- template <typename ...Args>
- |ArgumentPack|_ |function call operator|_\(Args&&... args) const;
- };
- :Requires: Each element in the ``PSpec`` parameter pack must be a model of
- |ParameterSpec|_.
- .. Note::
- In this section, ``R`` ## *i* and ``K`` ## *i* are defined as
- follows, for any argument type ``A`` ## *i*:
- | let ``D0`` the set [d0, …, d ## *j*] of all **deduced**
- | *parameter specs* in the ``PSpec`` parameter pack
- | ``R`` ## *i* is the |intended argument type| of ``A`` ## *i*
- |
- | if ``A`` ## *i* is a result type of ``keyword<T>::`` |assignment operator|_
- | then
- | ``K`` ## *i* is ``T``
- | else
- | if some ``A`` ## *j* where *j* ≤ *i* is a result type of
- | ``keyword<T>::`` |assignment operator|_
- | *or* some ``P`` ## *j* in *j* ≤ *i* is **deduced**
- | then
- | if some *parameter spec* ``d`` ## *j* in ``D`` ## *i*
- | matches ``A`` ## *i*
- | then
- | ``K`` ## *i* is the |keyword tag type| of ``d`` ## *j*.
- | ``D``:sub:`i+1` is ``D`` ## *i* - [ ``d`` ## *j*]
- | else
- | ``K`` ## *i* is the |keyword tag type| of ``P`` ## *i*.
- .. |match| replace:: ``match``
- .. _match:
- ``match``
- A `Metafunction`_ used to remove a `forwarding function`_ from overload
- resolution.
- :Returns: if all elements in ``Params...`` are *satisfied* (see below), then
- ``parameters<Params...>``. Otherwise, ``match<Args...>::type`` is not
- defined.
- Each element ``P`` in ``Params...`` is **satisfied** if either:
- * ``P`` is the *unspecified* default
- * **or**, ``P`` is a *keyword tag type*
- * **or**, ``P`` is |optional|_ ``<X,F>`` and either
- - ``X`` is not ``K`` ## *i* for any *i*,
- - **or** ``X`` is some ``K`` ## *i* and ``mpl::apply<F,R`` ## *i*\
- ``>::type::value`` is ``true``
- * **or**, ``P`` is |required|_ ``<X,F>``, and
- - ``X`` is some ``K`` ## *i*, **and**
- - ``mpl::apply<F,R`` ## *i* ``>::type::value`` is ``true``
- .. |function call operator| replace:: ``operator()``
- .. _function call operator:
- ``operator()``
- :Synopsis:
- .. parsed-literal::
- template <typename ...Args>
- |ArgumentPack|_ operator()(Args&&... args) const;
- :Returns: An |ArgumentPack|_ containing, for each ``a`` ## *i*,
- - if ``a`` ## *i* is a single-element |ArgumentPack|, its element
- - Otherwise, a |tagged reference| with |kw|_ ``K`` ## *i* and *value*
- ``a`` ## *i*
- .. |optional| replace:: ``optional``
- .. |required| replace:: ``required``
- .. _optional:
- .. _required:
- ``optional``, ``required``
- --------------------------
- These templates describe the requirements on a function parameter.
- ``optional`` is defined in: |optional_header|_
- ``required`` is defined in: |required_header|_
- Both headers are included by: |preprocessor_header|_
- :Specializations model: |ParameterSpec|_
- .. parsed-literal::
- template <typename Tag, typename Predicate = *unspecified*>
- struct optional;
- template <typename Tag, typename Predicate = *unspecified*>
- struct required;
- The default value of ``Predicate`` is an unspecified `MPL Binary Metafunction
- Class`_ that returns ``mpl::true_`` for any argument. If
- |BOOST_PARAMETER_CAN_USE_MP11|_ is defined, then the default value of
- ``Predicate`` is also a |Boost_MP11|_-style quoted metafunction that returns
- ``mp11::mp_true`` for any argument.
- .. |deduced| replace:: ``deduced``
- .. _deduced:
- ``deduced``
- -----------
- This template is used to wrap the *keyword tag* argument to
- ``optional`` or ``required``.
- :Defined in: |deduced_header|_
- :Included by: |preprocessor_header|_
- .. parsed-literal::
- template <typename Tag>
- struct deduced;
- :Requires: nothing
- //////////////////////////////////////////////////////////////////////////////
- Metafunctions
- =============
- A `Metafunction`_ is conceptually a function that operates on, and returns,
- C++ types.
- .. |binding| replace:: ``binding``
- .. _binding:
- ``binding``
- -----------
- Returns the result type of indexing an argument pack with a
- |keyword tag type| or with a |tagged default|.
- :Defined in: |binding_header|_
- .. parsed-literal::
- template <typename A, typename K, typename D = void\_>
- struct binding
- {
- typedef … type;
- };
- :Requires: ``A`` must be a model of |ArgumentPack|_.
- :Returns: the reference type of the |tagged reference| in ``A`` having
- |keyword tag type| ``K``, if any. If no such |tagged reference| exists,
- returns ``D``.
- .. |lazy_binding| replace:: ``lazy_binding``
- .. _lazy_binding:
- ``lazy_binding``
- ----------------
- Returns the result type of indexing an argument pack with a
- |tagged lazy default|.
- :Defined in: |binding_header|_
- .. parsed-literal::
- template <typename A, typename K, typename F>
- struct lazy_binding
- {
- typedef … type;
- };
- :Requires: ``A`` must be a model of |ArgumentPack|_.
- :Returns: the reference type of the |tagged reference| in ``A`` having
- |keyword tag type| ``K``, if any. If no such |tagged reference| exists,
- returns |boost_result_of|_\ ``<F()>::type``. [#no_result_of]_
- .. |value_type| replace:: ``value_type``
- .. _value_type:
- ``value_type``
- --------------
- Returns the result type of indexing an argument pack with a
- |keyword tag type| or with a |tagged default|.
- :Defined in: |value_type_header|_
- .. parsed-literal::
- template <typename A, typename K, typename D = void\_>
- struct value_type
- {
- typedef … type;
- };
- :Requires: ``A`` must be a model of |ArgumentPack|_.
- :Returns: the (possibly const-qualified) type of the |tagged reference| in
- ``A`` having |keyword tag type| ``K``, if any. If no such
- |tagged reference| exists, returns ``D``. Equivalent to:
- .. parsed-literal::
- typename |boost_remove_reference|_\<
- typename |binding|_\<A, K, D>::type
- >::type
- … when ``D`` is not a reference type.
- .. |lazy_value_type| replace:: ``lazy_value_type``
- .. _lazy_value_type:
- ``lazy_value_type``
- -------------------
- Returns the result type of indexing an argument pack with a
- |tagged lazy default|.
- :Defined in: |value_type_header|_
- .. parsed-literal::
- template <typename A, typename K, typename F>
- struct lazy_value_type
- {
- typedef … type;
- };
- :Requires: ``A`` must be a model of |ArgumentPack|_.
- :Returns: the (possibly const-qualified) type of the |tagged reference| in
- ``A`` having |keyword tag type| ``K``, if any. If no such
- |tagged reference| exists, returns
- |boost_result_of|_\ ``<F()>::type``. [#no_result_of]_
- .. |are_tagged_arguments| replace:: ``are_tagged_arguments``
- .. _are_tagged_arguments:
- ``are_tagged_arguments``
- ------------------------
- :Defined in: |are_tagged_arguments_header|_
- .. parsed-literal::
- template <typename T0, typename ...Pack>
- struct are_tagged_arguments
- // : |mpl_true|_\ if T0 and all elements in Pack are
- // tagged reference types, |mpl_false|_\ otherwise.
- {
- };
- :Returns:
- ``mpl::true_`` if ``T0`` and all elements in parameter pack ``Pack`` are
- |tagged reference| types, ``mpl::false_`` otherwise.
- :Example usage:
- When implementing a Boost.Parameter-enabled constructor for a container that
- conforms to the C++ standard, one needs to remember that the standard requires
- the presence of other constructors that are typically defined as templates,
- such as range constructors. To avoid overload ambiguities between the two
- constructors, use this metafunction in conjunction with ``disable_if`` to
- define the range constructor.
- .. parsed-literal::
- template <typename B>
- class frontend : public B
- {
- struct _enabler
- {
- };
- public:
- |BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR|_\(frontend, (B))
- template <typename Iterator>
- frontend(
- Iterator itr
- , Iterator itr_end
- , typename |boost_disable_if|_\<
- are_tagged_arguments<Iterator>
- , _enabler
- >::type = _enabler()
- ) : B(itr, itr_end)
- {
- }
- };
- .. |is_argument_pack| replace:: ``is_argument_pack``
- .. _is_argument_pack:
- ``is_argument_pack``
- --------------------
- :Defined in: |is_argument_pack_header|_
- .. parsed-literal::
- template <typename T>
- struct is_argument_pack
- // : |mpl_true|_\ if T is a model of |ArgumentPack|_\,
- // |mpl_false|_\ otherwise.
- {
- };
- :Returns:
- ``mpl::true_`` if ``T`` is a model of |ArgumentPack|_, ``mpl::false_``
- otherwise.
- :Example usage:
- To avoid overload ambiguities between a constructor that takes in an
- |ArgumentPack|_ and a templated conversion constructor, use this
- metafunction in conjunction with ``enable_if``.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\(a0)
- template <typename T>
- class backend0
- {
- struct _enabler
- {
- };
- T a0;
- public:
- template <typename ArgPack>
- explicit backend0(
- ArgPack const& args
- , typename |boost_enable_if|_\<
- is_argument_pack<ArgPack>
- , _enabler
- >::type = _enabler()
- ) : a0(args[_a0])
- {
- }
- template <typename U>
- backend0(
- backend0<U> const& copy
- , typename |boost_enable_if|_\<
- |boost_is_convertible|_\<U,T>
- , _enabler
- >::type = _enabler()
- ) : a0(copy.get_a0())
- {
- }
- T const& get_a0() const
- {
- return this->a0;
- }
- };
- .. |result_of_compose| replace:: ``result_of::compose``
- .. _result_of_compose:
- ``result_of::compose``
- ----------------------
- Returns the result type of the |compose|_ function.
- :Defined in: |compose_header|_
- .. parsed-literal::
- template <typename ...TaggedArgs>
- struct compose
- : |boost_enable_if|_\<
- |are_tagged_arguments|_\<T0,Pack...>
- , |ArgumentPack|_
- >
- {
- };
- template <>
- struct compose<>
- {
- typedef *empty* |ArgumentPack|_ type;
- };
- :Requires: All elements in ``TaggedArgs`` must be |tagged reference| types, if
- specified.
- :Returns: the result type of the |compose|_ function.
- //////////////////////////////////////////////////////////////////////////////
- Function Templates
- ==================
- .. |compose| replace:: ``compose``
- .. _compose:
- ``compose``
- -----------
- :Defined in: |compose_header|_
- .. parsed-literal::
- template <typename ...Pack>
- constexpr typename |result_of_compose|_\<Pack...>::type
- compose(Pack const&... args);
- This function facilitates easier variadic argument composition. It is used by
- the |BOOST_PARAMETER_NO_SPEC_FUNCTION|_,
- |BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION|_,
- |BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION|_,
- |BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR|_,
- |BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR|_,
- |BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR|_, and
- |BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR|_ code generation macros. You
- can use it to write your own code generation macros if the ones provided by
- this library do not suffice.
- Unlike the |tagged reference| comma operator, the ``compose()`` function is
- variadic, as mentioned before. However, the |tagged reference| comma operator
- can be invoked indefinitely and therefore does not limit the size of the
- resulting |ArgumentPack|, while the ``compose()`` function cannot take in more
- than |BOOST_PARAMETER_COMPOSE_MAX_ARITY|_ arguments for compilers that do not
- support perfect forwarding.
- :Requires: All elements in ``args`` must be |tagged reference| objects, if
- specified.
- :Returns: an |ArgumentPack|_ containing all elements in ``args``, if
- specified; an empty |ArgumentPack|_ otherwise.
- :Example usage:
- .. parsed-literal::
- BOOST_PARAMETER_NAME(index)
- BOOST_PARAMETER_NAME(name)
- template <typename ArgumentPack>
- int print_name_and_index(ArgumentPack const& args)
- {
- std::cout << "index = " << args[_index];
- std::cout << "name = " << args[_name];
- std::cout << "; " << std::endl;
- return 0;
- }
- int y = print_name_and_index(compose(_index = 3, _name = "jones"));
- The |compose_cpp|_ test program shows more examples using this function.
- //////////////////////////////////////////////////////////////////////////////
- Code Generation Macros
- ======================
- Macros in this section can be used to ease the writing of code
- using the Parameter library by eliminating repetitive boilerplate.
- .. |BOOST_PARAMETER_FUNCTION| replace:: ``BOOST_PARAMETER_FUNCTION``
- .. _BOOST_PARAMETER_FUNCTION:
- ``BOOST_PARAMETER_FUNCTION(result, name, tag_namespace, arguments)``
- --------------------------------------------------------------------
- :Defined in: |preprocessor_header|_
- Generates a function that can take in positional arguments, composed
- arguments, named arguments, and deduced arguments.
- :Example usage:
- The return type of each of the following function templates falls under a
- different value category.
- .. parsed-literal::
- template <std::size_t N>
- |std_bitset|_\<N + 1> rvalue_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const rvalue_const_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1>& lvalue_bitset()
- {
- static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
- return lset;
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const& lvalue_const_bitset()
- {
- static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
- return clset;
- }
- The ``U::evaluate_category`` static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
- .. parsed-literal::
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is ``kw`` in this case. The identifiers with leading
- underscores can be passed to the bracket operator of ``args`` to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
- |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
- |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
- |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
- Use the macro as a substitute for a normal function header. Enclose the
- return type ``bool`` in parentheses. For each parameter, also enclose the
- expected value type in parentheses. Since the value types are mutually
- exclusive, you can wrap the parameters in a ``(deduced …)``
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. Also, just as with a normal
- function, optional parameters have default values, whereas required parameters
- do not. Within the function body, either simply use the parameter name or
- pass the matching identifier with the leading underscore to the bracket
- operator of ``args`` to extract the corresponding argument. Note that the
- second method doesn't require ``std::forward`` to preserve value categories.
- .. parsed-literal::
- BOOST_PARAMETER_FUNCTION((bool), evaluate, kw,
- (deduced
- (required
- (lrc, (|std_bitset|_\<1>))
- (lr, (|std_bitset|_\<2>))
- )
- (optional
- (rrc, (|std_bitset|_\<3>), rvalue_const_bitset<2>())
- (rr, (|std_bitset|_\<4>), rvalue_bitset<3>())
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(lrc)
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(lr)
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(|std_forward|_\<rrc0_type>(rrc0))
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(args[_rr0])
- );
- return true;
- }
- The following function calls are legal.
- .. parsed-literal::
- evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- evaluate(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- evaluate( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- evaluate( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- Because the parameters were wrapped in a ``(deduced …)`` clause, the following
- function calls are also legal.
- .. parsed-literal::
- evaluate( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- evaluate( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- The |preprocessor_cpp|_, |preprocessor_deduced_cpp|_, and
- |preprocessor_eval_cat_cpp|_ test programs demonstrate proper usage of this
- macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function.
- * ``name`` is the base name of the function; it determines the name of the
- generated forwarding functions.
- * ``tag_namespace`` is the namespace in which the keywords used by the
- function resides.
- * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
- *argument-specifiers*, as defined below.
- **Argument specifiers syntax:**
- .. parsed-literal::
- argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
- specifier-group0 ::= *specifier-group1* |
- (
- '**(**' '**deduced**'
- *specifier-group1* {*specifier-group1*\ }
- '**)**'
- )
- specifier-group1 ::=
- (
- '**(**' '**optional**'
- *optional-specifier* {*optional-specifier*\ }
- '**)**'
- ) | (
- '**(**' '**required**'
- *required-specifier* {*required-specifier*\ }
- '**)**'
- )
- optional-specifier ::=
- '**(**'
- *argument-name* '**,**' *restriction* '**,**' *default-value*
- ')'
- required-specifier ::=
- '**(**' *argument-name* '**,**' *restriction* ')'
- restriction ::=
- ( '**\***' '**(**' *mfc* '**)**' ) |
- ( '**(**' *type-name* '**)**' ) |
- '**\***'
- * ``argument-name`` is any valid C++ identifier.
- * ``default-value`` is any valid C++ expression; if necessary, user code can
- compute it in terms of ``previous-name ## _type``, where ``previous-name``
- is the ``argument-name`` in a previous ``specifier-group0`` or
- ``specifier-group1``. *This expression will be invoked exactly once.*
- * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
- be the type of the corresponding ``argument-name``, whose second argument
- will be the entire |ArgumentPack|_, and whose return type is a `Boolean
- Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
- of ``previous-name ## _type``.
- * ``type-name`` is either the name of a **target type** or an `MPL Binary
- Metafunction Class`_ whose first argument will be the type of the
- corresponding ``argument-name``, whose second argument will be the entire
- |ArgumentPack|_, and whose return type is the **target type**. If
- ``restriction`` uses this form, then the type of the generated name
- ``argument-name ## _type`` will be computed in terms of the **target
- type**, and the generated reference ``argument-name`` (but not its
- corresponding entry in ``args``) will be cast to that type.
- **Approximate expansion:**
- Where:
- * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
- * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename Args>
- using boost_param_result\_ ## __LINE__ ## **name** = **result**;
- // If **result** is a simple return type:
- template <typename Args>
- struct boost_param_result\_ ## __LINE__ ## **name**
- {
- typedef **result** type;
- };
- struct boost_param_params\_ ## __LINE__ ## **name**
- : |parameters|_\<
- *list of parameter specifications, based on arguments*
- >
- {
- };
- typedef boost_param_params\_ ## __LINE__ ## **name**
- boost_param_parameters\_ ## __LINE__ ## **name**;
- template <typename Args>
- typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type
- boost_param_impl ## __LINE__ ## **name**\ (Args const&);
- template <typename A0, …, typename A ## **n**>
- **result** **name**\ (
- A0&& a0, …, A ## **n**\ && a ## **n**
- , typename boost_param_parameters\_ ## __LINE__ ## **name**
- ::match<A0, …, A ## **n**>::type
- = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
- )
- {
- return boost_param_impl ## __LINE__ ## **name**\ (
- boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **n**>(a ## **n**)
- )
- );
- }
- :vellipsis:`⋮`
- template <typename A0, …, typename A ## **m**>
- **result** **name**\ (
- A0&& a0, …, A ## **m**\ && a ## **m**
- , typename boost_param_parameters\_ ## __LINE__ ## **name**
- ::match<A0, …, A ## **m**>::type
- = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
- )
- {
- return boost_param_impl ## __LINE__ ## **name**\ (
- boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **m**>(a ## **m**)
- )
- );
- }
- template <
- typename ResultType
- , typename Args
- , typename *argument name* ## **0** ## _type
- , …
- , typename *argument name* ## **n** ## _type
- >
- ResultType
- boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
- (ResultType(*)())
- , Args const& args
- , *argument name* ## **0** ## _type&& *argument name* ## **0**
- , …
- , *argument name* ## **n** ## _type&& *argument name* ## **m**
- );
- :vellipsis:`⋮`
- template <
- typename ResultType
- , typename Args
- , typename *argument name* ## **0** ## _type
- , …
- , typename *argument name* ## **m** ## _type
- >
- ResultType
- boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
- (ResultType(*)())
- , Args const& args
- , *argument name* ## **0** ## _type&& *argument name* ## **0**
- , …
- , *argument name* ## **m** ## _type&& *argument name* ## **m**
- );
- template <typename Args>
- typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type
- boost_param_impl ## __LINE__ ## **name**\ (Args const& args)
- {
- return boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
- static_cast<
- typename boost_param_result\_ ## __LINE__ ## **name**\ <
- Args
- >::type(*)()
- >(|std_nullptr|_\)
- , args
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of required parameter* ## **0**
- >::type
- >(args[ *keyword object of required parameter* ## **0**])
- , …
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of required parameter* ## **n**
- >::type
- >(args[ *keyword object of required parameter* ## **n**])
- );
- }
- template <
- typename ResultType
- , typename Args
- , typename *argument name* ## **0** ## _type
- , …
- , typename *argument name* ## **n** ## _type
- >
- ResultType
- boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
- (ResultType(*)())
- , Args const& args
- , *argument name* ## **0** ## _type&& *argument name* ## **0**
- , …
- , *argument name* ## **n** ## _type&& *argument name* ## **n**
- )
- {
- return boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
- static_cast<ResultType(*)()>(|std_nullptr|_\)
- , (args, *keyword object of optional parameter* ## **n + 1** =
- *default value of optional parameter* ## **n + 1**
- )
- , |std_forward|_\<*argument name* ## **0** ## _type>(
- *argument name* ## **0**
- )
- , …
- , |std_forward|_\<*argument name* ## **n** ## _type>(
- *argument name* ## **n**
- )
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of optional parameter* ## **n + 1**
- >::type
- >(*default value of optional parameter* ## **n + 1**)
- );
- }
- :vellipsis:`⋮`
- template <
- typename ResultType
- , typename Args
- , typename *argument name* ## **0** ## _type
- , …
- , typename *argument name* ## **m** ## _type
- >
- ResultType
- boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
- (ResultType(*)())
- , Args const& args
- , *argument name* ## **0** ## _type&& *argument name* ## **0**
- , …
- , *argument name* ## **m** ## _type&& *argument name* ## **m**
- )
- .. |BOOST_PARAMETER_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_MEMBER_FUNCTION``
- .. _BOOST_PARAMETER_MEMBER_FUNCTION:
- ``BOOST_PARAMETER_MEMBER_FUNCTION(result, name, tag_namespace, arguments)``
- ---------------------------------------------------------------------------
- :Defined in: |preprocessor_header|_
- Generates a member function that can take in positional arguments, composed
- arguments, named arguments, and deduced arguments.
- :Example usage:
- The return type of each of the following function templates falls under a
- different value category.
- .. parsed-literal::
- template <std::size_t N>
- |std_bitset|_\<N + 1> rvalue_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const rvalue_const_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1>& lvalue_bitset()
- {
- static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
- return lset;
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const& lvalue_const_bitset()
- {
- static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
- return clset;
- }
- The ``U::evaluate_category`` static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
- .. parsed-literal::
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is ``kw`` in this case. The identifiers with leading
- underscores can be passed to the bracket operator of ``args`` to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
- |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
- |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
- |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
- Use the macro as a substitute for a normal ``static`` member function
- header. Enclose the return type ``bool`` in parentheses. For each parameter,
- also enclose the expected value type in parentheses. Since the value types
- are mutually exclusive, you can wrap the parameters in a ``(deduced …)``
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. Also, just as with a normal
- function, optional parameters have default values, whereas required parameters
- do not. Within the function body, either simply use the parameter name or
- pass the matching identifier with the leading underscore to the bracket
- operator of ``args`` to extract the corresponding argument. Note that the
- second method doesn't require ``std::forward`` to preserve value categories.
- .. parsed-literal::
- struct B
- {
- BOOST_PARAMETER_MEMBER_FUNCTION((bool), static evaluate, kw,
- (deduced
- (required
- (lrc, (|std_bitset|_\<1>))
- (lr, (|std_bitset|_\<2>))
- )
- (optional
- (rrc, (|std_bitset|_\<3>), rvalue_const_bitset<2>())
- (rr, (|std_bitset|_\<4>), rvalue_bitset<3>())
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(lrc)
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(lr)
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(|std_forward|_\<rrc0_type>(rrc0))
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(args[_rr0])
- );
- return true;
- }
- };
- The following function calls are legal.
- .. parsed-literal::
- B::evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- B::evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- B::evaluate(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- B::evaluate( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- B::evaluate( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- Because the parameters were wrapped in a ``(deduced …)`` clause, the following
- function calls are also legal.
- .. parsed-literal::
- B::evaluate( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- B::evaluate( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- The |preprocessor_cpp|_ and |preprocessor_eval_cat_cpp|_ test programs
- demonstrate proper usage of this macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function.
- * ``name`` is the base name of the function; it determines the name of the
- generated forwarding functions. ``name`` may be qualified by the
- ``static`` keyword to declare the member function and its helpers as not
- associated with any object of the enclosing type.
- * ``tag_namespace`` is the namespace in which the keywords used by the
- function resides.
- * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
- *argument-specifiers*, as defined below.
- **Argument specifiers syntax:**
- .. parsed-literal::
- argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
- specifier-group0 ::= *specifier-group1* |
- (
- '**(**' '**deduced**'
- *specifier-group1* {*specifier-group1*\ }
- '**)**'
- )
- specifier-group1 ::=
- (
- '**(**' '**optional**'
- *optional-specifier* {*optional-specifier*\ }
- '**)**'
- ) | (
- '**(**' '**required**'
- *required-specifier* {*required-specifier*\ }
- '**)**'
- )
- optional-specifier ::=
- '**(**'
- *argument-name* '**,**' *restriction* '**,**' *default-value*
- ')'
- required-specifier ::=
- '**(**' *argument-name* '**,**' *restriction* ')'
- restriction ::=
- ( '**\***' '**(**' *mfc* '**)**' ) |
- ( '**(**' *type-name* '**)**' ) |
- '**\***'
- * ``argument-name`` is any valid C++ identifier.
- * ``default-value`` is any valid C++ expression; if necessary, user code can
- compute it in terms of ``previous-name ## _type``, where ``previous-name``
- is the ``argument-name`` in a previous ``specifier-group0`` or
- ``specifier-group1``. *This expression will be invoked exactly once.*
- * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
- be the type of the corresponding ``argument-name``, whose second argument
- will be the entire |ArgumentPack|_, and whose return type is a `Boolean
- Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
- of ``previous-name ## _type``.
- * ``type-name`` is either the name of a **target type** or an `MPL Binary
- Metafunction Class`_ whose first argument will be the type of the
- corresponding ``argument-name``, whose second argument will be the entire
- |ArgumentPack|_, and whose return type is the **target type**. If
- ``restriction`` uses this form, then the type of the generated name
- ``argument-name ## _type`` will be computed in terms of the **target
- type**, and the generated reference ``argument-name`` (but not its
- corresponding entry in ``args``) will be cast to that type.
- **Approximate expansion:**
- Where:
- * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
- * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename Args>
- using boost_param_result\_ ## __LINE__ ## **name** = **result**;
- // If **result** is a simple return type:
- template <typename Args>
- struct boost_param_result\_ ## __LINE__ ## **name**
- {
- typedef **result** type;
- };
- struct boost_param_params\_ ## __LINE__ ## **name**
- : |parameters|_\<
- *list of parameter specifications, based on arguments*
- >
- {
- };
- typedef boost_param_params\_ ## __LINE__ ## **name**
- boost_param_parameters\_ ## __LINE__ ## **name**;
- template <typename A0, …, typename A ## **n**>
- **result** **name**\ (
- A0&& a0, …, A ## **n**\ && a ## **n**
- , typename boost_param_parameters\_ ## __LINE__ ## **name**
- ::match<A0, …, A ## **n**>::type
- = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
- )
- {
- return this->boost_param_impl ## __LINE__ ## **name**\ (
- boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **n**>(a ## **n**)
- )
- );
- }
- :vellipsis:`⋮`
- template <typename A0, …, typename A ## **m**>
- **result** **name**\ (
- A0&& a0, …, A ## **m**\ && a ## **m**
- , typename boost_param_parameters\_ ## __LINE__ ## **name**
- ::match<A0, …, A ## **m**>::type
- = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
- )
- {
- return this->boost_param_impl ## __LINE__ ## **name**\ (
- boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **m**>(a ## **m**)
- )
- );
- }
- template <typename Args>
- typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type
- boost_param_impl ## __LINE__ ## **name**\ (Args const& args)
- {
- return this->boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
- static_cast<
- typename boost_param_result\_ ## __LINE__ ## **name**\ <
- Args
- >::type(*)()
- >(|std_nullptr|_\)
- , args
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of required parameter* ## **0**
- >::type
- >(args[ *keyword object of required parameter* ## **0**])
- , …
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of required parameter* ## **n**
- >::type
- >(args[ *keyword object of required parameter* ## **n**])
- );
- }
- template <
- typename ResultType
- , typename Args
- , typename *argument name* ## **0** ## _type
- , …
- , typename *argument name* ## **n** ## _type
- >
- ResultType
- boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
- (ResultType(*)())
- , Args const& args
- , *argument name* ## **0** ## _type&& *argument name* ## **0**
- , …
- , *argument name* ## **n** ## _type&& *argument name* ## **n**
- )
- {
- return this->boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
- static_cast<ResultType(*)()>(|std_nullptr|_\)
- , (args, *keyword object of optional parameter* ## **n + 1** =
- *default value of optional parameter* ## **n + 1**
- )
- , |std_forward|_\<*argument name* ## **0** ## _type>(
- *argument name* ## **0**
- )
- , …
- , |std_forward|_\<*argument name* ## **n** ## _type>(
- *argument name* ## **n**
- )
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of optional parameter* ## **n + 1**
- >::type
- >(*default value of optional parameter* ## **n + 1**)
- );
- }
- :vellipsis:`⋮`
- template <
- typename ResultType
- , typename Args
- , typename *argument name* ## **0** ## _type
- , …
- , typename *argument name* ## **m** ## _type
- >
- ResultType
- boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
- (ResultType(*)())
- , Args const& args
- , *argument name* ## **0** ## _type&& *argument name* ## **0**
- , …
- , *argument name* ## **m** ## _type&& *argument name* ## **m**
- )
- .. |BOOST_PARAMETER_CONST_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_CONST_MEMBER_FUNCTION``
- .. _BOOST_PARAMETER_CONST_MEMBER_FUNCTION:
- ``BOOST_PARAMETER_CONST_MEMBER_FUNCTION(result, name, tag_ns, arguments)``
- --------------------------------------------------------------------------
- :Defined in: |preprocessor_header|_
- Generates a member function that can take in positional arguments, composed
- arguments, named arguments, and deduced arguments.
- :Example usage:
- The return type of each of the following function templates falls under a
- different value category.
- .. parsed-literal::
- template <std::size_t N>
- |std_bitset|_\<N + 1> rvalue_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const rvalue_const_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1>& lvalue_bitset()
- {
- static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
- return lset;
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const& lvalue_const_bitset()
- {
- static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
- return clset;
- }
- The ``U::evaluate_category`` static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
- .. parsed-literal::
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is ``kw`` in this case. The identifiers with leading
- underscores can be passed to the bracket operator of ``args`` to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
- |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
- |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
- |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
- Use the macro as a substitute for a normal ``const`` member function
- header. Enclose the return type ``bool`` in parentheses. For each parameter,
- also enclose the expected value type in parentheses. Since the value types
- are mutually exclusive, you can wrap the parameters in a ``(deduced …)``
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. Also, just as with a normal
- function, optional parameters have default values, whereas required parameters
- do not. Within the function body, either simply use the parameter name or
- pass the matching identifier with the leading underscore to the bracket
- operator of ``args`` to extract the corresponding argument. Note that the
- second method doesn't require ``std::forward`` to preserve value categories.
- .. parsed-literal::
- struct B
- {
- B()
- {
- }
- BOOST_PARAMETER_CONST_MEMBER_FUNCTION((bool), evaluate, kw,
- (deduced
- (required
- (lrc, (|std_bitset|_\<1>))
- (lr, (|std_bitset|_\<2>))
- )
- (optional
- (rrc, (|std_bitset|_\<3>), rvalue_const_bitset<2>())
- (rr, (|std_bitset|_\<4>), rvalue_bitset<3>())
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(lrc)
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(lr)
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(|std_forward|_\<rrc0_type>(rrc0))
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(args[_rr0])
- );
- return true;
- }
- };
- The following function calls are legal.
- .. parsed-literal::
- B const b = B();
- b.evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- b.evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- b.evaluate(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- b.evaluate( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- b.evaluate( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- Because the parameters were wrapped in a ``(deduced …)`` clause, the following
- function calls are also legal.
- .. parsed-literal::
- b.evaluate( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- b.evaluate( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- The |preprocessor_cpp|_ test program demonstrates proper usage of this macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function.
- * ``name`` is the base name of the function; it determines the name of the
- generated forwarding functions.
- * ``tag_namespace`` is the namespace in which the keywords used by the
- function resides.
- * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
- *argument-specifiers*, as defined below.
- **Argument specifiers syntax:**
- .. parsed-literal::
- argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
- specifier-group0 ::= *specifier-group1* |
- (
- '**(**' '**deduced**'
- *specifier-group1* {*specifier-group1*\ }
- '**)**'
- )
- specifier-group1 ::=
- (
- '**(**' '**optional**'
- *optional-specifier* {*optional-specifier*\ }
- '**)**'
- ) | (
- '**(**' '**required**'
- *required-specifier* {*required-specifier*\ }
- '**)**'
- )
- optional-specifier ::=
- '**(**'
- *argument-name* '**,**' *restriction* '**,**' *default-value*
- ')'
- required-specifier ::=
- '**(**' *argument-name* '**,**' *restriction* ')'
- restriction ::=
- ( '**\***' '**(**' *mfc* '**)**' ) |
- ( '**(**' *type-name* '**)**' ) |
- '**\***'
- * ``argument-name`` is any valid C++ identifier.
- * ``default-value`` is any valid C++ expression; if necessary, user code can
- compute it in terms of ``previous-name ## _type``, where ``previous-name``
- is the ``argument-name`` in a previous ``specifier-group0`` or
- ``specifier-group1``. *This expression will be invoked exactly once.*
- * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
- be the type of the corresponding ``argument-name``, whose second argument
- will be the entire |ArgumentPack|_, and whose return type is a `Boolean
- Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
- of ``previous-name ## _type``.
- * ``type-name`` is either the name of a **target type** or an `MPL Binary
- Metafunction Class`_ whose first argument will be the type of the
- corresponding ``argument-name``, whose second argument will be the entire
- |ArgumentPack|_, and whose return type is the **target type**. If
- ``restriction`` uses this form, then the type of the generated name
- ``argument-name ## _type`` will be computed in terms of the **target
- type**, and the generated reference ``argument-name`` (but not its
- corresponding entry in ``args``) will be cast to that type.
- **Approximate expansion:**
- Where:
- * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
- * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename Args>
- using boost_param_result_const\_ ## __LINE__ ## **name** = **result**;
- // If **result** is a simple return type:
- template <typename Args>
- struct boost_param_result_const\_ ## __LINE__ ## **name**
- {
- typedef **result** type;
- };
- struct boost_param_params_const\_ ## __LINE__ ## **name**
- : |parameters|_\<
- *list of parameter specifications, based on arguments*
- >
- {
- };
- typedef boost_param_params_const\_ ## __LINE__ ## **name**
- boost_param_parameters_const\_ ## __LINE__ ## **name**;
- template <typename A0, …, typename A ## **n**>
- **result** **name**\ (
- A0&& a0, …, A ## **n**\ && a ## **n**
- , typename boost_param_parameters_const\_ ## __LINE__ ## **name**
- ::match<A0, …, A ## **n**>::type
- = boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## **name**\ (
- boost_param_parameters_const\_ ## __LINE__ ## **name**\ (
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **n**>(a ## **n**)
- )
- );
- }
- :vellipsis:`⋮`
- template <typename A0, …, typename A ## **m**>
- **result** **name**\ (
- A0&& a0, …, A ## **m**\ && a ## **m**
- , typename boost_param_parameters_const\_ ## __LINE__ ## **name**
- ::match<A0, …, A ## **m**>::type
- = boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## **name**\ (
- boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **m**>(a ## **m**)
- )
- );
- }
- template <typename Args>
- typename boost_param_result_const\_ ## __LINE__ ## **name**\ <Args>::type
- boost_param_impl_const ## __LINE__ ## **name**\ (Args const& args) const
- {
- return this->
- boost_param_dispatch_const_0boost\_ ## __LINE__ ## **name**\ (
- static_cast<
- typename boost_param_result_const\_ ## __LINE__ ## **name**\ <
- Args
- >::type(*)()
- >(|std_nullptr|_\)
- , args
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of required parameter* ## **0**
- >::type
- >(args[ *keyword object of required parameter* ## **0**])
- , …
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of required parameter* ## **n**
- >::type
- >(args[ *keyword object of required parameter* ## **n**])
- );
- }
- template <
- typename ResultType
- , typename Args
- , typename *argument name* ## **0** ## _type
- , …
- , typename *argument name* ## **n** ## _type
- >
- ResultType
- boost_param_dispatch_const_0boost\_ ## __LINE__ ## **name**\ (
- (ResultType(*)())
- , Args const& args
- , *argument name* ## **0** ## _type&& *argument name* ## **0**
- , …
- , *argument name* ## **n** ## _type&& *argument name* ## **n**
- ) const
- {
- return this->
- boost_param_dispatch_const_0boost\_ ## __LINE__ ## **name**\ (
- static_cast<ResultType(*)()>(|std_nullptr|_\)
- , (args, *keyword object of optional parameter* ## **n + 1** =
- *default value of optional parameter* ## **n + 1**
- )
- , |std_forward|_\<*argument name* ## **0** ## _type>(
- *argument name* ## **0**
- )
- , …
- , |std_forward|_\<*argument name* ## **n** ## _type>(
- *argument name* ## **n**
- )
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of optional parameter* ## **n + 1**
- >::type
- >(*default value of optional parameter* ## **n + 1**)
- );
- }
- :vellipsis:`⋮`
- template <
- typename ResultType
- , typename Args
- , typename *argument name* ## **0** ## _type
- , …
- , typename *argument name* ## **m** ## _type
- >
- ResultType
- boost_param_dispatch_const_0boost\_ ## __LINE__ ## **name**\ (
- (ResultType(*)())
- , Args const& args
- , *argument name* ## **0** ## _type&& *argument name* ## **0**
- , …
- , *argument name* ## **m** ## _type&& *argument name* ## **m**
- ) const
- .. |BOOST_PARAMETER_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_FUNCTION_CALL_OPERATOR``
- .. _BOOST_PARAMETER_FUNCTION_CALL_OPERATOR:
- ``BOOST_PARAMETER_FUNCTION_CALL_OPERATOR(result, tag_namespace, arguments)``
- ----------------------------------------------------------------------------
- :Defined in: |preprocessor_header|_
- Generates a function call operator that can take in positional arguments,
- composed arguments, named arguments, and deduced arguments.
- :Example usage:
- Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is ``tag`` by default.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\(y)
- |BOOST_PARAMETER_NAME|_\(z)
- Use the macro as a substitute for a normal function call operator
- header. Enclose the return type in parentheses. For each parameter, also
- enclose the expected value type in parentheses. Since the value types are
- mutually exclusive, you can wrap the parameters in a ``(deduced …)``
- clause. This is especially useful when implementing multiple
- Boost.Parameter-enabled function call operator overloads.
- .. parsed-literal::
- class char_reader
- {
- int index;
- char const* key;
- public:
- explicit char_reader(char const* k) : index(0), key(k)
- {
- }
- BOOST_PARAMETER_FUNCTION_CALL_OPERATOR((void), tag,
- (deduced
- (required
- (y, (int))
- (z, (char const*))
- )
- )
- )
- {
- this->index = y;
- this->key = z;
- }
- |BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR|_\((char), tag,
- (deduced
- (required
- (y, (bool))
- (z, (|std_map|_\<char const*, |std_string|_\>))
- )
- )
- )
- {
- return y ? (
- (z.find(this->key)->second)[this->index]
- ) : this->key[this->index];
- }
- };
- As with regular argument-dependent lookup, the value types of the arguments
- passed in determine which function call operator overload gets invoked.
- .. parsed-literal::
- char const* keys[] = {"foo", "bar", "baz"};
- |std_map|_\<char const*, |std_string|_\> k2s;
- k2s[keys[0]] = |std_string|_\("qux");
- k2s[keys[1]] = |std_string|_\("wmb");
- k2s[keys[2]] = |std_string|_\("zxc");
- char_reader r(keys[0]);
- // positional arguments
- BOOST_TEST_EQ('q', (r(true, k2s)));
- BOOST_TEST_EQ('f', (r(false, k2s)));
- // named arguments
- r(_z = keys[1], _y = 1);
- BOOST_TEST_EQ('m', (r(_z = k2s, _y = true)));
- BOOST_TEST_EQ('a', (r(_z = k2s, _y = false)));
- // deduced arguments
- r(keys[2], 2);
- BOOST_TEST_EQ('c', (r(k2s, true)));
- BOOST_TEST_EQ('z', (r(k2s, false)));
- The |preprocessor_cpp|_ and |preprocessor_deduced_cpp|_ test programs
- demonstrate proper usage of this macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function call operator.
- * ``tag_namespace`` is the namespace in which the keywords used by the
- function call operator resides.
- * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
- *argument-specifiers*, as defined below.
- **Argument specifiers syntax:**
- .. parsed-literal::
- argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
- specifier-group0 ::= *specifier-group1* |
- (
- '**(**' '**deduced**'
- *specifier-group1* {*specifier-group1*\ }
- '**)**'
- )
- specifier-group1 ::=
- (
- '**(**' '**optional**'
- *optional-specifier* {*optional-specifier*\ }
- '**)**'
- ) | (
- '**(**' '**required**'
- *required-specifier* {*required-specifier*\ }
- '**)**'
- )
- optional-specifier ::=
- '**(**'
- *argument-name* '**,**' *restriction* '**,**' *default-value*
- ')'
- required-specifier ::=
- '**(**' *argument-name* '**,**' *restriction* ')'
- restriction ::=
- ( '**\***' '**(**' *mfc* '**)**' ) |
- ( '**(**' *type-name* '**)**' ) |
- '**\***'
- * ``argument-name`` is any valid C++ identifier.
- * ``default-value`` is any valid C++ expression; if necessary, user code can
- compute it in terms of ``previous-name ## _type``, where ``previous-name``
- is the ``argument-name`` in a previous ``specifier-group0`` or
- ``specifier-group1``. *This expression will be invoked exactly once.*
- * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
- be the type of the corresponding ``argument-name``, whose second argument
- will be the entire |ArgumentPack|_, and whose return type is a `Boolean
- Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
- of ``previous-name ## _type``.
- * ``type-name`` is either the name of a **target type** or an `MPL Binary
- Metafunction Class`_ whose first argument will be the type of the
- corresponding ``argument-name``, whose second argument will be the entire
- |ArgumentPack|_, and whose return type is the **target type**. If
- ``restriction`` uses this form, then the type of the generated name
- ``argument-name ## _type`` will be computed in terms of the **target
- type**, and the generated reference ``argument-name`` (but not its
- corresponding entry in ``args``) will be cast to that type.
- **Approximate expansion:**
- Where:
- * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
- * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename Args>
- using boost_param_result\_ ## __LINE__ ## operator = **result**;
- // If **result** is a simple return type:
- template <typename Args>
- struct boost_param_result\_ ## __LINE__ ## operator
- {
- typedef **result** type;
- };
- struct boost_param_params\_ ## __LINE__ ## operator
- : |parameters|_\<
- *list of parameter specifications, based on arguments*
- >
- {
- };
- typedef boost_param_params\_ ## __LINE__ ## operator
- boost_param_parameters\_ ## __LINE__ ## operator;
- template <typename A0, …, typename A ## **n**>
- **result** operator()(
- A0&& a0, …, A ## **n**\ && a ## **n**
- , typename boost_param_parameters\_ ## __LINE__ ## operator::match<
- A0, …, A ## **n**
- >::type = boost_param_parameters\_ ## __LINE__ ## operator()
- )
- {
- return this->boost_param_impl ## __LINE__ ## operator(
- boost_param_parameters\_ ## __LINE__ ## operator()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **n**>(a ## **n**)
- )
- );
- }
- :vellipsis:`⋮`
- template <typename A0, …, typename A ## **m**>
- **result** operator()(
- A0&& a0, …, A ## **m**\ && a ## **m**
- , typename boost_param_parameters\_ ## __LINE__ ## operator::match<
- A0, …, A ## **m**
- >::type = boost_param_parameters\_ ## __LINE__ ## operator()
- )
- {
- return this->boost_param_impl ## __LINE__ ## operator(
- boost_param_parameters\_ ## __LINE__ ## operator()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **m**>(a ## **m**)
- )
- );
- }
- template <typename Args>
- typename boost_param_result\_ ## __LINE__ ## operator<Args>::type
- boost_param_impl ## __LINE__ ## operator(Args const& args)
- {
- return this->boost_param_dispatch_0boost\_ ## __LINE__ ## operator(
- static_cast<
- typename boost_param_result\_ ## __LINE__ ## operator<
- Args
- >::type(*)()
- >(|std_nullptr|_\)
- , args
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of required parameter* ## **0**
- >::type
- >(args[ *keyword object of required parameter* ## **0**])
- , …
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of required parameter* ## **n**
- >::type
- >(args[ *keyword object of required parameter* ## **n**])
- );
- }
- template <
- typename ResultType
- , typename Args
- , typename *argument name* ## **0** ## _type
- , …
- , typename *argument name* ## **n** ## _type
- >
- ResultType
- boost_param_dispatch_0boost\_ ## __LINE__ ## operator(
- (ResultType(*)())
- , Args const& args
- , *argument name* ## **0** ## _type&& *argument name* ## **0**
- , …
- , *argument name* ## **n** ## _type&& *argument name* ## **n**
- )
- {
- return this->boost_param_dispatch_0boost\_ ## __LINE__ ## operator(
- static_cast<ResultType(*)()>(|std_nullptr|_\)
- , (args, *keyword object of optional parameter* ## **n + 1** =
- *default value of optional parameter* ## **n + 1**
- )
- , |std_forward|_\<*argument name* ## **0** ## _type>(
- *argument name* ## **0**
- )
- , …
- , |std_forward|_\<*argument name* ## **n** ## _type>(
- *argument name* ## **n**
- )
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of optional parameter* ## **n + 1**
- >::type
- >(*default value of optional parameter* ## **n + 1**)
- );
- }
- :vellipsis:`⋮`
- template <
- typename ResultType
- , typename Args
- , typename *argument name* ## **0** ## _type
- , …
- , typename *argument name* ## **m** ## _type
- >
- ResultType
- boost_param_dispatch_0boost\_ ## __LINE__ ## operator(
- (ResultType(*)())
- , Args const& args
- , *argument name* ## **0** ## _type&& *argument name* ## **0**
- , …
- , *argument name* ## **m** ## _type&& *argument name* ## **m**
- )
- .. |BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR``
- .. _BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR:
- ``BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, arguments)``
- ---------------------------------------------------------------------------
- :Defined in: |preprocessor_header|_
- Generates a function call operator that can take in positional arguments,
- composed arguments, named arguments, and deduced arguments.
- :Example usage:
- The return type of each of the following function templates falls under a
- different value category.
- .. parsed-literal::
- template <std::size_t N>
- |std_bitset|_\<N + 1> rvalue_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const rvalue_const_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1>& lvalue_bitset()
- {
- static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
- return lset;
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const& lvalue_const_bitset()
- {
- static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
- return clset;
- }
- The ``U::evaluate_category`` static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
- .. parsed-literal::
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is ``kw`` in this case. The identifiers with leading
- underscores can be passed to the bracket operator of ``args`` to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
- |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
- |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
- |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
- Use the macro as a substitute for a normal ``const`` function call operator
- header. Enclose the return type ``bool`` in parentheses. For each parameter,
- also enclose the expected value type in parentheses. Since the value types
- are mutually exclusive, you can wrap the parameters in a ``(deduced …)``
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. Also, just as with a normal
- function, optional parameters have default values, whereas required parameters
- do not. Within the function body, either simply use the parameter name or
- pass the matching identifier with the leading underscore to the bracket
- operator of ``args`` to extract the corresponding argument. Note that the
- second method doesn't require ``std::forward`` to preserve value categories.
- .. parsed-literal::
- struct B
- {
- B()
- {
- }
- BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR((bool), kw,
- (deduced
- (required
- (lrc, (|std_bitset|_\<1>))
- (lr, (|std_bitset|_\<2>))
- )
- (optional
- (rrc, (|std_bitset|_\<3>), rvalue_const_bitset<2>())
- (rr, (|std_bitset|_\<4>), rvalue_bitset<3>())
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(lrc)
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(lr)
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(|std_forward|_\<rrc0_type>(rrc0))
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(args[_rr0])
- );
- return true;
- }
- };
- The following function calls are legal.
- .. parsed-literal::
- B const b = B();
- b( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- b( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- b(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- b( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- b( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- Because the parameters were wrapped in a ``(deduced …)`` clause, the following
- function calls are also legal.
- .. parsed-literal::
- b( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- b( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- The |preprocessor_cpp|_, |preprocessor_deduced_cpp|_, and
- |preprocessor_eval_cat_8_cpp|_ test programs demonstrate proper usage of this
- macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function call operator.
- * ``tag_namespace`` is the namespace in which the keywords used by the
- function call operator resides.
- * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
- *argument-specifiers*, as defined below.
- **Argument specifiers syntax:**
- .. parsed-literal::
- argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
- specifier-group0 ::= *specifier-group1* |
- (
- '**(**' '**deduced**'
- *specifier-group1* {*specifier-group1*\ }
- '**)**'
- )
- specifier-group1 ::=
- (
- '**(**' '**optional**'
- *optional-specifier* {*optional-specifier*\ }
- '**)**'
- ) | (
- '**(**' '**required**'
- *required-specifier* {*required-specifier*\ }
- '**)**'
- )
- optional-specifier ::=
- '**(**'
- *argument-name* '**,**' *restriction* '**,**' *default-value*
- ')'
- required-specifier ::=
- '**(**' *argument-name* '**,**' *restriction* ')'
- restriction ::=
- ( '**\***' '**(**' *mfc* '**)**' ) |
- ( '**(**' *type-name* '**)**' ) |
- '**\***'
- * ``argument-name`` is any valid C++ identifier.
- * ``default-value`` is any valid C++ expression; if necessary, user code can
- compute it in terms of ``previous-name ## _type``, where ``previous-name``
- is the ``argument-name`` in a previous ``specifier-group0`` or
- ``specifier-group1``. *This expression will be invoked exactly once.*
- * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
- be the type of the corresponding ``argument-name``, whose second argument
- will be the entire |ArgumentPack|_, and whose return type is a `Boolean
- Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
- of ``previous-name ## _type``.
- * ``type-name`` is either the name of a **target type** or an `MPL Binary
- Metafunction Class`_ whose first argument will be the type of the
- corresponding ``argument-name``, whose second argument will be the entire
- |ArgumentPack|_, and whose return type is the **target type**. If
- ``restriction`` uses this form, then the type of the generated name
- ``argument-name ## _type`` will be computed in terms of the **target
- type**, and the generated reference ``argument-name`` (but not its
- corresponding entry in ``args``) will be cast to that type.
- **Approximate expansion:**
- Where:
- * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
- * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename Args>
- using boost_param_result_const\_ ## __LINE__ ## operator = **result**;
- // If **result** is a simple return type:
- template <typename Args>
- struct boost_param_result_const\_ ## __LINE__ ## operator
- {
- typedef **result** type;
- };
- struct boost_param_params_const\_ ## __LINE__ ## operator
- : |parameters|_\<
- *list of parameter specifications, based on arguments*
- >
- {
- };
- typedef boost_param_params_const\_ ## __LINE__ ## operator
- boost_param_parameters_const\_ ## __LINE__ ## operator;
- template <typename A0, …, typename A ## **n**>
- **result** operator()(
- A0&& a0, …, A ## **n**\ && a ## **n**
- , typename boost_param_parameters_const\_ ## __LINE__ ## operator
- ::match<A0, …, A ## **n**>::type
- = boost_param_parameters_const\_ ## __LINE__ ## operator()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## operator(
- boost_param_parameters_const\_ ## __LINE__ ## operator()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **n**>(a ## **n**)
- )
- );
- }
- :vellipsis:`⋮`
- template <typename A0, …, typename A ## **m**>
- **result** operator()(
- A0&& a0, …, A ## **m**\ && a ## **m**
- , typename boost_param_parameters_const\_ ## __LINE__ ## operator
- ::match<A0, …, A ## **m**>::type
- = boost_param_parameters_const\_ ## __LINE__ ## operator()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## operator(
- boost_param_parameters_const\_ ## __LINE__ ## operator()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **m**>(a ## **m**)
- )
- );
- }
- template <typename Args>
- typename boost_param_result_const\_ ## __LINE__ ## operator<Args>::type
- boost_param_impl_const ## __LINE__ ## operator(Args const& args) const
- {
- return this->
- boost_param_dispatch_const_0boost\_ ## __LINE__ ## operator(
- static_cast<
- typename boost_param_result_const\_ ## __LINE__ ## operator<
- Args
- >::type(*)()
- >(|std_nullptr|_\)
- , args
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of required parameter* ## **0**
- >::type
- >(args[ *keyword object of required parameter* ## **0**])
- , …
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of required parameter* ## **n**
- >::type
- >(args[ *keyword object of required parameter* ## **n**])
- );
- }
- template <
- typename ResultType
- , typename Args
- , typename *argument name* ## **0** ## _type
- , …
- , typename *argument name* ## **n** ## _type
- >
- ResultType
- boost_param_dispatch_const_0boost\_ ## __LINE__ ## operator(
- (ResultType(*)())
- , Args const& args
- , *argument name* ## **0** ## _type&& *argument name* ## **0**
- , …
- , *argument name* ## **n** ## _type&& *argument name* ## **n**
- ) const
- {
- return this->
- boost_param_dispatch_const_0boost\_ ## __LINE__ ## operator(
- static_cast<ResultType(*)()>(|std_nullptr|_\)
- , (args, *keyword object of optional parameter* ## **n + 1** =
- *default value of optional parameter* ## **n + 1**
- )
- , |std_forward|_\<*argument name* ## **0** ## _type>(
- *argument name* ## **0**
- )
- , …
- , |std_forward|_\<*argument name* ## **n** ## _type>(
- *argument name* ## **n**
- )
- , |std_forward|_\<
- typename |value_type|_\<
- Args
- , *keyword tag type of optional parameter* ## **n + 1**
- >::type
- >(*default value of optional parameter* ## **n + 1**)
- );
- }
- :vellipsis:`⋮`
- template <
- typename ResultType
- , typename Args
- , typename *argument name* ## **0** ## _type
- , …
- , typename *argument name* ## **m** ## _type
- >
- ResultType
- boost_param_dispatch_const_0boost\_ ## __LINE__ ## operator(
- (ResultType(*)())
- , Args const& args
- , *argument name* ## **0** ## _type&& *argument name* ## **0**
- , …
- , *argument name* ## **m** ## _type&& *argument name* ## **m**
- ) const
- .. |BOOST_PARAMETER_CONSTRUCTOR| replace:: ``BOOST_PARAMETER_CONSTRUCTOR``
- .. _BOOST_PARAMETER_CONSTRUCTOR:
- ``BOOST_PARAMETER_CONSTRUCTOR(cls, impl, tag_namespace, arguments)``
- --------------------------------------------------------------------
- :Defined in: |preprocessor_header|_
- Generates a constructor that can take in positional arguments, composed
- arguments, named arguments, and deduced arguments.
- :Example usage:
- Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is ``tag`` by default.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\(y)
- |BOOST_PARAMETER_NAME|_\(z)
- In the base class, implement a delegate constructor template that takes in an
- |ArgumentPack|_. You must pass the identifiers with leading underscores to
- ``args`` in order to extract the corresponding arguments.
- .. parsed-literal::
- class char_read_base
- {
- int index;
- char const* key;
- public:
- template <typename Args>
- explicit char_read_base(Args const& args)
- : index(args[_y]), key(args[_z])
- {
- }
- |BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR|_\((char), tag,
- (deduced
- (required
- (y, (bool))
- (z, (|std_map|_\<char const*, |std_string|_\>))
- )
- )
- )
- {
- return y ? (
- (z.find(this->key)->second)[this->index]
- ) : this->key[this->index];
- }
- };
- Use the macro as a substitute for a normal constructor definition. Note the
- lack of an explicit body. Enclose the base type in parentheses. For each
- parameter, also enclose the expected value type in parentheses. Since the
- value types are mutually exclusive, you can wrap the parameters in a
- ``(deduced …)`` clause.
- .. parsed-literal::
- struct char_reader : public char_read_base
- {
- BOOST_PARAMETER_CONSTRUCTOR(char_reader, (char_read_base), tag,
- (deduced
- (required
- (y, (int))
- (z, (char const*))
- )
- )
- )
- };
- The following ``char_reader`` constructor calls are legal.
- .. parsed-literal::
- char const* keys[] = {"foo", "bar", "baz"};
- |std_map|_\<char const*, |std_string|_\> k2s;
- k2s[keys[0]] = |std_string|_\("qux");
- k2s[keys[1]] = |std_string|_\("wmb");
- k2s[keys[2]] = |std_string|_\("zxc");
- // positional arguments
- char_reader r0(0, keys[0]);
- BOOST_TEST_EQ('q', (r0(true, k2s)));
- BOOST_TEST_EQ('f', (r0(false, k2s)));
- // named arguments
- char_reader r1(_z = keys[1], _y = 1);
- BOOST_TEST_EQ('m', (r1(_z = k2s, _y = true)));
- BOOST_TEST_EQ('a', (r1(_z = k2s, _y = false)));
- // deduced arguments
- char_reader r2(keys[2], 2);
- BOOST_TEST_EQ('c', (r2(k2s, true)));
- BOOST_TEST_EQ('z', (r2(k2s, false)));
- The |preprocessor_cpp|_ and |preprocessor_deduced_cpp|_ test programs
- demonstrate proper usage of this macro.
- **Macro parameters:**
- * ``cls`` is the name of the enclosing class.
- * ``impl`` is the parenthesized implementation base class for ``cls``.
- * ``tag_namespace`` is the namespace in which the keywords used by the
- constructor resides.
- * ``arguments`` is a list of *argument-specifiers*, as defined below.
- **Argument specifiers syntax:**
- .. parsed-literal::
- argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
- specifier-group0 ::= *specifier-group1* |
- (
- '**(**' '**deduced**'
- *specifier-group1* {*specifier-group1*\ }
- '**)**'
- )
- specifier-group1 ::=
- (
- '**(**' '**optional**'
- *specifier* {*specifier*\ }
- '**)**'
- ) | (
- '**(**' '**required**'
- *specifier* {*specifier*\ }
- '**)**'
- )
- specifier ::=
- '**(**' *argument-name* '**,**' *restriction* ')'
- restriction ::=
- ( '**\***' '**(**' *mfc* '**)**' ) |
- ( '**(**' *type-name* '**)**' ) |
- '**\***'
- * ``argument-name`` is any valid C++ identifier.
- * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
- be the type of the corresponding ``argument-name``, whose second argument
- will be the entire |ArgumentPack|_, and whose return type is a `Boolean
- Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
- of ``previous-name ## _type``.
- * ``type-name`` is either the name of a **target type** or an `MPL Binary
- Metafunction Class`_ whose first argument will be the type of the
- corresponding ``argument-name``, whose second argument will be the entire
- |ArgumentPack|_, and whose return type is the **target type**.
- Note that *specifier* does not include *default-value*. It is up to the
- delegate constructor in ``impl`` to determine the default value of all
- optional arguments.
- **Approximate expansion:**
- Where:
- * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
- * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
- .. parsed-literal::
- struct boost_param_params\_ ## __LINE__ ## ctor
- : |parameters|_\<
- *list of parameter specifications, based on arguments*
- >
- {
- };
- typedef boost_param_params\_ ## __LINE__ ## ctor
- constructor_parameters ## __LINE__;
- template <typename A0, …, typename A ## **n**>
- **cls**\ (A0&& a0, …, A ## **n** && a ## **n**)
- : **impl**\ (
- constructor_parameters ## __LINE__(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **n**>(a ## **n**)
- )
- )
- {
- }
- :vellipsis:`⋮`
- template <typename A0, …, typename A ## **m**>
- **cls**\ (A0&& a0, …, A ## **m** && a ## **m**)
- : **impl**\ (
- constructor_parameters ## __LINE__(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **m**>(a ## **m**)
- )
- )
- {
- }
- .. |BOOST_PARAMETER_BASIC_FUNCTION| replace:: ``BOOST_PARAMETER_BASIC_FUNCTION``
- .. _BOOST_PARAMETER_BASIC_FUNCTION:
- ``BOOST_PARAMETER_BASIC_FUNCTION(result, name, tag_namespace, arguments)``
- --------------------------------------------------------------------------
- :Defined in: |preprocessor_header|_
- Generates a function that can take in positional arguments, composed
- arguments, named arguments, and deduced arguments.
- :Example usage:
- The return type of each of the following function templates falls under a
- different value category.
- .. parsed-literal::
- template <std::size_t N>
- |std_bitset|_\<N + 1> rvalue_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const rvalue_const_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1>& lvalue_bitset()
- {
- static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
- return lset;
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const& lvalue_const_bitset()
- {
- static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
- return clset;
- }
- The ``U::evaluate_category`` static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
- .. parsed-literal::
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is ``kw`` in this case. The identifiers with leading
- underscores can be passed to the bracket operator of ``args`` to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
- |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
- |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
- |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
- Use the macro as a substitute for a normal function header. Enclose the
- return type ``bool`` in parentheses. For each parameter, also enclose the
- expected value type in parentheses. Since the value types are mutually
- exclusive, you can wrap the parameters in a ``(deduced …)``
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. However, unlike a normal
- function, default values must be specified within the function body. Also
- within the function body, you must pass the matching identifier with the
- leading underscore to the bracket operator of ``args`` to extract the
- corresponding argument, but at least this doesn't require ``std::forward`` to
- preserve value categories.
- .. parsed-literal::
- BOOST_PARAMETER_BASIC_FUNCTION((bool), evaluate, kw,
- (deduced
- (required
- (lrc, (|std_bitset|_\<1>))
- (lr, (|std_bitset|_\<2>))
- )
- (optional
- (rrc, (|std_bitset|_\<3>))
- (rr, (|std_bitset|_\<4>))
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc0 | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(args[_rr0 | rvalue_bitset<3>()])
- );
- return true;
- }
- The following function calls are legal.
- .. parsed-literal::
- evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- evaluate(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- evaluate( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- evaluate( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- Because the parameters were wrapped in a ``(deduced …)`` clause, the following
- function calls are also legal.
- .. parsed-literal::
- evaluate( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- evaluate( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- The |preprocessor_cpp|_ test program demonstrates proper usage of this macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function.
- * ``name`` is the base name of the function; it determines the name of the
- generated forwarding functions.
- * ``tag_namespace`` is the namespace in which the keywords used by the
- function resides.
- * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
- *argument-specifiers*, as defined below.
- **Argument specifiers syntax:**
- .. parsed-literal::
- argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
- specifier-group0 ::= *specifier-group1* |
- (
- '**(**' '**deduced**'
- *specifier-group1* {*specifier-group1*\ }
- '**)**'
- )
- specifier-group1 ::=
- (
- '**(**' '**optional**'
- *specifier* {*specifier*\ }
- '**)**'
- ) | (
- '**(**' '**required**'
- *specifier* {*specifier*\ }
- '**)**'
- )
- specifier ::=
- '**(**' *argument-name* '**,**' *restriction* ')'
- restriction ::=
- ( '**\***' '**(**' *mfc* '**)**' ) |
- ( '**(**' *type-name* '**)**' ) |
- '**\***'
- * ``argument-name`` is any valid C++ identifier.
- * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
- be the type of the corresponding ``argument-name``, whose second argument
- will be the entire |ArgumentPack|_, and whose return type is a `Boolean
- Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
- of ``previous-name ## _type``.
- * ``type-name`` is either the name of a **target type** or an `MPL Binary
- Metafunction Class`_ whose first argument will be the type of the
- corresponding ``argument-name``, whose second argument will be the entire
- |ArgumentPack|_, and whose return type is the **target type**.
- Note that *specifier* does not include *default-value*. It is up to the
- function body to determine the default value of all optional arguments.
- **Approximate expansion:**
- Where:
- * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
- * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename Args>
- using boost_param_result\_ ## __LINE__ ## **name** = **result**;
- // If **result** is a simple return type:
- template <typename Args>
- struct boost_param_result\_ ## __LINE__ ## **name**
- {
- typedef **result** type;
- };
- struct boost_param_params\_ ## __LINE__ ## **name**
- : |parameters|_\<
- *list of parameter specifications, based on arguments*
- >
- {
- };
- typedef boost_param_params\_ ## __LINE__ ## **name**
- boost_param_parameters\_ ## __LINE__ ## **name**;
- template <typename Args>
- typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type
- boost_param_impl ## **name**\ (Args const&);
- template <typename A0, …, typename A ## **n**>
- **result** **name**\ (
- A0&& a0, …, A ## **n**\ && a ## **n**
- , typename boost_param_parameters\_ ## __LINE__ ## **name**
- ::match<A0, …, A ## **n**>::type
- = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
- )
- {
- return boost_param_impl ## __LINE__ ## **name**\ (
- boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **n**>(a ## **n**)
- )
- );
- }
- :vellipsis:`⋮`
- template <typename A0, …, typename A ## **m**>
- **result** **name**\ (
- A0&& a0, …, A ## **m**\ && a ## **m**
- , typename boost_param_parameters\_ ## __LINE__ ## **name**
- ::match<A0, …, A ## **m**>::type
- = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
- )
- {
- return boost_param_impl ## __LINE__ ## **name**\ (
- boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **m**>(a ## **m**)
- )
- );
- }
- template <typename Args>
- typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type
- boost_param_impl ## __LINE__ ## **name**\ (Args const& args)
- Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
- available for use within the function body.
- .. |BOOST_PARAMETER_BASIC_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_BASIC_MEMBER_FUNCTION``
- .. _BOOST_PARAMETER_BASIC_MEMBER_FUNCTION:
- ``BOOST_PARAMETER_BASIC_MEMBER_FUNCTION(result, name, tag_ns, arguments)``
- --------------------------------------------------------------------------
- :Defined in: |preprocessor_header|_
- Generates a member function that can take in positional arguments, composed
- arguments, named arguments, and deduced arguments.
- :Example usage:
- The return type of each of the following function templates falls under a
- different value category.
- .. parsed-literal::
- template <std::size_t N>
- |std_bitset|_\<N + 1> rvalue_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const rvalue_const_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1>& lvalue_bitset()
- {
- static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
- return lset;
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const& lvalue_const_bitset()
- {
- static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
- return clset;
- }
- The ``U::evaluate_category`` static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
- .. parsed-literal::
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is ``kw`` in this case. The identifiers with leading
- underscores can be passed to the bracket operator of ``args`` to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
- |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
- |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
- |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
- Use the macro as a substitute for a normal ``static`` member function
- header. Enclose the return type ``bool`` in parentheses. For each parameter,
- also enclose the expected value type in parentheses. Since the value types
- are mutually exclusive, you can wrap the parameters in a ``(deduced …)``
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. However, unlike a normal
- function, default values must be specified within the function body. Also
- within the function body, you must pass the matching identifier with the
- leading underscore to the bracket operator of ``args`` to extract the
- corresponding argument, but at least this doesn't require ``std::forward`` to
- preserve value categories.
- .. parsed-literal::
- struct B
- {
- BOOST_PARAMETER_BASIC_MEMBER_FUNCTION((bool), static evaluate, kw,
- (deduced
- (required
- (lrc, (|std_bitset|_\<1>))
- (lr, (|std_bitset|_\<2>))
- )
- (optional
- (rrc, (|std_bitset|_\<3>))
- (rr, (|std_bitset|_\<4>))
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc0 | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(
- args[_rr0 | rvalue_bitset<3>()]
- )
- );
- return true;
- }
- };
- The following function calls are legal.
- .. parsed-literal::
- B::evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- B::evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- B::evaluate(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- B::evaluate( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- B::evaluate( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- Because the parameters were wrapped in a ``(deduced …)`` clause, the following
- function calls are also legal.
- .. parsed-literal::
- B::evaluate( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- B::evaluate( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- The |preprocessor_cpp|_ test program demonstrates proper usage of this macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function.
- * ``name`` is the base name of the function; it determines the name of the
- generated forwarding functions. ``name`` may be qualified by the
- ``static`` keyword to declare the member function and its helpers as not
- associated with any object of the enclosing type.
- * ``tag_namespace`` is the namespace in which the keywords used by the
- function resides.
- * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
- *argument-specifiers*, as defined below.
- **Argument specifiers syntax:**
- .. parsed-literal::
- argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
- specifier-group0 ::= *specifier-group1* |
- (
- '**(**' '**deduced**'
- *specifier-group1* {*specifier-group1*\ }
- '**)**'
- )
- specifier-group1 ::=
- (
- '**(**' '**optional**'
- *specifier* {*specifier*\ }
- '**)**'
- ) | (
- '**(**' '**required**'
- *specifier* {*specifier*\ }
- '**)**'
- )
- specifier ::=
- '**(**' *argument-name* '**,**' *restriction* ')'
- restriction ::=
- ( '**\***' '**(**' *mfc* '**)**' ) |
- ( '**(**' *type-name* '**)**' ) |
- '**\***'
- * ``argument-name`` is any valid C++ identifier.
- * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
- be the type of the corresponding ``argument-name``, whose second argument
- will be the entire |ArgumentPack|_, and whose return type is a `Boolean
- Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
- of ``previous-name ## _type``.
- * ``type-name`` is either the name of a **target type** or an `MPL Binary
- Metafunction Class`_ whose first argument will be the type of the
- corresponding ``argument-name``, whose second argument will be the entire
- |ArgumentPack|_, and whose return type is the **target type**.
- Note that *specifier* does not include *default-value*. It is up to the
- function body to determine the default value of all optional arguments.
- **Approximate expansion:**
- Where:
- * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
- * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename Args>
- using boost_param_result\_ ## __LINE__ ## **name** = **result**;
- // If **result** is a simple return type:
- template <typename Args>
- struct boost_param_result\_ ## __LINE__ ## **name**
- {
- typedef **result** type;
- };
- struct boost_param_params\_ ## __LINE__ ## **name**
- : |parameters|_\<
- *list of parameter specifications, based on arguments*
- >
- {
- };
- typedef boost_param_params\_ ## __LINE__ ## **name**
- boost_param_parameters\_ ## __LINE__ ## **name**;
- template <typename A0, …, typename A ## **n**>
- **result** **name**\ (
- A0&& a0, …, A ## **n**\ && a ## **n**
- , typename boost_param_parameters\_ ## __LINE__ ## **name**
- ::match<A0, …, A ## **n**>::type
- = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
- )
- {
- return this->boost_param_impl ## **name**\ (
- boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **n**>(a ## **n**)
- )
- );
- }
- :vellipsis:`⋮`
- template <typename A0, …, typename A ## **m**>
- **result** **name**\ (
- A0&& a0, …, A ## **m**\ && a ## **m**
- , typename boost_param_parameters\_ ## __LINE__ ## **name**
- ::match<A0, …, A ## **m**>::type
- = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
- )
- {
- return this->boost_param_impl ## **name**\ (
- boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **m**>(a ## **m**)
- )
- );
- }
- template <typename Args>
- typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type
- boost_param_impl ## **name**\ (Args const& args)
- Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
- available for use within the function body.
- .. |BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION``
- .. _BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION:
- ``BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION(result, name, tag_ns, args)``
- ---------------------------------------------------------------------------
- :Defined in: |preprocessor_header|_
- Generates a member function that can take in positional arguments, composed
- arguments, named arguments, and deduced arguments.
- :Example usage:
- The return type of each of the following function templates falls under a
- different value category.
- .. parsed-literal::
- template <std::size_t N>
- |std_bitset|_\<N + 1> rvalue_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const rvalue_const_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1>& lvalue_bitset()
- {
- static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
- return lset;
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const& lvalue_const_bitset()
- {
- static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
- return clset;
- }
- The ``U::evaluate_category`` static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
- .. parsed-literal::
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is ``kw`` in this case. The identifiers with leading
- underscores can be passed to the bracket operator of ``args`` to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
- |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
- |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
- |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
- Use the macro as a substitute for a normal ``const`` member function
- header. Enclose the return type ``bool`` in parentheses. For each parameter,
- also enclose the expected value type in parentheses. Since the value types
- are mutually exclusive, you can wrap the parameters in a ``(deduced …)``
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. However, unlike a normal
- function, default values must be specified within the function body. Also
- within the function body, you must pass the matching identifier with the
- leading underscore to the bracket operator of ``args`` to extract the
- corresponding argument, but at least this doesn't require ``std::forward`` to
- preserve value categories.
- .. parsed-literal::
- struct B
- {
- B()
- {
- }
- BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION((bool), evaluate, kw,
- (deduced
- (required
- (lrc, (|std_bitset|_\<1>))
- (lr, (|std_bitset|_\<2>))
- )
- (optional
- (rrc, (|std_bitset|_\<3>))
- (rr, (|std_bitset|_\<4>))
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc0 | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(
- args[_rr0 | rvalue_bitset<3>()]
- )
- );
- return true;
- }
- };
- The following function calls are legal.
- .. parsed-literal::
- B const b = B();
- b.evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- b.evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- b.evaluate(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- b.evaluate( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- b.evaluate( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- Because the parameters were wrapped in a ``(deduced …)`` clause, the following
- function calls are also legal.
- .. parsed-literal::
- b.evaluate( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- b.evaluate( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- The |preprocessor_cpp|_ test program demonstrates proper usage of this macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function.
- * ``name`` is the base name of the function; it determines the name of the
- generated forwarding functions.
- * ``tag_namespace`` is the namespace in which the keywords used by the
- function resides.
- * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
- *argument-specifiers*, as defined below.
- **Argument specifiers syntax:**
- .. parsed-literal::
- argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
- specifier-group0 ::= *specifier-group1* |
- (
- '**(**' '**deduced**'
- *specifier-group1* {*specifier-group1*\ }
- '**)**'
- )
- specifier-group1 ::=
- (
- '**(**' '**optional**'
- *specifier* {*specifier*\ }
- '**)**'
- ) | (
- '**(**' '**required**'
- *specifier* {*specifier*\ }
- '**)**'
- )
- specifier ::=
- '**(**' *argument-name* '**,**' *restriction* ')'
- restriction ::=
- ( '**\***' '**(**' *mfc* '**)**' ) |
- ( '**(**' *type-name* '**)**' ) |
- '**\***'
- * ``argument-name`` is any valid C++ identifier.
- * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
- be the type of the corresponding ``argument-name``, whose second argument
- will be the entire |ArgumentPack|_, and whose return type is a `Boolean
- Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
- of ``previous-name ## _type``.
- * ``type-name`` is either the name of a **target type** or an `MPL Binary
- Metafunction Class`_ whose first argument will be the type of the
- corresponding ``argument-name``, whose second argument will be the entire
- |ArgumentPack|_, and whose return type is the **target type**.
- Note that *specifier* does not include *default-value*. It is up to the
- function body to determine the default value of all optional arguments.
- **Approximate expansion:**
- Where:
- * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
- * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename Args>
- using boost_param_result_const\_ ## __LINE__ ## **name** = **result**;
- // If **result** is a simple return type:
- template <typename Args>
- struct boost_param_result_const\_ ## __LINE__ ## **name**
- {
- typedef **result** type;
- };
- struct boost_param_params_const\_ ## __LINE__ ## **name**
- : |parameters|_\<
- *list of parameter specifications, based on arguments*
- >
- {
- };
- typedef boost_param_params_const\_ ## __LINE__ ## **name**
- boost_param_parameters_const\_ ## __LINE__ ## **name**;
- template <typename A0, …, typename A ## **n**>
- **result** **name**\ (
- A0&& a0, …, A ## **n**\ && a ## **n**
- , typename boost_param_parameters_const\_ ## __LINE__ ## **name**
- ::match<A0, …, A ## **n**>::type
- = boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## **name**\ (
- boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **n**>(a ## **n**)
- )
- );
- }
- :vellipsis:`⋮`
- template <typename A0, …, typename A ## **m**>
- **result** **name**\ (
- A0&& a0, …, A ## **m**\ && a ## **m**
- , typename boost_param_parameters_const\_ ## __LINE__ ## **name**
- ::match<A0, …, A ## **m**>::type
- = boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## **name**\ (
- boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **m**>(a ## **m**)
- )
- );
- }
- template <typename Args>
- typename boost_param_result_const\_ ## __LINE__ ## **name**\ <Args>::type
- boost_param_impl_const ## __LINE__ ## **name**\ (Args const& args) const
- Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
- available for use within the function body.
- .. |BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR``
- .. _BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR:
- ``BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR(result, tag_ns, arguments)``
- ---------------------------------------------------------------------------
- :Defined in: |preprocessor_header|_
- Generates a function call operator that can take in positional arguments,
- composed arguments, named arguments, and deduced arguments.
- :Example usage:
- Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is ``tag`` by default.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\(y)
- |BOOST_PARAMETER_NAME|_\(z)
- Use the macro as a substitute for a normal function call operator
- header. Enclose the return type in parentheses. For each parameter, also
- enclose the expected value type in parentheses. Since the value types are
- mutually exclusive, you can wrap the parameters in a ``(deduced …)``
- clause. This is especially useful when implementing multiple
- Boost.Parameter-enabled function call operator overloads.
- .. parsed-literal::
- class char_reader
- {
- int index;
- char const* key;
- public:
- explicit char_reader(char const* k) : index(0), key(k)
- {
- }
- BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR((void), tag,
- (deduced
- (required
- (y, (int))
- (z, (char const*))
- )
- )
- )
- {
- this->index = args[_y];
- this->key = args[_z];
- }
- |BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR|_\((char), tag,
- (deduced
- (required
- (y, (bool))
- (z, (|std_map|_\<char const*, |std_string|_\>))
- )
- )
- )
- {
- return args[_y] ? (
- (args[_z].find(this->key)->second)[this->index]
- ) : this->key[this->index];
- }
- };
- As with regular argument-dependent lookup, the value types of the arguments
- passed in determine which function call operator overload gets invoked.
- .. parsed-literal::
- char const* keys[] = {"foo", "bar", "baz"};
- |std_map|_\<char const*, |std_string|_\> k2s;
- k2s[keys[0]] = |std_string|_\("qux");
- k2s[keys[1]] = |std_string|_\("wmb");
- k2s[keys[2]] = |std_string|_\("zxc");
- char_reader r(keys[0]);
- // positional arguments
- BOOST_TEST_EQ('q', (r(true, k2s)));
- BOOST_TEST_EQ('f', (r(false, k2s)));
- // named arguments
- r(_z = keys[1], _y = 1);
- BOOST_TEST_EQ('m', (r(_z = k2s, _y = true)));
- BOOST_TEST_EQ('a', (r(_z = k2s, _y = false)));
- // deduced arguments
- r(keys[2], 2);
- BOOST_TEST_EQ('c', (r(k2s, true)));
- BOOST_TEST_EQ('z', (r(k2s, false)));
- The |preprocessor_cpp|_ test program demonstrates proper usage of this macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function call operator.
- * ``tag_namespace`` is the namespace in which the keywords used by the
- function call operator resides.
- * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
- *argument-specifiers*, as defined below.
- **Argument specifiers syntax:**
- .. parsed-literal::
- argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
- specifier-group0 ::= *specifier-group1* |
- (
- '**(**' '**deduced**'
- *specifier-group1* {*specifier-group1*\ }
- '**)**'
- )
- specifier-group1 ::=
- (
- '**(**' '**optional**'
- *specifier* {*specifier*\ }
- '**)**'
- ) | (
- '**(**' '**required**'
- *specifier* {*specifier*\ }
- '**)**'
- )
- specifier ::=
- '**(**' *argument-name* '**,**' *restriction* ')'
- restriction ::=
- ( '**\***' '**(**' *mfc* '**)**' ) |
- ( '**(**' *type-name* '**)**' ) |
- '**\***'
- * ``argument-name`` is any valid C++ identifier.
- * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
- be the type of the corresponding ``argument-name``, whose second argument
- will be the entire |ArgumentPack|_, and whose return type is a `Boolean
- Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
- of ``previous-name ## _type``.
- * ``type-name`` is either the name of a **target type** or an `MPL Binary
- Metafunction Class`_ whose first argument will be the type of the
- corresponding ``argument-name``, whose second argument will be the entire
- |ArgumentPack|_, and whose return type is the **target type**.
- Note that *specifier* does not include *default-value*. It is up to the
- function body to determine the default value of all optional arguments.
- **Approximate expansion:**
- Where:
- * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
- * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename Args>
- using boost_param_result\_ ## __LINE__ ## operator = **result**;
- // If **result** is a simple return type:
- template <typename Args>
- struct boost_param_result\_ ## __LINE__ ## operator
- {
- typedef **result** type;
- };
- struct boost_param_params\_ ## __LINE__ ## operator
- : |parameters|_\<
- *list of parameter specifications, based on arguments*
- >
- {
- };
- typedef boost_param_params\_ ## __LINE__ ## operator
- boost_param_parameters\_ ## __LINE__ ## operator;
- template <typename A0, …, typename A ## **n**>
- **result** operator()(
- A0&& a0, …, A ## **n**\ && a ## **n**
- , typename boost_param_parameters\_ ## __LINE__ ## operator::match<
- A0, …, A ## **n**
- >::type = boost_param_parameters\_ ## __LINE__ ## operator()
- )
- {
- return this->boost_param_impl ## __LINE__ ## operator(
- boost_param_parameters\_ ## __LINE__ ## operator()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **n**>(a ## **n**)
- )
- );
- }
- :vellipsis:`⋮`
- template <typename A0, …, typename A ## **m**>
- **result** operator()(
- A0&& a0, …, A ## **m**\ && a ## **m**
- , typename boost_param_parameters\_ ## __LINE__ ## operator::match<
- A0, …, A ## **m**
- >::type = boost_param_parameters\_ ## __LINE__ ## operator()
- )
- {
- return this->boost_param_impl ## __LINE__ ## operator(
- boost_param_parameters\_ ## __LINE__ ## operator()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **m**>(a ## **m**)
- )
- );
- }
- template <typename Args>
- typename boost_param_result\_ ## __LINE__ ## operator<Args>::type
- boost_param_impl ## __LINE__ ## operator(Args const& args)
- Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
- available for use within the function call operator body.
- .. |BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR``
- .. _BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR:
- ``BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, args)``
- ----------------------------------------------------------------------------
- :Defined in: |preprocessor_header|_
- Generates a function call operator that can take in positional arguments,
- composed arguments, named arguments, and deduced arguments.
- :Example usage:
- The return type of each of the following function templates falls under a
- different value category.
- .. parsed-literal::
- template <std::size_t N>
- |std_bitset|_\<N + 1> rvalue_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const rvalue_const_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1>& lvalue_bitset()
- {
- static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
- return lset;
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const& lvalue_const_bitset()
- {
- static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
- return clset;
- }
- The ``U::evaluate_category`` static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
- .. parsed-literal::
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is ``kw`` in this case. The identifiers with leading
- underscores can be passed to the bracket operator of ``args`` to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
- |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
- |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
- |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
- Use the macro as a substitute for a normal ``const`` function call operator
- header. Enclose the return type ``bool`` in parentheses. For each parameter,
- also enclose the expected value type in parentheses. Since the value types
- are mutually exclusive, you can wrap the parameters in a ``(deduced …)``
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. However, unlike a normal
- function, default values must be specified within the function body. Also
- within the function body, you must pass the matching identifier with the
- leading underscore to the bracket operator of ``args`` to extract the
- corresponding argument, but at least this doesn't require ``std::forward`` to
- preserve value categories.
- .. parsed-literal::
- struct B
- {
- B()
- {
- }
- BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR((bool), kw,
- (deduced
- (required
- (lrc, (|std_bitset|_\<1>))
- (lr, (|std_bitset|_\<2>))
- )
- (optional
- (rrc, (|std_bitset|_\<3>))
- (rr, (|std_bitset|_\<4>))
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc0 | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(
- args[_rr0 | rvalue_bitset<3>()]
- )
- );
- return true;
- }
- };
- The following function calls are legal.
- .. parsed-literal::
- B const b = B();
- b( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- b( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- b(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- b( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- b( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- Because the parameters were wrapped in a ``(deduced …)`` clause, the following
- function calls are also legal.
- .. parsed-literal::
- b( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- b( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- The |preprocessor_cpp|_ test program demonstrates proper usage of this macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function call operator.
- * ``tag_namespace`` is the namespace in which the keywords used by the
- function call operator resides.
- * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
- *argument-specifiers*, as defined below.
- **Argument specifiers syntax:**
- .. parsed-literal::
- argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
- specifier-group0 ::= *specifier-group1* |
- (
- '**(**' '**deduced**'
- *specifier-group1* {*specifier-group1*\ }
- '**)**'
- )
- specifier-group1 ::=
- (
- '**(**' '**optional**'
- *specifier* {*specifier*\ }
- '**)**'
- ) | (
- '**(**' '**required**'
- *specifier* {*specifier*\ }
- '**)**'
- )
- specifier ::=
- '**(**' *argument-name* '**,**' *restriction* ')'
- restriction ::=
- ( '**\***' '**(**' *mfc* '**)**' ) |
- ( '**(**' *type-name* '**)**' ) |
- '**\***'
- * ``argument-name`` is any valid C++ identifier.
- * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
- be the type of the corresponding ``argument-name``, whose second argument
- will be the entire |ArgumentPack|_, and whose return type is a `Boolean
- Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
- of ``previous-name ## _type``.
- * ``type-name`` is either the name of a **target type** or an `MPL Binary
- Metafunction Class`_ whose first argument will be the type of the
- corresponding ``argument-name``, whose second argument will be the entire
- |ArgumentPack|_, and whose return type is the **target type**.
- Note that *specifier* does not include *default-value*. It is up to the
- function body to determine the default value of all optional arguments.
- **Approximate expansion:**
- Where:
- * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
- * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename Args>
- using boost_param_result_const\_ ## __LINE__ ## operator = **result**;
- // If **result** is a simple return type:
- template <typename Args>
- struct boost_param_result_const\_ ## __LINE__ ## operator
- {
- typedef **result** type;
- };
- struct boost_param_params_const\_ ## __LINE__ ## operator
- : |parameters|_\<
- *list of parameter specifications, based on arguments*
- >
- {
- };
- typedef boost_param_params_const\_ ## __LINE__ ## operator
- boost_param_parameters_const\_ ## __LINE__ ## operator;
- template <typename A0, …, typename A ## **n**>
- **result** operator()(
- A0&& a0, …, A ## **n**\ && a ## **n**
- , typename boost_param_parameters_const\_ ## __LINE__ ## operator
- ::match<A0, …, A ## **n**>::type
- = boost_param_parameters_const\_ ## __LINE__ ## operator()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## operator(
- boost_param_parameters_const\_ ## __LINE__ ## operator()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **n**>(a ## **n**)
- )
- );
- }
- :vellipsis:`⋮`
- template <typename A0, …, typename A ## **m**>
- **result** operator()(
- A0&& a0, …, A ## **m**\ && a ## **m**
- , typename boost_param_parameters_const\_ ## __LINE__ ## operator
- ::match<A0, …, A ## **m**>::type
- = boost_param_parameters_const\_ ## __LINE__ ## operator()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## operator(
- boost_param_parameters_const\_ ## __LINE__ ## operator()(
- |std_forward|_\<A0>(a0)
- , …
- , |std_forward|_\<A ## **m**>(a ## **m**)
- )
- );
- }
- template <typename Args>
- typename boost_param_result_const\_ ## __LINE__ ## operator<Args>::type
- boost_param_impl_const ## __LINE__ ## operator(Args const& args) const
- Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
- available for use within the function call operator body.
- .. |BOOST_PARAMETER_NO_SPEC_FUNCTION| replace:: ``BOOST_PARAMETER_NO_SPEC_FUNCTION``
- .. _BOOST_PARAMETER_NO_SPEC_FUNCTION:
- ``BOOST_PARAMETER_NO_SPEC_FUNCTION(result, name)``
- --------------------------------------------------
- :Defined in: |preprocessor_no_spec_header|_
- Generates a function that can take in named arguments.
- :Example usage:
- The return type of each of the following function templates falls under a
- different value category.
- .. parsed-literal::
- template <std::size_t N>
- |std_bitset|_\<N + 1> rvalue_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const rvalue_const_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1>& lvalue_bitset()
- {
- static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
- return lset;
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const& lvalue_const_bitset()
- {
- static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
- return clset;
- }
- The ``U::evaluate_category`` static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
- .. parsed-literal::
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- Named parameters are required when invoking the function; however, none of
- their tags need to be in the same namespace.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\((_lrc, kw0) in(lrc))
- |BOOST_PARAMETER_NAME|_\((_lr, kw1) in_out(lr))
- |BOOST_PARAMETER_NAME|_\((_rrc, kw2) in(rrc))
- |BOOST_PARAMETER_NAME|_\((_rr, kw3) consume(rr))
- Use the macro as a substitute for a variadic function header. Enclose the
- return type ``bool`` in parentheses.
- .. parsed-literal::
- BOOST_PARAMETER_NO_SPEC_FUNCTION((bool), evaluate)
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(args[_rr | rvalue_bitset<3>()])
- );
- return true;
- }
- To invoke the function, bind all its arguments to named parameters.
- .. parsed-literal::
- evaluate(
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- evaluate(
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- The |preproc_eval_cat_no_spec_cpp|_ test program demonstrates proper usage of
- this macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function.
- * ``name`` is the base name of the function; it determines the name of the
- generated implementation function.
- **Argument specifiers syntax:**
- None.
- **Approximate expansion:**
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename TaggedArg0, typename ...TaggedArgs>
- using boost_param_no_spec_result\_ ## __LINE__ ## **name** = **result**;
- // If **result** is a simple return type:
- template <typename TaggedArg0, typename ...TaggedArgs>
- struct boost_param_no_spec_result\_ ## __LINE__ ## **name**
- {
- typedef **result** type;
- };
- template <typename ResultType, typename Args>
- ResultType
- boost_param_no_spec_impl ## __LINE__ ## **name**\ (
- (ResultType(*)())
- , Args const& args
- );
- template <typename TaggedArg0, typename ...TaggedArgs>
- inline typename |boost_lazy_enable_if|_\<
- |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...>
- , boost_param_no_spec_result\_ ## __LINE__ ## **name**\ <
- TaggedArg0
- , TaggedArgs...
- >
- >::type
- **name**\ (TaggedArg0 const& arg0, TaggedArgs const&... args)
- {
- return boost_param_no_spec_impl ## __LINE__ ## **name**\ (
- static_cast<
- typename
- boost_param_no_spec_result\_ ## __LINE__ ## **name**\ <
- TaggedArg0
- , TaggedArgs...
- >::type(*)()
- >(|std_nullptr|_\)
- , |compose|_\(arg0, args...)
- );
- }
- template <typename ResultType, typename Args>
- ResultType
- boost_param_no_spec_impl ## __LINE__ ## **name**\ (
- (ResultType(*)())
- , Args const& args
- )
- Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
- available for use within the function body.
- .. |BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION``
- .. _BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION:
- ``BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION(result, name)``
- ---------------------------------------------------------
- :Defined in: |preprocessor_no_spec_header|_
- Generates a member function that can take in named arguments.
- :Example usage:
- When designing a front-end class template whose back-end is configurable via
- parameterized inheritance, it can be useful to omit argument specifiers from
- a named-parameter member function so that the delegate member functions of the
- back-end classes can enforce their own specifications.
- .. parsed-literal::
- template <typename B>
- struct frontend : B
- {
- frontend() : B()
- {
- }
- BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION((void), initialize)
- {
- this->initialize_impl(args);
- }
- };
- Named parameters are required when invoking the member function; however, none
- of their tags need to be in the same namespace.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\(a0)
- |BOOST_PARAMETER_NAME|_\(a1)
- |BOOST_PARAMETER_NAME|_\(a2)
- For this example, each of the back-end class templates requires its own
- parameter to be present in the argument pack. In practice, such parameters
- should be optional, with default values.
- .. parsed-literal::
- template <typename T>
- class backend0
- {
- T a0;
- public:
- backend0() : a0()
- {
- }
- T const& get_a0() const
- {
- return this->a0;
- }
- protected:
- template <typename ArgPack>
- void initialize_impl(ArgPack const& args)
- {
- this->a0 = args[_a0];
- }
- };
- template <typename B, typename T>
- class backend1 : public B
- {
- T a1;
- public:
- backend1() : B(), a1()
- {
- }
- T const& get_a1() const
- {
- return this->a1;
- }
- protected:
- template <typename ArgPack>
- void initialize_impl(ArgPack const& args)
- {
- B::initialize_impl(args);
- this->a1 = args[_a1];
- }
- };
- template <typename B, typename T>
- class backend2 : public B
- {
- T a2;
- public:
- backend2() : B(), a2()
- {
- }
- T const& get_a2() const
- {
- return this->a2;
- }
- protected:
- template <typename ArgPack>
- void initialize_impl(ArgPack const& args)
- {
- B::initialize_impl(args);
- this->a2 = args[_a2];
- }
- };
- This example shows that while ``backend0`` must always be the root base class
- template and that ``frontend`` must always be the most derived class template,
- the other back-ends can be chained together in different orders.
- .. parsed-literal::
- char const* p = "foo";
- frontend<
- backend2<backend1<backend0<char const*>, char>, int>
- > composed_obj0;
- frontend<
- backend1<backend2<backend0<char const*>, int>, char>
- > composed_obj1;
- composed_obj0.initialize(_a2 = 4, _a1 = ' ', _a0 = p);
- composed_obj1.initialize(_a0 = p, _a1 = ' ', _a2 = 4);
- BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
- BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
- BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
- The |parameterized_inheritance_cpp|_ and |preproc_eval_cat_no_spec_cpp|_ test
- programs demonstrate proper usage of this macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function.
- * ``name`` is the base name of the function; it determines the name of the
- generated implementation function. ``name`` may be qualified by the
- ``static`` keyword to declare the member function and its helpers as not
- associated with any object of the enclosing type.
- **Argument specifiers syntax:**
- None.
- **Approximate expansion:**
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename TaggedArg0, typename ...TaggedArgs>
- using boost_param_no_spec_result\_ ## __LINE__ ## **name** = **result**;
- // If **result** is a simple return type:
- template <typename TaggedArg0, typename ...TaggedArgs>
- struct boost_param_no_spec_result\_ ## __LINE__ ## **name**
- {
- typedef **result** type;
- };
- template <typename TaggedArg0, typename ...TaggedArgs>
- inline typename |boost_lazy_enable_if|_\<
- |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...>
- , boost_param_no_spec_result\_ ## __LINE__ ## **name**\ <
- TaggedArg0
- , TaggedArgs...
- >
- >::type
- **name**\ (TaggedArg0 const& arg0, TaggedArgs const&... args)
- {
- return this->boost_param_no_spec_impl ## __LINE__ ## **name**\ (
- static_cast<
- typename
- boost_param_no_spec_result\_ ## __LINE__ ## **name**\ <
- TaggedArg0
- , TaggedArgs...
- >::type(*)()
- >(|std_nullptr|_\)
- , |compose|_\(arg0, args...)
- );
- }
- template <typename ResultType, typename Args>
- ResultType
- boost_param_no_spec_impl ## __LINE__ ## **name**\ (
- (ResultType(*)())
- , Args const& args
- )
- Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
- available for use within the function body.
- .. |BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION``
- .. _BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION:
- ``BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION(result, name)``
- ---------------------------------------------------------------
- :Defined in: |preprocessor_no_spec_header|_
- Generates a member function that can take in named arguments.
- :Example usage:
- The return type of each of the following function templates falls under a
- different value category.
- .. parsed-literal::
- template <std::size_t N>
- |std_bitset|_\<N + 1> rvalue_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const rvalue_const_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1>& lvalue_bitset()
- {
- static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
- return lset;
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const& lvalue_const_bitset()
- {
- static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
- return clset;
- }
- The ``U::evaluate_category`` static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
- .. parsed-literal::
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- Named parameters are required when invoking the member function; however, none
- of their tags need to be in the same namespace.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\((_lrc, kw0) in(lrc))
- |BOOST_PARAMETER_NAME|_\((_lr, kw1) in_out(lr))
- |BOOST_PARAMETER_NAME|_\((_rrc, kw2) in(rrc))
- |BOOST_PARAMETER_NAME|_\((_rr, kw3) consume(rr))
- Use the macro as a substitute for a variadic function header. Enclose the
- return type ``bool`` in parentheses. The macro will qualify the function with
- the ``const`` keyword.
- .. parsed-literal::
- struct D
- {
- D()
- {
- }
- BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION((bool), evaluate_m)
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(
- args[_rr | rvalue_bitset<3>()]
- )
- );
- return true;
- }
- };
- To invoke the member function, bind all its arguments to named parameters.
- .. parsed-literal::
- D const d = D();
- d.evaluate_m(
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- d.evaluate_m(
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- The |preproc_eval_cat_no_spec_cpp|_ test program demonstrates proper usage of
- this macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function.
- * ``name`` is the base name of the function; it determines the name of the
- generated implementation function.
- **Argument specifiers syntax:**
- None.
- **Approximate expansion:**
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename TaggedArg0, typename ...TaggedArgs>
- using boost_param_no_spec_result_const\_ ## __LINE__ ## **name** = **result**;
- // If **result** is a simple return type:
- template <typename TaggedArg0, typename ...TaggedArgs>
- struct boost_param_no_spec_result_const\_ ## __LINE__ ## **name**
- {
- typedef **result** type;
- };
- template <typename TaggedArg0, typename ...TaggedArgs>
- inline typename |boost_lazy_enable_if|_\<
- |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...>
- , boost_param_no_spec_result_const\_ ## __LINE__ ## **name**\ <
- TaggedArg0
- , TaggedArgs...
- >
- >::type
- **name**\ (TaggedArg0 const& arg0, TaggedArgs const&... args) const
- {
- return this->boost_param_no_spec_impl_const ## __LINE__ ## **name**\ (
- static_cast<
- typename
- boost_param_no_spec_result_const\_ ## __LINE__ ## **name**\ <
- TaggedArg0
- , TaggedArgs...
- >::type(*)()
- >(|std_nullptr|_\)
- , |compose|_\(arg0, args...)
- );
- }
- template <typename ResultType, typename Args>
- ResultType
- boost_param_no_spec_impl_const ## __LINE__ ## **name**\ (
- (ResultType(*)())
- , Args const& args
- ) const
- Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
- available for use within the function body.
- .. |BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR``
- .. _BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR:
- ``BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR(result)``
- ----------------------------------------------------------
- :Defined in: |preprocessor_no_spec_header|_
- Generates a function call operator that can take in named arguments.
- :Example usage:
- When designing a front-end class template whose back-end is configurable via
- parameterized inheritance, it can be useful to omit argument specifiers from
- a named-parameter function call operator so that the delegate member functions
- of the back-end classes can enforce their own specifications.
- .. parsed-literal::
- template <typename B>
- struct frontend : B
- {
- frontend() : B()
- {
- }
- BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR((void))
- {
- this->initialize_impl(args);
- }
- };
- Named parameters are required when invoking the function call operator;
- however, none of their tags need to be in the same namespace.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\(a0)
- |BOOST_PARAMETER_NAME|_\(a1)
- |BOOST_PARAMETER_NAME|_\(a2)
- For this example, each of the back-end class templates requires its own
- parameter to be present in the argument pack. In practice, such parameters
- should be optional, with default values.
- .. parsed-literal::
- template <typename T>
- class backend0
- {
- T a0;
- public:
- backend0() : a0()
- {
- }
- T const& get_a0() const
- {
- return this->a0;
- }
- protected:
- template <typename ArgPack>
- void initialize_impl(ArgPack const& args)
- {
- this->a0 = args[_a0];
- }
- };
- template <typename B, typename T>
- class backend1 : public B
- {
- T a1;
- public:
- backend1() : B(), a1()
- {
- }
- T const& get_a1() const
- {
- return this->a1;
- }
- protected:
- template <typename ArgPack>
- void initialize_impl(ArgPack const& args)
- {
- B::initialize_impl(args);
- this->a1 = args[_a1];
- }
- };
- template <typename B, typename T>
- class backend2 : public B
- {
- T a2;
- public:
- backend2() : B(), a2()
- {
- }
- T const& get_a2() const
- {
- return this->a2;
- }
- protected:
- template <typename ArgPack>
- void initialize_impl(ArgPack const& args)
- {
- B::initialize_impl(args);
- this->a2 = args[_a2];
- }
- };
- This example shows that while ``backend0`` must always be the root base class
- template and that ``frontend`` must always be the most derived class template,
- the other back-ends can be chained together in different orders.
- .. parsed-literal::
- char const* p = "foo";
- frontend<
- backend2<backend1<backend0<char const*>, char>, int>
- > composed_obj0;
- frontend<
- backend1<backend2<backend0<char const*>, int>, char>
- > composed_obj1;
- composed_obj0(_a2 = 4, _a1 = ' ', _a0 = p);
- composed_obj1(_a0 = p, _a1 = ' ', _a2 = 4);
- BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
- BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
- BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
- The |parameterized_inheritance_cpp|_ and |preproc_eval_cat_no_spec_cpp|_ test
- programs demonstrate proper usage of this macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function call operator.
- **Argument specifiers syntax:**
- None.
- **Approximate expansion:**
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename TaggedArg0, typename ...TaggedArgs>
- using boost_param_no_spec_result\_ ## __LINE__ ## operator = **result**;
- // If **result** is a simple return type:
- template <typename TaggedArg0, typename ...TaggedArgs>
- struct boost_param_no_spec_result\_ ## __LINE__ ## operator
- {
- typedef **result** type;
- };
- template <typename TaggedArg0, typename ...TaggedArgs>
- inline typename |boost_lazy_enable_if|_\<
- |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...>
- , boost_param_no_spec_result\_ ## __LINE__ ## operator<
- TaggedArg0
- , TaggedArgs...
- >
- >::type
- operator()(TaggedArg0 const& arg0, TaggedArgs const&... args)
- {
- return this->boost_param_no_spec_impl ## __LINE__ ## operator(
- static_cast<
- typename
- boost_param_no_spec_result\_ ## __LINE__ ## operator<
- TaggedArg0
- , TaggedArgs...
- >::type(*)()
- >(|std_nullptr|_\)
- , |compose|_\(arg0, args...)
- );
- }
- template <typename ResultType, typename Args>
- ResultType
- boost_param_no_spec_impl ## __LINE__ ## operator(
- (ResultType(*)())
- , Args const& args
- )
- Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
- available for use within the function body.
- .. |BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR``
- .. _BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR:
- ``BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR(result)``
- ----------------------------------------------------------------
- :Defined in: |preprocessor_no_spec_header|_
- Generates a function call operator that can take in named arguments.
- :Example usage:
- The return type of each of the following function templates falls under a
- different value category.
- .. parsed-literal::
- template <std::size_t N>
- |std_bitset|_\<N + 1> rvalue_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const rvalue_const_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1>& lvalue_bitset()
- {
- static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
- return lset;
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const& lvalue_const_bitset()
- {
- static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
- return clset;
- }
- The ``U::evaluate_category`` static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
- .. parsed-literal::
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- Named parameters are required when invoking the function call operator;
- however, none of their tags need to be in the same namespace.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\((_lrc, kw0) in(lrc))
- |BOOST_PARAMETER_NAME|_\((_lr, kw1) in_out(lr))
- |BOOST_PARAMETER_NAME|_\((_rrc, kw2) in(rrc))
- |BOOST_PARAMETER_NAME|_\((_rr, kw3) consume(rr))
- Use the macro as a substitute for a variadic function call operator
- header. Enclose the return type ``bool`` in parentheses. The macro will
- qualify the function with the ``const`` keyword.
- .. parsed-literal::
- struct D
- {
- D()
- {
- }
- BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR((bool))
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(
- args[_rr | rvalue_bitset<3>()]
- )
- );
- return true;
- }
- };
- To invoke the function call operator, bind all its arguments to named
- parameters.
- .. parsed-literal::
- D const d = D();
- d(
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- d(
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- The |preproc_eval_cat_no_spec_cpp|_ test program demonstrates proper usage of this
- macro.
- **Macro parameters:**
- * ``result`` is the parenthesized return type of the function call operator.
- **Argument specifiers syntax:**
- None.
- **Approximate expansion:**
- .. parsed-literal::
- // If **result** is a template instantiation of |boost_enable_if|_\,
- // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
- // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
- // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
- // |std_enable_if|_\:
- template <typename TaggedArg0, typename ...TaggedArgs>
- using boost_param_no_spec_result_const\_ ## __LINE__ ## operator = **result**;
- // If **result** is a simple return type:
- template <typename TaggedArg0, typename ...TaggedArgs>
- struct boost_param_no_spec_result_const\_ ## __LINE__ ## operator
- {
- typedef **result** type;
- };
- template <typename TaggedArg0, typename ...TaggedArgs>
- inline typename |boost_lazy_enable_if|_\<
- |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...>
- , boost_param_no_spec_result_const\_ ## __LINE__ ## operator<
- TaggedArg0
- , TaggedArgs...
- >
- >::type
- operator()(
- TaggedArg0 const& arg0
- , TaggedArgs const&... args
- ) const
- {
- return this->boost_param_no_spec_impl_const ## __LINE__ ## operator(
- static_cast<
- typename
- boost_param_no_spec_result_const\_ ## __LINE__ ## operator<
- TaggedArg0
- , TaggedArgs...
- >::type(*)()
- >(|std_nullptr|_\)
- , |compose|_\(arg0, args...)
- );
- }
- template <typename ResultType, typename Args>
- ResultType
- boost_param_no_spec_impl_const ## __LINE__ ## operator(
- (ResultType(*)())
- , Args const& args
- ) const
- Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
- available for use within the function body.
- .. |BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR| replace:: ``BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR``
- .. _BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR:
- ``BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(cls, impl)``
- --------------------------------------------------
- :Defined in: |preprocessor_no_spec_header|_
- Generates a constructor that can take in named arguments.
- :Example usage:
- When designing a front-end class template whose back-end is configurable via
- parameterized inheritance, it can be useful to omit argument specifiers from
- a named-parameter constructor so that the delegate constructors of the
- back-end classes can enforce their own specifications.
- .. parsed-literal::
- template <typename B>
- struct frontend : B
- {
- BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(frontend, (B))
- };
- Named parameters are required when invoking the constructor; however, none of
- their tags need to be in the same namespace.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\(a0)
- |BOOST_PARAMETER_NAME|_\(a1)
- |BOOST_PARAMETER_NAME|_\(a2)
- For this example, each of the back-end class templates requires its own
- parameter to be present in the argument pack. In practice, such parameters
- should be optional, with default values.
- .. parsed-literal::
- struct _enabler
- {
- };
- template <typename T>
- class backend0
- {
- T a0;
- public:
- template <typename ArgPack>
- explicit backend0(
- ArgPack const& args
- , typename |boost_enable_if|_\<
- |is_argument_pack|_\<ArgPack>
- , _enabler
- >::type = _enabler()
- ) : a0(args[_a0])
- {
- }
- T const& get_a0() const
- {
- return this->a0;
- }
- };
- template <typename B, typename T>
- class backend1 : public B
- {
- T a1;
- public:
- template <typename ArgPack>
- explicit backend1(
- ArgPack const& args
- , typename |boost_enable_if|_\<
- |is_argument_pack|_\<ArgPack>
- , _enabler
- >::type = _enabler()
- ) : B(args), a1(args[_a1])
- {
- }
- T const& get_a1() const
- {
- return this->a1;
- }
- };
- template <typename B, typename T>
- class backend2 : public B
- {
- T a2;
- public:
- template <typename ArgPack>
- explicit backend2(
- ArgPack const& args
- , typename |boost_enable_if|_\<
- |is_argument_pack|_\<ArgPack>
- , _enabler
- >::type = _enabler()
- ) : B(args), a2(args[_a2])
- {
- }
- T const& get_a2() const
- {
- return this->a2;
- }
- };
- This example shows that while ``backend0`` must always be the root base class
- template and that ``frontend`` must always be the most derived class template,
- the other back-ends can be chained together in different orders.
- .. parsed-literal::
- char const* p = "foo";
- frontend<
- backend2<backend1<backend0<char const*>, char>, int>
- > composed_obj0(_a2 = 4, _a1 = ' ', _a0 = p);
- frontend<
- backend1<backend2<backend0<char const*>, int>, char>
- > composed_obj1(_a0 = p, _a1 = ' ', _a2 = 4);
- BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
- BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
- BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
- The |parameterized_inheritance_cpp|_ and |preproc_eval_cat_no_spec_cpp|_ test
- programs demonstrate proper usage of this macro.
- **Macro parameters:**
- * ``cls`` is the name of the enclosing class.
- * ``impl`` is the parenthesized implementation base class for ``cls``.
- **Argument specifiers syntax:**
- None.
- **Approximate expansion:**
- .. parsed-literal::
- template <
- typename TaggedArg0
- , typename ...TaggedArgs
- , typename = typename |boost_enable_if|_\<
- |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...>
- >::type
- >
- inline explicit **cls**\ (
- TaggedArg0 const& arg0
- , TaggedArgs const&... args
- ) : **impl**\ (|compose|_\(arg0, args...))
- {
- }
- .. |BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR| replace:: ``BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR``
- .. _BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR:
- ``BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(cls, impl)``
- ----------------------------------------------------------
- :Defined in: |preprocessor_no_spec_header|_
- Generates a constructor that can take in named arguments.
- :Example usage:
- The return type of each of the following function templates falls under a
- different value category.
- .. parsed-literal::
- template <std::size_t N>
- |std_bitset|_\<N + 1> rvalue_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const rvalue_const_bitset()
- {
- return |std_bitset|_\<N + 1>();
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1>& lvalue_bitset()
- {
- static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
- return lset;
- }
- template <std::size_t N>
- |std_bitset|_\<N + 1> const& lvalue_const_bitset()
- {
- static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
- return clset;
- }
- The ``U::evaluate_category`` static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
- .. parsed-literal::
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- Named parameters are required when invoking the constructor; however, none of
- their tags need to be in the same namespace.
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\((_lrc, kw0) in(lrc))
- |BOOST_PARAMETER_NAME|_\((_lr, kw1) in_out(lr))
- |BOOST_PARAMETER_NAME|_\((_rrc, kw2) in(rrc))
- |BOOST_PARAMETER_NAME|_\((_rr, kw3) consume(rr))
- Unlike |BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR|_, this macro doesn't require a
- base class, only a delegate function to which the generated constructor can
- pass its |ArgumentPack|_.
- .. parsed-literal::
- struct D
- {
- BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(D, D::_evaluate)
- private:
- template <typename Args>
- static bool _evaluate(Args const& args)
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(
- args[_rr | rvalue_bitset<3>()]
- )
- );
- return true;
- }
- };
- To invoke the constructor, bind all its arguments to named parameters.
- .. parsed-literal::
- D dp0(
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- D dp1(
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- The |preproc_eval_cat_no_spec_cpp|_ test program demonstrates proper usage of
- this macro.
- **Macro parameters:**
- * ``cls`` is the name of the enclosing class.
- * ``func`` is a function that takes in the |ArgumentPack|_ that the
- generated constructor passes on.
- **Argument specifiers syntax:**
- None.
- **Approximate expansion:**
- .. parsed-literal::
- template <
- typename TaggedArg0
- , typename ...TaggedArgs
- , typename = typename |boost_enable_if|_\<
- |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...>
- >::type
- >
- inline explicit **cls**\ (
- TaggedArg0 const& arg0
- , TaggedArgs const&... args
- )
- {
- **func**\ (|compose|_\(arg0, args...));
- }
- .. |BOOST_PARAMETER_NAME| replace:: ``BOOST_PARAMETER_NAME``
- .. _BOOST_PARAMETER_NAME:
- ``BOOST_PARAMETER_NAME(name)``
- ------------------------------
- :Defined in: |name_header|_
- Declares a tag-type and keyword object.
- **If** *name* is of the form:
- .. parsed-literal::
- (*object-name*, *namespace-name*) *qualifier*\ (*tag-name*)
- **then**
- :Requires: *qualifier* is either ``in``, ``out``, ``in_out``, ``consume``,
- ``move_from``, or ``forward``.
- :Expands to:
- .. parsed-literal::
- namespace *namespace-name* {
- struct *tag-name*
- {
- static constexpr char const* keyword_name()
- {
- return ## *tag-name*;
- }
- typedef *unspecified* _;
- typedef *unspecified* _1;
- typedef boost::parameter::*qualifier* ## _reference qualifier;
- // The following definitions are available only when
- // |BOOST_PARAMETER_CAN_USE_MP11|_ is defined.
- template <typename ArgumentPack>
- using binding_fn = typename |binding|_\<
- ArgumentPack
- , *tag-name*
- >::type;
- template <typename ArgumentPack>
- using fn = typename |value_type|_\<ArgumentPack, *tag-name*>::type;
- };
- }
- |keyword|_\<*tag-namespace*::*tag-name*> const& *object-name*
- = |keyword|_\<*tag-namespace*::*tag-name*>::instance;
- **Else If** *name* is of the form:
- .. parsed-literal::
- (*tag-name*, *namespace-name*) *object-name*
- **then**
- Treats *name* as if it were of the form:
- .. parsed-literal::
- (forward(*tag-name*), *namespace-name*) *object-name*
- **Else If** *name* is of the form:
- .. parsed-literal::
- *qualifier*\ (*tag-name*)
- **then**
- :Requires: *qualifier* is either ``in``, ``out``, ``in_out``, ``consume``,
- ``move_from``, or ``forward``.
- :Expands to:
- .. parsed-literal::
- namespace tag {
- struct *tag-name*
- {
- static constexpr char const* keyword_name()
- {
- return ## *tag-name*;
- }
- typedef *unspecified* _;
- typedef *unspecified* _1;
- typedef boost::parameter::*qualifier* ## _reference qualifier;
- // The following definitions are available only when
- // |BOOST_PARAMETER_CAN_USE_MP11|_ is defined.
- template <typename ArgumentPack>
- using binding_fn = typename |binding|_\<
- ArgumentPack
- , *tag-name*
- >::type;
- template <typename ArgumentPack>
- using fn = typename |value_type|_\<ArgumentPack, *tag-name*>::type;
- };
- }
- |keyword|_\<tag::*tag-name*> const& _ ## *tag-name*
- = |keyword|_\<tag::*tag-name*>::instance;
- **Else**
- Treats *name* as if it were of the form:
- .. parsed-literal::
- forward(*tag-name*)
- .. |BOOST_PARAMETER_NESTED_KEYWORD| replace:: ``BOOST_PARAMETER_NESTED_KEYWORD``
- .. _BOOST_PARAMETER_NESTED_KEYWORD:
- ``BOOST_PARAMETER_NESTED_KEYWORD(tag_namespace, name, alias)``
- --------------------------------------------------------------
- :Defined in: |nested_keyword_header|_
- Declares a tag-type, a keyword object, and an alias for that object nested in
- the tag-type.
- **If** *name* is of the form:
- .. parsed-literal::
- *qualifier*\ (*tag-name*)
- **then**
- :Requires: *qualifier* is either ``in``, ``out``, ``in_out``, ``consume``,
- ``move_from``, or ``forward``.
- :Expands to:
- .. parsed-literal::
- namespace tag {
- struct *tag-name*
- {
- static constexpr char const* keyword_name()
- {
- return ## *tag-name* ## _;
- }
- typedef *unspecified* _;
- typedef *unspecified* _1;
- typedef boost::parameter::*qualifier* ## _reference qualifier;
- static |keyword|_\<*tag-name*> const& *alias*;
- // The following definitions are available only when
- // |BOOST_PARAMETER_CAN_USE_MP11|_ is defined.
- template <typename ArgumentPack>
- using binding_fn = typename |binding|_\<
- ArgumentPack
- , *tag-name*
- >::type;
- template <typename ArgumentPack>
- using fn = typename |value_type|_\<ArgumentPack, *tag-name*>::type;
- };
- |keyword|_\<*tag-name*> const& tag::*tag-name*::*alias*
- = |keyword|_\<*tag-name*>::instance;
- }
- |keyword|_\<tag::*tag-name*> const& tag::*tag-name*::*name*
- = |keyword|_\<tag::*tag-name*>::instance;
- **Else**
- Treats *name* as if it were of the form:
- .. parsed-literal::
- forward(*tag-name*)
- .. |BOOST_PARAMETER_TEMPLATE_KEYWORD| replace:: ``BOOST_PARAMETER_TEMPLATE_KEYWORD``
- .. _BOOST_PARAMETER_TEMPLATE_KEYWORD:
- ``BOOST_PARAMETER_TEMPLATE_KEYWORD(name)``
- ------------------------------------------
- :Defined in: |template_keyword_header|_
- :Included by: |name_header|_
- :Expands to:
- .. parsed-literal::
- namespace tag {
- struct *name*;
- }
- template <typename T>
- struct *name* : |template_keyword|_\<tag:: *name*, T>
- {
- };
- The |function_type_tpl_param_cpp|_ test program demonstrates proper usage of
- this macro.
- .. |BOOST_PARAMETER_FUN| replace:: ``BOOST_PARAMETER_FUN``
- .. _BOOST_PARAMETER_FUN:
- ``BOOST_PARAMETER_FUN(r, n, l, h, p)``
- --------------------------------------
- .. admonition:: Deprecated
- This macro has been deprecated in favor of
- ``BOOST_PARAMETER_FUNCTION``.
- Generates a sequence of `forwarding function`_ templates named
- ``n``, with arities ranging from ``l`` to ``h``, returning ``r``,
- and using ``p`` to control overload resolution and assign tags to
- positional arguments.
- :Defined in: |macros_header|_
- :Requires: ``l`` and ``h`` are nonnegative integer tokens
- such that ``l`` < ``h``
- :Expands to:
- .. parsed-literal::
- template <typename A1, typename A2, …, typename A ## **l**>
- r
- name(
- A1 && a1, A2 && a2, …, A ## **l** && a ## **l**
- , typename **p**::match<A1, A2, …, A ## **l**>::type p = **p**\ ()
- )
- {
- return **name**\ _with_named_params(
- **p**\ (
- |std_forward|_\<A1>(a1)
- , |std_forward|_\<A2>(a2)
- , …
- , |std_forward|_\<A ## **l**>(a ## **l**)
- )
- );
- }
- template <
- typename A1
- , typename A2
- , …
- , typename A ## **l**
- , typename A ## |BOOST_PP_INC|_\ (**l**)
- >
- r
- name(
- A1 && a1, A2 && a2, …, A ## **l** && a ## **l**
- , A ## |BOOST_PP_INC|_\ (**l**) const& a ## |BOOST_PP_INC|_\ (**l**)
- , typename **p**::match<
- A1, A2, …, A ## **l**, A ## |BOOST_PP_INC|_\ (**l**)
- >::type p = **p**\ ()
- )
- {
- return **name**\ _with_named_params(
- **p**\ (
- |std_forward|_\<A1>(a1)
- , |std_forward|_\<A2>(a2)
- , …
- , |std_forward|_\<A ## **l**>(a ## **l**)
- , |std_forward|_\<A ## |BOOST_PP_INC|_\ (**l**)>(
- a ## |BOOST_PP_INC|_\ (**l**)
- )
- )
- );
- }
- :vellipsis:`⋮`
- template <typename A1, typename A2, …, typename A ## **h**>
- r
- name(
- A1 && a1, A2 && a2, …, A ## **h** && x ## **h**
- , typename **p**::match<A1, A2, …, A ## **h**>::type p = **p**\ ()
- )
- {
- return **name**\ _with_named_params(
- **p**\ (
- |std_forward|_\<A1>(a1)
- , |std_forward|_\<A2>(a2)
- , …
- , |std_forward|_\<A ## **h**>(a ## **h**)
- )
- );
- }
- The |macros_cpp|_ and |macros_eval_cat_cpp|_ test programs demonstrate proper
- usage of this macro.
- .. |BOOST_PARAMETER_KEYWORD| replace:: ``BOOST_PARAMETER_KEYWORD``
- .. _BOOST_PARAMETER_KEYWORD:
- ``BOOST_PARAMETER_KEYWORD(n, k)``
- ---------------------------------
- .. admonition:: Deprecated
- This macro has been deprecated in favor of
- ``BOOST_PARAMETER_NAME``.
- Generates the declaration of a |keyword tag type| named ``k`` in
- namespace ``n`` and a corresponding |keyword object| definition in
- the enclosing namespace.
- :Defined in: |keyword_header|_
- :Expands to:
- .. parsed-literal::
- namespace **n** {
- struct **k**
- {
- static constexpr char const* keyword_name()
- {
- return ## *k*;
- }
- typedef *unspecified* _;
- typedef *unspecified* _1;
- typedef boost::parameter::forward_reference qualifier;
- // The following definitions are available only when
- // |BOOST_PARAMETER_CAN_USE_MP11|_ is defined.
- template <typename ArgumentPack>
- using binding_fn = typename |binding|_\<
- ArgumentPack
- , *k*
- >::type;
- template <typename ArgumentPack>
- using fn = typename |value_type|_\<ArgumentPack, *k*>::type;
- };
- }
- namespace {
- |keyword|_\<*n*::**k**> const& **k**
- = |keyword|_\<*n*::**k**>::instance;
- }
- ``BOOST_PARAMETER_MATCH(p, a, x)``
- ----------------------------------
- Generates a defaulted parameter declaration for a `forwarding function`_.
- :Defined in: |match_header|_
- :Requires: ``a`` is a `Boost.Preprocessor sequence`__ of the form
- .. parsed-literal::
- (A0)(A1)…(A ## *n*)
- __ ../../../preprocessor/doc/data.html
- :Expands to:
- .. parsed-literal::
- typename **p**::match<**A0**\ , **A1**\ , …, **A** ## *n*>::type
- **x** = **p**\ ()
- Configuration Macros
- ====================
- .. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING| replace:: ``BOOST_PARAMETER_HAS_PERFECT_FORWARDING``
- .. _BOOST_PARAMETER_HAS_PERFECT_FORWARDING:
- ``BOOST_PARAMETER_HAS_PERFECT_FORWARDING``
- ------------------------------------------
- Determines whether or not the library supports perfect forwarding, or the
- preservation of parameter value categories. Users can manually disable this
- macro by ``#defining`` the |BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING|_
- macro. Otherwise, the library will ``#define`` this macro if and only if it
- is not already defined, and if the configuration macros
- |BOOST_NO_FUNCTION_TEMPLATE_ORDERING|_, |BOOST_NO_SFINAE|_,
- |BOOST_NO_CXX11_RVALUE_REFERENCES|_, |BOOST_NO_CXX11_VARIADIC_TEMPLATES|_, and
- |BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS|_ are not already defined by
- |Boost_Config|_.
- :Defined in: |config_header|_
- .. |BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING| replace:: ``BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING``
- .. _BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING:
- ``BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING``
- ----------------------------------------------
- It may be necessary to test user code in case perfect forwarding support is
- unavailable. Users can ``#define`` this macro either in their project
- settings or before including any library header files. Doing so will leave
- both |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and
- |BOOST_PARAMETER_CAN_USE_MP11|_ undefined.
- .. |BOOST_PARAMETER_CAN_USE_MP11| replace:: ``BOOST_PARAMETER_CAN_USE_MP11``
- .. _BOOST_PARAMETER_CAN_USE_MP11:
- ``BOOST_PARAMETER_CAN_USE_MP11``
- --------------------------------
- Determines whether or not the library can use |Boost_MP11|_, a C++11
- metaprogramming library. Users can manually disable this macro by
- ``#defining`` the |BOOST_PARAMETER_DISABLE_MP11_USAGE|_ macro or the
- |BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING|_ macro. Otherwise, the library
- will ``#define`` this macro if and only if it is not already defined, if
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined, and if the configuration
- macros |BOOST_NO_CXX11_CONSTEXPR|_, |BOOST_NO_CXX11_DECLTYPE_N3276|_,
- |BOOST_NO_CXX11_AUTO_DECLARATIONS|_, |BOOST_NO_CXX11_TEMPLATE_ALIASES|_,
- |BOOST_NO_CXX11_STATIC_ASSERT|_, |BOOST_NO_CXX11_HDR_TYPE_TRAITS|_,
- |BOOST_NO_CXX11_HDR_INITIALIZER_LIST|_, and |BOOST_NO_CXX11_HDR_TUPLE|_
- are not already defined by |Boost_Config|_.
- .. Admonition:: Usage Note
- |Boost_MP11|_ and |Boost_MPL|_ are **not** mutually exclusive. It's
- perfectly acceptable to specify deduced parameters using both quoted
- metafunctions and metafunction classes, for example. See
- |evaluate_category_cpp|_.
- :Defined in: |config_header|_
- :Example usage:
- Given the following definitions:
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\(x)
- template <typename A0>
- typename |boost_enable_if|_\<|std_is_same|_\<int,A0>,int>::type
- sfinae(A0 const& a0)
- {
- return 0;
- }
- |Boost_MP11|_ allows deduced parameters to be defined more succinctly:
- .. parsed-literal::
- template <typename T, typename Args>
- using predicate = |std_is_convertible|_\<T,char const*>;
- |BOOST_PARAMETER_FUNCTION|_\((int), sfinae, tag,
- (deduced
- (optional
- (x
- , \*(|mp11_quote|_\<predicate>)
- , static_cast<char const*>(|std_nullptr|_\)
- )
- )
- )
- )
- {
- return 1;
- }
- Without |Boost_MP11|_, deduced parameter definitions tend to be more verbose:
- .. parsed-literal::
- struct predicate
- {
- template <typename T, typename Args>
- struct apply
- : |mpl_if|_\<
- |boost_is_convertible|_\<T,char const*>
- , |mpl_true|_\ // Still have to convert to a
- , |mpl_false|_\ // `Boolean Integral Constant`_.
- >
- {
- };
- };
- |BOOST_PARAMETER_FUNCTION|_\((int), sfinae, tag,
- (deduced
- (optional
- (x
- , \*(predicate)
- , static_cast<char const*>(|std_nullptr|_\)
- )
- )
- )
- )
- {
- return 1;
- }
- Either way, the following assertions will succeed:
- .. parsed-literal::
- assert(1 == sfinae());
- assert(1 == sfinae("foo"));
- assert(0 == sfinae(1));
- As another example, given the following declarations and definitions:
- .. parsed-literal::
- |BOOST_PARAMETER_NAME|_\(x)
- |BOOST_PARAMETER_NAME|_\(y)
- template <typename E, typename Args>
- void check0(E const& e, Args const& args);
- template <typename P, typename E, typename ...Args>
- void check(E const& e, Args const&... args)
- {
- check0(e, P()(args...));
- }
- Argument packs qualify as |Boost_MP11|_-style lists containing
- |keyword tag type|\ s:
- .. parsed-literal::
- template <typename Args>
- struct some_functor
- {
- template <typename K>
- void operator()(K&&) const
- {
- // K is one of tag\:\:x, tag\:\:y, etc.
- }
- };
- template <typename E, typename Args>
- void check0(E const& e, Args const& args)
- {
- boost::mp11::mp_for_each<E>(some_functor<Args>());
- }
- The first check determines whether or not the argument type of ``_y`` is the
- same as the reference type of ``_x``, while the second check determines
- whether or not the argument type of ``_y`` is convertible to the value type of
- ``_x``. Here, it's possible to access the reference and value result types of
- indexing an argument pack a little more directly:
- .. parsed-literal::
- // Use mp_bind on tag\:\:x\:\:binding_fn to access the reference type of _x.
- check<
- |parameters|_\<
- tag\:\:x
- , |optional|_\<
- |deduced|_\<tag\:\:y>
- , |mp11_bind|_\<
- |std_is_same|_\ // |boost_is_same|_, standard version.
- , |mp11_1|_\ // will be bound to the argument type of _y.
- , |mp11_bind|_\<
- tag\:\:x\:\:binding_fn
- , |mp11_2|_\ // will be bound to the argument pack type.
- >
- >
- >
- >
- >((_x = 0, _y = 1), 0, 1);
- // Use mp_bind_q on tag\:\:x to access the value type of _x.
- check<
- |parameters|_\<
- tag\:\:x
- , |optional|_\<
- |deduced|_\<tag\:\:y>
- , |mp11_bind|_\<
- |std_is_convertible|_\ // |boost_is_convertible|_, standard version.
- , |mp11_1|_\ // will be bound to the argument type of _y.
- , |mp11_bind_q|_\<
- tag\:\:x
- , |mp11_2|_\ // will be bound to the argument pack type.
- >
- >
- >
- >
- >((_x = 0U, _y = 1U), 0U, 1U);
- Argument packs still qualify as |Boost_MPL|_-style lists containing
- |keyword tag type|\ s:
- .. parsed-literal::
- template <typename Args>
- struct some_functor
- {
- template <typename K>
- void operator()(K) const
- {
- // K is one of tag\:\:x, tag\:\:y, etc.
- }
- };
- template <typename E, typename Args>
- void check0(E const& e, Args const& args)
- {
- boost::mpl::for_each<E>(some_functor<Args>());
- }
- However, without |Boost_MP11|_, the corresponding checks become a little more
- verbose:
- .. parsed-literal::
- check<
- |parameters|_\<
- tag\:\:x
- , |optional|_\<
- |deduced|_\<tag\:\:y>
- , |mpl_if|_\<
- |boost_is_same|_\<
- |boost_add_lvalue_reference|_\<|mp11_1|_\>
- , |binding|_\<|mp11_2|_\, tag\:\:x>
- >
- , |mpl_true|_\ // Still have to convert to a
- , |mpl_false|_\ // `Boolean Integral Constant`_.
- >
- >
- >
- >((_x = 0, _y = 1), 0, 1);
- // Use tag\:\:x\:\:_ or tag\:\:x\:\:_1 to access the value type of _x.
- check<
- |parameters|_\<
- tag\:\:x
- , |optional|_\<
- |deduced|_\<tag\:\:y>
- , |mpl_if|_\<
- |boost_is_convertible|_\<|mp11_1|_\, tag\:\:x\:\:_1>
- , |mpl_true|_\ // Still have to convert to a
- , |mpl_false|_\ // `Boolean Integral Constant`_.
- >
- >
- >
- >((_x = 0U, _y = 1U), 0U, 1U);
- The |singular_cpp|_, |compose_cpp|_, |optional_deduced_sfinae_cpp|_, and
- |deduced_dep_pred_cpp|_ test programs demonstrate proper usage of this
- macro.
- .. |BOOST_PARAMETER_DISABLE_MP11_USAGE| replace:: ``BOOST_PARAMETER_DISABLE_MP11_USAGE``
- .. _BOOST_PARAMETER_DISABLE_MP11_USAGE:
- ``BOOST_PARAMETER_DISABLE_MP11_USAGE``
- --------------------------------------
- It may be necessary to disable usage of |Boost_MP11|_ for compilers that
- cannot support it. Users can ``#define`` this macro either in their project
- settings or before including any library header files. Doing so will leave
- |BOOST_PARAMETER_CAN_USE_MP11|_ undefined.
- .. |BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE| replace:: ``BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE``
- .. _BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE:
- ``BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE``
- -----------------------------------------
- If |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is ``#defined``, then determines
- the `MPL Variadic Sequence`_ underlying the nested ``parameter_spec`` type of
- |parameters|. If the user does not manually ``#define`` this macro, then the
- library will ``#define`` it as |mp11_list|_ if
- |BOOST_PARAMETER_CAN_USE_MP11|_ is defined, |fusion_list|_ if
- |BOOST_FUSION_HAS_VARIADIC_LIST|_ is defined (by |Boost_Fusion|_),
- |fusion_deque|_ if |BOOST_FUSION_HAS_VARIADIC_DEQUE|_ is defined
- (by |Boost_Fusion|_), or |mpl_vector|_ otherwise.
- :Example:
- .. parsed-literal::
- #define BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE |fusion_vector|_
- :Defined in: |parameters_header|_
- .. |BOOST_PARAMETER_MAX_ARITY| replace:: ``BOOST_PARAMETER_MAX_ARITY``
- .. _BOOST_PARAMETER_MAX_ARITY:
- ``BOOST_PARAMETER_MAX_ARITY``
- -----------------------------
- If |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is ``#defined``, then:
- * If the `MPL Variadic Sequence`_ underlying the nested ``parameter_spec``
- type of |parameters| does not have a size limit--which is the case with
- |mp11_list|_, |fusion_list|_, and |fusion_deque|_, but not
- |mpl_vector|_--then this macro can be safely ignored. User code that
- manually defines |BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE|_ should also
- manually define this macro to the size limit of the sequence if it has
- one.
- If |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is **not** ``#defined``, then:
- * Mutable references must be wrapped by |boost_ref|_ or |std_ref|_ if passed
- by position to Boost.Parameter-enabled functions with arity greater than
- or equal to |BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY|_.
- :Defined in: |config_header|_
- :Default Value: |BOOST_MPL_LIMIT_VECTOR_SIZE|_ (defined by |Boost_MPL|_) if
- perfect forwarding is supported, ``8`` otherwise.
- :Minimum Value: ``2``
- :Maximum Value: |BOOST_PARAMETER_COMPOSE_MAX_ARITY|_
- .. |BOOST_PARAMETER_COMPOSE_MAX_ARITY| replace:: ``BOOST_PARAMETER_COMPOSE_MAX_ARITY``
- .. _BOOST_PARAMETER_COMPOSE_MAX_ARITY:
- ``BOOST_PARAMETER_COMPOSE_MAX_ARITY``
- -------------------------------------
- If |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is **not** ``#defined``, then
- determines the maximum number of arguments supported by the |compose| function
- and by the |BOOST_PARAMETER_NO_SPEC_FUNCTION|_,
- |BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION|_,
- |BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION|_,
- |BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR|_,
- |BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR|_,
- |BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR|_, and
- |BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR|_ code generation macros.
- :Defined in: |config_header|_
- :Default Value: ``20`` for a few older compilers, ``64`` otherwise
- :Minimum Value: ``2``
- .. |BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY| replace:: ``BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY``
- .. _BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY:
- ``BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY``
- --------------------------------------------------------
- If this library does **not** support perfect forwarding, determines the number
- of arguments less than which |parameters| generates an exponential number of
- function call operator overloads, and greater than or equal to which
- |parameters| does not. Will only be ``#defined`` by the library if it is
- not already ``#defined`` and |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is
- **not** ``#defined``.
- :Defined in: |config_header|_
- :Default Value: ``0``
- :Minimum Value: ``0``
- ...Outside Of This Library
- --------------------------
- #. If |Boost_Config|_ defines the macro
- |BOOST_NO_FUNCTION_TEMPLATE_ORDERING|_, then the macros
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and
- |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined; otherwise, the
- code generation macros would not work correctly.
- #. If |Boost_Config|_ defines the macro |BOOST_NO_SFINAE|_, then the macros
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and
- |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined; otherwise, keyword
- types generated by |BOOST_PARAMETER_NAME|_ and
- |BOOST_PARAMETER_NESTED_KEYWORD|_ would not work correctly.
- #. If |Boost_Config|_ defines the macro
- |BOOST_NO_CXX11_RVALUE_REFERENCES|_, then the macros
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and
- |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
- #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_VARIADIC_TEMPLATES|_,
- then the macros |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and
- |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
- #. If |Boost_Config|_ defines the macro
- |BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS|_, then the macros
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and
- |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
- #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_CONSTEXPR|_, then the
- macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
- #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_DECLTYPE_N3276|_,
- then the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
- #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_AUTO_DECLARATIONS|_,
- then the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
- #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_TEMPLATE_ALIASES|_,
- then the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
- #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_STATIC_ASSERT|_, then
- the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
- #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_HDR_TYPE_TRAITS|_,
- then the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
- #. If |Boost_Config|_ defines the macro
- |BOOST_NO_CXX11_HDR_INITIALIZER_LIST|_, then the macro
- |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
- #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_HDR_TUPLE|_, then the
- macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
- #. If |Boost_Fusion|_ defines the macro |BOOST_FUSION_HAS_VARIADIC_LIST|_,
- if this library defines the macro
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_, and if
- |BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE|_ is left undefined, then the
- `MPL Variadic Sequence`_ underlying the nested ``parameter_spec`` type of
- |parameters| will be |fusion_list|_.
- #. If |Boost_Fusion|_ defines the macro |BOOST_FUSION_HAS_VARIADIC_DEQUE|_,
- if this library defines the macro
- |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_, and if
- |BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE|_ is left undefined, then the
- `MPL Variadic Sequence`_ underlying the nested ``parameter_spec`` type of
- |parameters| will be |fusion_deque|_.
- #. The value that |Boost_MPL|_ defines the macro
- |BOOST_MPL_LIMIT_VECTOR_SIZE|_ as will be the value that this library
- defines the macro |BOOST_PARAMETER_MAX_ARITY|_ as if this library defines
- the macro |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_.
- Tutorial
- ========
- Follow `this link`__ to the Boost.Parameter tutorial documentation.
- __ index.html#tutorial
- //////////////////////////////////////////////////////////////////////////////
- .. [#thread] References to tag objects may be initialized multiple
- times. This scenario can only occur in the presence of
- threading. Because the C++ standard doesn't consider threading,
- it doesn't explicitly allow or forbid multiple initialization of
- references. That said, it's hard to imagine an implementation
- where it could make a difference.
- .. [#no_result_of] Where |BOOST_NO_RESULT_OF|_ is ``#defined``,
- |boost_result_of|_\ ``<F()>::type`` is replaced by ``F::result_type``.
- .. |std_nullptr| replace:: std::nullptr
- .. _std_nullptr: http://en.cppreference.com/w/cpp/language/nullptr
- .. |std_forward| replace:: std::forward
- .. _std_forward: http://en.cppreference.com/w/cpp/utility/forward
- .. |std_enable_if| replace:: std::enable_if
- .. _std_enable_if: http://en.cppreference.com/w/cpp/types/enable_if
- .. |std_is_convertible| replace:: std::is_convertible
- .. _std_is_convertible: http://en.cppreference.com/w/cpp/types/is_convertible
- .. |std_is_same| replace:: std::is_same
- .. _std_is_same: http://en.cppreference.com/w/cpp/types/is_same
- .. |std_ref| replace:: ``std::ref``
- .. _std_ref: http://en.cppreference.com/w/cpp/utility/functional/ref
- .. |std_map| replace:: std::map
- .. _std_map: http://en.cppreference.com/w/cpp/container/map
- .. |std_string| replace:: std::string
- .. _std_string: http://en.cppreference.com/w/cpp/string/basic_string
- .. |std_bitset| replace:: std::bitset
- .. _std_bitset: http://en.cppreference.com/w/cpp/utility/bitset
- .. |Boost_Config| replace:: Boost.Config
- .. _Boost_Config: ../../../config/doc/html/index.html
- .. |BOOST_NO_FUNCTION_TEMPLATE_ORDERING| replace:: ``BOOST_NO_FUNCTION_TEMPLATE_ORDERING``
- .. _BOOST_NO_FUNCTION_TEMPLATE_ORDERING: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__03_defects
- .. |BOOST_NO_SFINAE| replace:: ``BOOST_NO_SFINAE``
- .. _BOOST_NO_SFINAE: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__03_defects
- .. |BOOST_NO_CXX11_AUTO_DECLARATIONS| replace:: ``BOOST_NO_CXX11_AUTO_DECLARATIONS``
- .. _BOOST_NO_CXX11_AUTO_DECLARATIONS: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported
- .. |BOOST_NO_CXX11_CONSTEXPR| replace:: ``BOOST_NO_CXX11_CONSTEXPR``
- .. _BOOST_NO_CXX11_CONSTEXPR: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported
- .. |BOOST_NO_CXX11_DECLTYPE_N3276| replace:: ``BOOST_NO_CXX11_DECLTYPE_N3276``
- .. _BOOST_NO_CXX11_DECLTYPE_N3276: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported
- .. |BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS| replace:: ``BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS``
- .. _BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported
- .. |BOOST_NO_CXX11_HDR_INITIALIZER_LIST| replace:: ``BOOST_NO_CXX11_HDR_INITIALIZER_LIST``
- .. _BOOST_NO_CXX11_HDR_INITIALIZER_LIST: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported
- .. |BOOST_NO_CXX11_HDR_TUPLE| replace:: ``BOOST_NO_CXX11_HDR_TUPLE``
- .. _BOOST_NO_CXX11_HDR_TUPLE: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported
- .. |BOOST_NO_CXX11_HDR_TYPE_TRAITS| replace:: ``BOOST_NO_CXX11_HDR_TYPE_TRAITS``
- .. _BOOST_NO_CXX11_HDR_TYPE_TRAITS: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported
- .. |BOOST_NO_CXX11_RVALUE_REFERENCES| replace:: ``BOOST_NO_CXX11_RVALUE_REFERENCES``
- .. _BOOST_NO_CXX11_RVALUE_REFERENCES: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported
- .. |BOOST_NO_CXX11_STATIC_ASSERT| replace:: ``BOOST_NO_CXX11_STATIC_ASSERT``
- .. _BOOST_NO_CXX11_STATIC_ASSERT: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported
- .. |BOOST_NO_CXX11_TEMPLATE_ALIASES| replace:: ``BOOST_NO_CXX11_TEMPLATE_ALIASES``
- .. _BOOST_NO_CXX11_TEMPLATE_ALIASES: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported
- .. |BOOST_NO_CXX11_VARIADIC_TEMPLATES| replace:: ``BOOST_NO_CXX11_VARIADIC_TEMPLATES``
- .. _BOOST_NO_CXX11_VARIADIC_TEMPLATES: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported
- .. |Boost_Preprocessor| replace:: Boost.Preprocessor
- .. _Boost_Preprocessor: ../../../preprocessor/doc/index.html
- .. _`sequence`: ../../../preprocessor/doc/data/sequences.html
- .. |BOOST_PP_INC| replace:: BOOST_PP_INC
- .. _BOOST_PP_INC: ../../../preprocessor/doc/ref/inc.html
- .. |boost_enable_if| replace:: boost::enable_if
- .. _boost_enable_if: ../../../core/doc/html/core/enable_if.html
- .. |boost_enable_if_c| replace:: boost::enable_if_c
- .. _boost_enable_if_c: ../../../core/doc/html/core/enable_if.html
- .. |boost_lazy_enable_if| replace:: boost::lazy_enable_if
- .. _boost_lazy_enable_if: ../../../core/doc/html/core/enable_if.html
- .. |boost_lazy_enable_if_c| replace:: boost::lazy_enable_if_c
- .. _boost_lazy_enable_if_c: ../../../core/doc/html/core/enable_if.html
- .. |boost_disable_if| replace:: boost::disable_if
- .. _boost_disable_if: ../../../core/doc/html/core/enable_if.html
- .. |boost_disable_if_c| replace:: boost::disable_if_c
- .. _boost_disable_if_c: ../../../core/doc/html/core/enable_if.html
- .. |boost_lazy_disable_if| replace:: boost::lazy_disable_if
- .. _boost_lazy_disable_if: ../../../core/doc/html/core/enable_if.html
- .. |boost_lazy_disable_if_c| replace:: boost::lazy_disable_if_c
- .. _boost_lazy_disable_if_c: ../../../core/doc/html/core/enable_if.html
- .. |boost_ref| replace:: ``boost::ref``
- .. _boost_ref: ../../../core/doc/html/core/ref.html
- .. |BOOST_NO_RESULT_OF| replace:: ``BOOST_NO_RESULT_OF``
- .. _BOOST_NO_RESULT_OF: ../../../utility/utility.htm#BOOST_NO_RESULT_OF
- .. |boost_result_of| replace:: ``boost::result_of``
- .. _boost_result_of: ../../../utility/utility.htm#result_of
- .. |boost_is_const| replace:: boost::is_const
- .. _boost_is_const: ../../../type_traits/doc/html/boost_typetraits/is_const.html
- .. |boost_is_convertible| replace:: boost::is_convertible
- .. _boost_is_convertible: ../../../type_traits/doc/html/boost_typetraits/is_convertible.html
- .. |boost_is_same| replace:: boost::is_same
- .. _boost_is_same: ../../../type_traits/doc/html/boost_typetraits/is_same.html
- .. |boost_is_scalar| replace:: boost::is_scalar
- .. _boost_is_scalar: ../../../type_traits/doc/html/boost_typetraits/is_scalar.html
- .. |boost_add_lvalue_reference| replace:: boost::add_lvalue_reference
- .. _boost_add_lvalue_reference: ../../../type_traits/doc/html/boost_typetraits/add_lvalue_reference.html
- .. |boost_remove_reference| replace:: boost::remove_reference
- .. _boost_remove_reference: ../../../type_traits/doc/html/boost_typetraits/remove_reference.html
- .. |Boost_MPL| replace:: Boost.MPL
- .. _Boost_MPL: ../../../mpl/doc/index.html
- .. _`Metafunction`: ../../../mpl/doc/refmanual/metafunction.html
- .. _`Boolean Integral Constant`: ../../../mpl/doc/refmanual/integral-constant.html
- .. _`MPL Binary Metafunction Class`: ../../../mpl/doc/refmanual/metafunction-class.html
- .. _`MPL Forward Sequence`: ../../../mpl/doc/refmanual/forward-sequence.html
- .. _`MPL Associative Sequence`: ../../../mpl/doc/refmanual/associative-sequence.html
- .. _`MPL Variadic Sequence`: ../../../mpl/doc/refmanual/variadic-sequence.html
- .. |BOOST_MPL_LIMIT_VECTOR_SIZE| replace:: ``BOOST_MPL_LIMIT_VECTOR_SIZE``
- .. _BOOST_MPL_LIMIT_VECTOR_SIZE: ../../../mpl/doc/refmanual/limit-vector-size.html
- .. |mpl_eval_if| replace:: boost::mpl::eval_if
- .. _mpl_eval_if: ../../../mpl/doc/refmanual/eval-if.html
- .. |mpl_true| replace:: mpl::true\_
- .. _mpl_true: ../../../mpl/doc/refmanual/bool.html
- .. |mpl_false| replace:: mpl::false\_
- .. _mpl_false: ../../../mpl/doc/refmanual/bool.html
- .. |mpl_if| replace:: mpl::if\_
- .. _mpl_if: ../../../mpl/doc/refmanual/if.html
- .. |mpl_vector| replace:: ``boost::mpl::vector``
- .. _mpl_vector: ../../../mpl/doc/refmanual/vector.html
- .. |Boost_MP11| replace:: Boost.MP11
- .. _Boost_MP11: ../../../mp11/doc/html/mp11.html
- .. |mp11_quote| replace:: boost::mp11::mp_quote
- .. _mp11_quote: ../../../mp11/doc/html/mp11.html#mp_quotef
- .. |mp11_1| replace:: boost::mp11::_1
- .. _mp11_1: ../../../mp11/doc/html/mp11.html#1_9
- .. |mp11_2| replace:: boost::mp11::_2
- .. _mp11_2: ../../../mp11/doc/html/mp11.html#1_9
- .. |mp11_bind| replace:: boost::mp11::mp_bind
- .. _mp11_bind: ../../../mp11/doc/html/mp11.html#mp_bindf_t
- .. |mp11_bind_q| replace:: boost::mp11::mp_bind_q
- .. _mp11_bind_q: ../../../mp11/doc/html/mp11.html#mp_bind_qq_t
- .. |mp11_list| replace:: ``boost::mp11::mp_list``
- .. _mp11_list: ../../../mp11/doc/html/mp11.html#mp_listt
- .. |Boost_Fusion| replace:: Boost.Fusion
- .. _Boost_Fusion: ../../../fusion/doc/html/index.html
- .. |BOOST_FUSION_HAS_VARIADIC_DEQUE| replace:: ``BOOST_FUSION_HAS_VARIADIC_DEQUE``
- .. _BOOST_FUSION_HAS_VARIADIC_DEQUE: ../../../../boost/fusion/container/deque/deque_fwd.hpp
- .. |BOOST_FUSION_HAS_VARIADIC_LIST| replace:: ``BOOST_FUSION_HAS_VARIADIC_LIST``
- .. _BOOST_FUSION_HAS_VARIADIC_LIST: ../../../../boost/fusion/container/list/list_fwd.hpp
- .. |fusion_vector| replace:: ``boost::fusion::vector``
- .. _fusion_vector: ../../../fusion/doc/html/fusion/container/vector.html
- .. |fusion_deque| replace:: ``boost::fusion::deque``
- .. _fusion_deque: ../../../fusion/doc/html/fusion/container/deque.html
- .. |fusion_list| replace:: ``boost::fusion::list``
- .. _fusion_list: ../../../fusion/doc/html/fusion/container/list.html
- .. |config_header| replace:: boost/parameter/config.hpp
- .. _config_header: ../../../../boost/parameter/config.hpp
- .. |binding_header| replace:: boost/parameter/binding.hpp
- .. _binding_header: ../../../../boost/parameter/binding.hpp
- .. |value_type_header| replace:: boost/parameter/value_type.hpp
- .. _value_type_header: ../../../../boost/parameter/value_type.hpp
- .. |are_tagged_arguments_header| replace:: boost/parameter/are_tagged_arguments.hpp
- .. _are_tagged_arguments_header: ../../../../boost/parameter/are_tagged_arguments.hpp
- .. |is_argument_pack_header| replace:: boost/parameter/is_argument_pack.hpp
- .. _is_argument_pack_header: ../../../../boost/parameter/is_argument_pack.hpp
- .. |template_keyword_header| replace:: boost/parameter/template_keyword.hpp
- .. _template_keyword_header: ../../../../boost/parameter/template_keyword.hpp
- .. |keyword_header| replace:: boost/parameter/keyword.hpp
- .. _keyword_header: ../../../../boost/parameter/keyword.hpp
- .. |name_header| replace:: boost/parameter/name.hpp
- .. _name_header: ../../../../boost/parameter/name.hpp
- .. |nested_keyword_header| replace:: boost/parameter/nested_keyword.hpp
- .. _nested_keyword_header: ../../../../boost/parameter/nested_keyword.hpp
- .. |compose_header| replace:: boost/parameter/compose.hpp
- .. _compose_header: ../../../../boost/parameter/compose.hpp
- .. |preprocessor_no_spec_header| replace:: boost/parameter/preprocessor_no_spec.hpp
- .. _preprocessor_no_spec_header: ../../../../boost/parameter/preprocessor_no_spec.hpp
- .. |required_header| replace:: boost/parameter/required.hpp
- .. _required_header: ../../../../boost/parameter/required.hpp
- .. |optional_header| replace:: boost/parameter/optional.hpp
- .. _optional_header: ../../../../boost/parameter/optional.hpp
- .. |deduced_header| replace:: boost/parameter/deduced.hpp
- .. _deduced_header: ../../../../boost/parameter/deduced.hpp
- .. |parameters_header| replace:: boost/parameter/parameters.hpp
- .. _parameters_header: ../../../../boost/parameter/parameters.hpp
- .. |match_header| replace:: boost/parameter/match.hpp
- .. _match_header: ../../../../boost/parameter/match.hpp
- .. |macros_header| replace:: boost/parameter/macros.hpp
- .. _macros_header: ../../../../boost/parameter/macros.hpp
- .. |preprocessor_header| replace:: boost/parameter/preprocessor.hpp
- .. _preprocessor_header: ../../../../boost/parameter/preprocessor.hpp
- .. |function_type_tpl_param_cpp| replace:: function_type_tpl_param.cpp
- .. _function_type_tpl_param_cpp: ../../test/function_type_tpl_param.cpp
- .. |ntp_cpp| replace:: test/ntp.cpp
- .. _ntp_cpp: ../../test/ntp.cpp
- .. |singular_cpp| replace:: singular.cpp
- .. _singular_cpp: ../../test/singular.cpp
- .. |compose_cpp| replace:: compose.cpp
- .. _compose_cpp: ../../test/compose.cpp
- .. |evaluate_category_cpp| replace:: evaluate_category.cpp
- .. _evaluate_category_cpp: ../../test/evaluate_category.cpp
- .. |parameterized_inheritance_cpp| replace:: parameterized_inheritance.cpp
- .. _parameterized_inheritance_cpp: ../../test/parameterized_inheritance.cpp
- .. |preproc_eval_cat_no_spec_cpp| replace:: preprocessor_eval_cat_no_spec.cpp
- .. _preproc_eval_cat_no_spec_cpp: ../../test/preprocessor_eval_cat_no_spec.cpp
- .. |preprocessor_eval_cat_cpp| replace:: preprocessor_eval_category.cpp
- .. _preprocessor_eval_cat_cpp: ../../test/preprocessor_eval_category.cpp
- .. |preprocessor_eval_cat_8_cpp| replace:: preprocessor_eval_cat_8.cpp
- .. _preprocessor_eval_cat_8_cpp: ../../test/preprocessor_eval_cat_8.cpp
- .. |optional_deduced_sfinae_cpp| replace:: optional_deduced_sfinae.cpp
- .. _optional_deduced_sfinae_cpp: ../../test/optional_deduced_sfinae.cpp
- .. |mpl_cpp| replace:: mpl.cpp
- .. _mpl_cpp: ../../test/mpl.cpp
- .. |preprocessor_cpp| replace:: preprocessor.cpp
- .. _preprocessor_cpp: ../../test/preprocessor.cpp
- .. |preprocessor_deduced_cpp| replace:: preprocessor_deduced.cpp
- .. _preprocessor_deduced_cpp: ../../test/preprocessor_deduced.cpp
- .. |deduced_dep_pred_cpp| replace:: deduced_dependent_predicate.cpp
- .. _deduced_dep_pred_cpp: ../../test/deduced_dependent_predicate.cpp
- .. |macros_eval_cat_cpp| replace:: macros_eval_category.cpp
- .. _macros_eval_cat_cpp: ../../test/macros_eval_category.cpp
- .. |macros_cpp| replace:: macros.cpp
- .. _macros_cpp: ../../test/macros.cpp
|