reference.rst 238 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398
  1. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. The Boost Parameter Library Reference Documentation
  3. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4. :Authors: David Abrahams, Daniel Wallin
  5. :Contact: dave@boost-consulting.com, daniel@boostpro.com
  6. :organization: `BoostPro Computing`_
  7. :date: $Date: 2005/07/17 19:53:01 $
  8. :copyright: Copyright David Abrahams, Daniel Wallin
  9. 2005-2009. Distributed under the Boost Software License,
  10. Version 1.0. (See accompanying file LICENSE_1_0.txt
  11. or copy at http://www.boost.org/LICENSE_1_0.txt)
  12. |(logo)|__
  13. .. |(logo)| image:: ../../../../boost.png
  14. :alt: Boost
  15. __ ../../../../index.htm
  16. .. _`BoostPro Computing`: http://www.boostpro.com
  17. //////////////////////////////////////////////////////////////////////////////
  18. .. contents::
  19. :depth: 2
  20. //////////////////////////////////////////////////////////////////////////////
  21. .. role:: class
  22. :class: class
  23. .. role:: concept
  24. :class: concept
  25. .. role:: function
  26. :class: function
  27. .. |ArgumentPack| replace:: :concept:`ArgumentPack`
  28. .. |ForwardSequence| replace:: :concept:`Forward Sequence`
  29. .. |ParameterSpec| replace:: :concept:`ParameterSpec`
  30. .. role:: vellipsis
  31. :class: vellipsis
  32. .. section-numbering::
  33. :depth: 2
  34. Preliminaries
  35. =============
  36. This section covers some basic information you'll need to know in order to
  37. understand this reference.
  38. Namespaces
  39. ----------
  40. In this document, all unqualified identifiers should be assumed to be defined
  41. in namespace ``boost::parameter`` unless otherwise specified.
  42. Exceptions
  43. ----------
  44. No operation described in this document throws an exception unless otherwise
  45. specified.
  46. Thread Safety
  47. -------------
  48. All components of this library can be used safely from multiple threads
  49. without synchronization. [#thread]_
  50. Typography
  51. ----------
  52. Names written in :concept:`sans serif type` represent concepts_.
  53. In code blocks, *italic type* represents unspecified text that satisfies the
  54. requirements given in the detailed description that follows the code block.
  55. In a specification of the tokens generated by a macro, **bold type** is used
  56. to highlight the position of the expanded macro argument in the result.
  57. The special character β represents the value of |BOOST_PARAMETER_MAX_ARITY|_.
  58. //////////////////////////////////////////////////////////////////////////////
  59. Terminology
  60. ===========
  61. .. |kw| replace:: keyword
  62. .. _kw:
  63. keyword
  64. The name of a function parameter.
  65. .. _keyword tag type:
  66. .. |keyword tag type| replace:: `keyword tag type`_
  67. keyword tag type
  68. A type used to uniquely identify a function parameter. Typically its name
  69. will be the same as that of the parameter.
  70. .. _positional:
  71. .. |positional| replace:: `positional`_
  72. positional argument
  73. An argument passed with no explicit |kw|. Its parameter is determined
  74. in the usual C++ way: by position with respect to a parameter list.
  75. .. _tag type:
  76. .. |tag type| replace:: `tag type`_
  77. tag type
  78. Shorthand for “\ |keyword tag type|.”
  79. .. _keyword object:
  80. .. |keyword object| replace:: `keyword object`_
  81. keyword object
  82. An instance of |keyword|_\ ``<T>`` for some |tag type| ``T``.
  83. .. _tagged reference:
  84. .. |tagged reference| replace:: `tagged reference`_
  85. tagged reference
  86. An object whose type is associated with a |keyword tag type| (the object's
  87. *keyword*), and that holds a reference (to the object's *value*).
  88. As a shorthand, a “tagged reference to ``x``\ ” means a tagged reference
  89. whose *value* is ``x``.
  90. .. _tagged default:
  91. .. |tagged default| replace:: `tagged default`_
  92. tagged default
  93. A |tagged reference| whose *value* represents the value of a
  94. default argument.
  95. .. _tagged lazy default:
  96. .. |tagged lazy default| replace:: `tagged lazy default`_
  97. tagged lazy default
  98. A |tagged reference| whose *value*, when invoked with no arguments,
  99. computes a default argument value.
  100. .. _intended argument type:
  101. .. |intended argument type| replace:: `intended argument type`_
  102. intended argument type
  103. The *intended argument type* of a single-element |ArgumentPack|_ is the
  104. type of its element's *value*. The intended argument type of any other
  105. type ``X`` is ``X`` itself.
  106. .. Note::
  107. In this reference, we will use concept names (and other names) to describe
  108. both types and objects, depending on context. So for example, “an
  109. |ArgumentPack|_\ ” can refer to a type that models |ArgumentPack|_
  110. *or* an object of such a type.
  111. //////////////////////////////////////////////////////////////////////////////
  112. Concepts
  113. ========
  114. This section describes the generic type concepts used by the Parameter
  115. library.
  116. |ArgumentPack|
  117. --------------
  118. An |ArgumentPack| is a collection of |tagged reference|\ s to the actual
  119. arguments passed to a function. Every |ArgumentPack| is also a valid `MPL
  120. Forward Sequence`_ and `MPL Associative Sequence`_ consisting of the |keyword
  121. tag type|\ s in its |tagged reference|\ s. If |BOOST_PARAMETER_CAN_USE_MP11|
  122. is defined, then every |ArgumentPack| is also a valid |Boost_MP11|_ map whose
  123. keys are |keyword tag type|\ s. The |singular_cpp|_, |compose_cpp|_, and
  124. |mpl_cpp|_ test programs demonstrate this functionality.
  125. Requirements
  126. ............
  127. In the table below,
  128. * ``A`` is a model of |ArgumentPack|
  129. * ``x`` is an instance of ``A``
  130. * ``u`` is a |keyword object| of type ``K``
  131. * ``v`` is a |tagged default| with |tag type| ``L`` and *value* of type ``D``
  132. * ``w`` is a |tagged lazy default| with |tag type| ``M`` and *value* of type ``E const``
  133. * ``z`` is an |ArgumentPack| containing a single element (as created by |keyword|_\ ``<…>::operator=``)
  134. Any exceptions thrown from the invocation of ``w``\ 's *value*
  135. will be propagated to the caller.
  136. .. table:: |ArgumentPack| requirements
  137. +------------+---------------------------------+----------------+----------------------+
  138. | Expression | Type | Requirements | Semantics/Notes |
  139. +============+=================================+================+======================+
  140. | ``x[u]`` | ``binding<A, K>::type`` | ``x`` contains | Returns *b*\ 's |
  141. | | | an element *b* | *value* (by |
  142. | | | whose |kw|_ is | reference). |
  143. | | | ``K`` | |
  144. +------------+---------------------------------+----------------+----------------------+
  145. | ``x[u]`` | ``binding<A, L, D>::type`` | *none* | If ``x`` contains an |
  146. | | | | element *b* whose |
  147. | | | | |kw|_ is the same as |
  148. | | | | ``u``\ 's, returns |
  149. | | | | *b*\ 's *value* (by |
  150. | | | | reference). |
  151. | | | | Otherwise, returns |
  152. | | | | ``u``\ 's *value*. |
  153. +------------+---------------------------------+----------------+----------------------+
  154. | ``x[w]`` | ``lazy_binding<A, M, E>::type`` | *none* | If ``x`` contains an |
  155. | | | | element *b* whose |
  156. | | | | |kw|_ is the same as |
  157. | | | | ``w``\ 's, returns |
  158. | | | | *b*\ 's *value* (by |
  159. | | | | reference). |
  160. | | | | Otherwise, invokes |
  161. | | | | ``w``\ 's *value* |
  162. | | | | and returns the |
  163. | | | | result. |
  164. +------------+---------------------------------+----------------+----------------------+
  165. | ``x, z`` | Model of |ArgumentPack|_ | *none* | Returns an |
  166. | | | | |ArgumentPack|_ |
  167. | | | | containing all the |
  168. | | | | elements of both |
  169. | | | | ``x`` and ``z``. |
  170. +------------+---------------------------------+----------------+----------------------+
  171. .. _parameterspec:
  172. |ParameterSpec|
  173. ---------------
  174. A |ParameterSpec| describes the type requirements for arguments corresponding
  175. to a given |kw|_ and indicates whether the argument is optional or
  176. required. The table below details the allowed forms and describes their
  177. condition for satisfaction by an actual argument type. In each row,
  178. .. _conditions:
  179. * ``K`` is the |ParameterSpec|\ 's |keyword tag type|
  180. * ``A`` is an |intended argument type| associated with ``K``, if any
  181. * ``P`` is a model of |ArgumentPack| that contains ``A``
  182. * ``F`` is an `MPL Binary Metafunction Class`_
  183. .. _`MPL Binary Metafunction Class`: ../../../mpl/doc/refmanual/metafunction-class.html
  184. .. table:: |ParameterSpec| allowed forms and conditions of satisfaction
  185. +------------------------+----------+----------------------------------------+
  186. | Type | ``A`` | Condition ``A`` must satisfy |
  187. | | required | |
  188. +========================+==========+========================================+
  189. | ``K`` | no | *n/a* |
  190. +------------------------+----------+----------------------------------------+
  191. | |optional|_\ ``<K,F>`` | no | ``mpl::apply2<F,A,P>::type::value`` is |
  192. | | | ``true``. |
  193. +------------------------+----------+----------------------------------------+
  194. | |required|_\ ``<K,F>`` | yes | ``mpl::apply2<F,A,P>::type::value`` is |
  195. | | | ``true``. |
  196. +------------------------+----------+----------------------------------------+
  197. The information in a |ParameterSpec| is used to `limit`__ the arguments that
  198. will be matched by `forwarding functions`_.
  199. __ overloadcontrol_
  200. .. _overloadcontrol: index.html#controlling-overload-resolution
  201. .. _forwarding functions: index.html#forwarding-functions
  202. //////////////////////////////////////////////////////////////////////////////
  203. Class Templates
  204. ===============
  205. .. |keyword| replace:: ``keyword``
  206. .. _keyword:
  207. ``keyword``
  208. -----------
  209. The type of every |keyword object| is a specialization of |keyword|.
  210. :Defined in: |keyword_header|_
  211. .. parsed-literal::
  212. template <typename Tag>
  213. struct keyword
  214. {
  215. typedef Tag tag;
  216. template <typename T>
  217. constexpr typename |boost_enable_if|_\<
  218. typename |mpl_eval_if|_\<
  219. |boost_is_scalar|_\<T>
  220. , |mpl_true|_\ // Enable this overload for scalar types.
  221. , |mpl_eval_if|_\<
  222. |boost_is_same|_\<
  223. typename Tag\:\:qualifier
  224. , boost::parameter::in_reference
  225. >
  226. , |mpl_true|_\ // Enable this overload for "in" references.
  227. , |mpl_if|_\<
  228. |boost_is_same|_\<
  229. typename Tag\:\:qualifier
  230. , boost::parameter::forward_reference
  231. >
  232. , |mpl_true|_\ // Enable this overload for "forward" references.
  233. , |mpl_false|_\ // Disable this overload for all other reference categories.
  234. >
  235. >
  236. >::type
  237. , |ArgumentPack|_
  238. >::type
  239. |assignment operator|_\(T const& value) const;
  240. template <typename T>
  241. constexpr typename |boost_enable_if|_\<
  242. typename |mpl_eval_if|_\<
  243. typename |mpl_eval_if|_\<
  244. |boost_is_same|_\<
  245. typename Tag\:\:qualifier
  246. , boost::parameter::out_reference
  247. >
  248. , |mpl_true|_\ // The reference category is "out".
  249. , |mpl_if|_\<
  250. |boost_is_same|_\<
  251. typename Tag\:\:qualifier
  252. , boost::parameter::forward_reference
  253. >
  254. , |mpl_true|_\ // The reference category is "forward".
  255. , |mpl_false|_\ // The reference category is neither "out" nor "forward".
  256. >
  257. >::type
  258. , |mpl_if|_\<
  259. |boost_is_const|_\<T>
  260. , |mpl_false|_\ // Disable this overload for reference-to-const types.
  261. , |mpl_true|_\ // Enable this overload for referece-to-mutable types.
  262. >
  263. , |mpl_false|_\ // Disable this overload for references neither "out" nor "forward".
  264. >::type
  265. , |ArgumentPack|_
  266. >::type
  267. |assignment operator|_\(T& value) const;
  268. template <typename T>
  269. constexpr typename |boost_enable_if|_\<
  270. typename |mpl_eval_if|_\<
  271. |boost_is_scalar|_\<T>
  272. , |mpl_false|_\ // Disable this overload for scalar types.
  273. , |mpl_eval_if|_\<
  274. |boost_is_same|_\<
  275. typename Tag\:\:qualifier
  276. , boost::parameter::in_reference
  277. >
  278. , |mpl_true|_\ // Enable this overload for "in" references.
  279. , |mpl_if|_\<
  280. |boost_is_same|_\<
  281. typename Tag\:\:qualifier
  282. , boost::parameter::forward_reference
  283. >
  284. , |mpl_true|_\ // Enable this overload for "forward" references.
  285. , |mpl_false|_\ // Disable this overload for all other reference categories.
  286. >
  287. >
  288. >::type
  289. , |ArgumentPack|_
  290. >::type
  291. |assignment operator|_\(T const&& value) const;
  292. template <typename T>
  293. constexpr typename |boost_enable_if|_\<
  294. typename |mpl_eval_if|_\<
  295. |boost_is_scalar|_\<T>
  296. , |mpl_false|_\ // Disable this overload for scalar types.
  297. , |mpl_eval_if|_\<
  298. |boost_is_same|_\<
  299. typename Tag\:\:qualifier
  300. , boost::parameter::consume_reference
  301. >
  302. , |mpl_true|_\ // Enable this overload for "consume" references.
  303. , |mpl_if|_\<
  304. |boost_is_same|_\<
  305. typename Tag\:\:qualifier
  306. , boost::parameter::forward_reference
  307. >
  308. , |mpl_true|_\ // Enable this overload for "forward" references.
  309. , |mpl_false|_\ // Disable this overload for all other reference categories.
  310. >
  311. >
  312. >::type
  313. , |ArgumentPack|_
  314. >::type
  315. |assignment operator|_\(T&& value) const;
  316. template <typename T>
  317. constexpr typename |boost_enable_if|_\<
  318. typename |mpl_eval_if|_\<
  319. |boost_is_scalar|_\<T>
  320. , |mpl_true|_\ // Enable this overload for scalar types.
  321. , |mpl_eval_if|_\<
  322. |boost_is_same|_\<
  323. typename Tag\:\:qualifier
  324. , boost::parameter::in_reference
  325. >
  326. , |mpl_true|_\ // Enable this overload for "in" references.
  327. , |mpl_if|_\<
  328. |boost_is_same|_\<
  329. typename Tag\:\:qualifier
  330. , boost::parameter::forward_reference
  331. >
  332. , |mpl_true|_\ // Enable this overload for "forward" references.
  333. , |mpl_false|_\ // Disable this overload for all other reference categories.
  334. >
  335. >
  336. >::type
  337. , *tagged default*
  338. >::type
  339. |bitwise or operator|_\(T const& x) const;
  340. template <typename T>
  341. constexpr typename |boost_enable_if|_\<
  342. typename |mpl_eval_if|_\<
  343. typename |mpl_eval_if|_\<
  344. |boost_is_same|_\<
  345. typename Tag\:\:qualifier
  346. , boost::parameter::out_reference
  347. >
  348. , |mpl_true|_\ // The reference category is "out".
  349. , |mpl_if|_\<
  350. |boost_is_same|_\<
  351. typename Tag\:\:qualifier
  352. , boost::parameter::forward_reference
  353. >
  354. , |mpl_true|_\ // The reference category is "forward".
  355. , |mpl_false|_\ // The reference category is neither "out" nor "forward".
  356. >
  357. >::type
  358. , |mpl_if|_\<
  359. |boost_is_const|_\<T>
  360. , |mpl_false|_\ // Disable this overload for reference-to-const types.
  361. , |mpl_true|_\ // Enable this overload for referece-to-mutable types.
  362. >
  363. , |mpl_false|_\ // Disable this overload for references neither "out" nor "forward".
  364. >::type
  365. , *tagged default*
  366. >::type
  367. |bitwise or operator|_\(T& x) const;
  368. template <typename T>
  369. constexpr typename |boost_enable_if|_\<
  370. typename |mpl_eval_if|_\<
  371. |boost_is_scalar|_\<T>
  372. , |mpl_false|_\ // Disable this overload for scalar types.
  373. , |mpl_eval_if|_\<
  374. |boost_is_same|_\<
  375. typename Tag\:\:qualifier
  376. , boost::parameter::in_reference
  377. >
  378. , |mpl_true|_\ // Enable this overload for "in" references.
  379. , |mpl_if|_\<
  380. |boost_is_same|_\<
  381. typename Tag\:\:qualifier
  382. , boost::parameter::forward_reference
  383. >
  384. , |mpl_true|_\ // Enable this overload for "forward" references.
  385. , |mpl_false|_\ // Disable this overload for all other reference categories.
  386. >
  387. >
  388. >::type
  389. , *tagged default*
  390. >::type
  391. |bitwise or operator|_\(T const&& x) const;
  392. template <typename T>
  393. constexpr typename |boost_enable_if|_\<
  394. typename |mpl_eval_if|_\<
  395. |boost_is_scalar|_\<T>
  396. , |mpl_false|_\ // Disable this overload for scalar types.
  397. , |mpl_eval_if|_\<
  398. |boost_is_same|_\<
  399. typename Tag\:\:qualifier
  400. , boost::parameter::consume_reference
  401. >
  402. , |mpl_true|_\ // Enable this overload for "consume" references.
  403. , |mpl_if|_\<
  404. |boost_is_same|_\<
  405. typename Tag\:\:qualifier
  406. , boost::parameter::forward_reference
  407. >
  408. , |mpl_true|_\ // Enable this overload for "forward" references.
  409. , |mpl_false|_\ // Disable this overload for all other reference categories.
  410. >
  411. >
  412. >::type
  413. , *tagged default*
  414. >::type constexpr
  415. |bitwise or operator|_\(T&& value) const;
  416. template <typename F>
  417. constexpr *tagged lazy default* |logical or operator|_\(F const&) const;
  418. template <typename F>
  419. constexpr *tagged lazy default* |logical or operator|_\(F&) const;
  420. static keyword<Tag> const& instance;
  421. static keyword<Tag>& get_\();
  422. };
  423. .. |assignment operator| replace:: ``operator=``
  424. .. _assignment operator:
  425. ``operator=``
  426. :Synopsis:
  427. .. parsed-literal::
  428. template <typename T>
  429. constexpr |ArgumentPack|_ operator=(T const& value) const;
  430. template <typename T>
  431. constexpr |ArgumentPack|_ operator=(T& value) const;
  432. template <typename T>
  433. constexpr |ArgumentPack|_ operator=(T const&& value) const;
  434. template <typename T>
  435. constexpr |ArgumentPack|_ operator=(T&& value) const;
  436. :Requires: one of the following:
  437. * The nested ``qualifier`` type of ``Tag`` must be ``forward_reference``.
  438. * To use the ``const`` lvalue reference overload, ``T`` must be scalar, or
  439. the nested ``qualifier`` type of ``Tag`` must be ``in_reference``.
  440. * To use the mutable lvalue reference overload, the nested ``qualifier``
  441. type of ``Tag`` must be ``out_reference`` or ``in_out_reference``, and
  442. ``T`` must not be ``const``-qualified.
  443. * To use the ``const`` rvalue reference overload for non-scalar ``T``, the
  444. nested ``qualifier`` type of ``Tag`` must be ``in_reference``.
  445. * To use the mutable rvalue reference overload for non-scalar ``T``, the
  446. nested ``qualifier`` type of ``Tag`` must be ``consume_reference`` or
  447. ``move_from_reference``.
  448. :Returns: an |ArgumentPack|_ containing a single |tagged reference| to
  449. ``value`` with |kw|_ ``Tag``
  450. .. |bitwise or operator| replace:: ``operator|``
  451. .. _bitwise or operator:
  452. ``operator|``
  453. :Synopsis:
  454. .. parsed-literal::
  455. template <typename T>
  456. constexpr *tagged default* operator|(T const& x) const;
  457. template <typename T>
  458. constexpr *tagged default* operator|(T& x) const;
  459. template <typename T>
  460. constexpr *tagged default* operator|(T const&& x) const;
  461. template <typename T>
  462. constexpr *tagged default* operator|(T&& x) const;
  463. :Requires: one of the following:
  464. * The nested ``qualifier`` type of ``Tag`` must be ``forward_reference``.
  465. * To use the ``const`` lvalue reference overload, ``T`` must be scalar, or
  466. the nested ``qualifier`` type of ``Tag`` must be ``in_reference``.
  467. * To use the mutable lvalue reference overload, the nested ``qualifier``
  468. type of ``Tag`` must be ``out_reference`` or ``in_out_reference``, and
  469. ``T`` must not be ``const``-qualified.
  470. * To use the ``const`` rvalue reference overload for non-scalar ``T``, the
  471. nested ``qualifier`` type of ``Tag`` must be ``in_reference``.
  472. * To use the mutable rvalue reference overload for non-scalar ``T``, the
  473. nested ``qualifier`` type of ``Tag`` must be ``consume_reference`` or
  474. ``move_from_reference``.
  475. :Returns: a |tagged default| with *value* ``x`` and |kw|_ ``Tag``.
  476. .. |logical or operator| replace:: ``operator||``
  477. .. _logical or operator:
  478. ``operator||``
  479. :Synopsis:
  480. .. parsed-literal::
  481. template <typename F>
  482. constexpr *tagged lazy default* operator||(F const& g) const;
  483. template <typename F>
  484. constexpr *tagged lazy default* operator||(F& g) const;
  485. :Requires: ``g()`` must be valid, with type
  486. |boost_result_of|_\ ``<F()>::type``. [#no_result_of]_
  487. :Returns: a |tagged lazy default| with *value* ``g`` and |kw|_ ``Tag``.
  488. .. _instance:
  489. ``instance``
  490. :Synopsis:
  491. .. parsed-literal::
  492. static keyword<Tag> const& instance;
  493. :Returns: a “singleton instance”: the same object will be returned on each
  494. invocation of ``instance``.
  495. :Thread Safety:
  496. ``instance`` can be accessed from multiple threads simultaneously.
  497. .. _get:
  498. ``get``
  499. :Synopsis:
  500. .. parsed-literal::
  501. static keyword<Tag>& get\();
  502. .. admonition:: Deprecated
  503. This function has been deprecated in favor of ``instance``.
  504. :Returns: a “singleton instance”: the same object will be returned on each
  505. invocation of ``get()``.
  506. :Thread Safety: ``get()`` can be called from multiple threads simultaneously.
  507. .. |template_keyword| replace:: ``template_keyword``
  508. .. _template_keyword:
  509. ``template_keyword``
  510. --------------------
  511. This class template encapsulates a named template parameter. Every type
  512. generated by the |BOOST_PARAMETER_TEMPLATE_KEYWORD|_ macro is a specialization
  513. of |template_keyword|.
  514. :Defined in: |template_keyword_header|_
  515. .. parsed-literal::
  516. template <typename Tag, typename T>
  517. struct template_keyword
  518. {
  519. typedef Tag key_type;
  520. typedef T value_type;
  521. typedef *implementation defined* reference;
  522. };
  523. The |ntp_cpp|_ test program demonstrates proper usage of this class template.
  524. .. |parameters| replace:: ``parameters``
  525. .. _parameters:
  526. ``parameters``
  527. --------------
  528. Provides an interface for assembling the actual arguments to a `forwarding
  529. function` into an |ArgumentPack|, in which any |positional| arguments will be
  530. tagged according to the corresponding template argument to ``parameters``.
  531. .. _forwarding function: `forwarding functions`_
  532. :Defined in: |parameters_header|_
  533. .. parsed-literal::
  534. template <typename ...PSpec>
  535. struct parameters
  536. {
  537. template <typename ...Args>
  538. struct |match|_
  539. {
  540. typedef … type;
  541. };
  542. template <typename ...Args>
  543. |ArgumentPack|_ |function call operator|_\(Args&&... args) const;
  544. };
  545. :Requires: Each element in the ``PSpec`` parameter pack must be a model of
  546. |ParameterSpec|_.
  547. .. Note::
  548. In this section, ``R`` ## *i* and ``K`` ## *i* are defined as
  549. follows, for any argument type ``A`` ## *i*:
  550. | let ``D0`` the set [d0, …, d ## *j*] of all **deduced**
  551. | *parameter specs* in the ``PSpec`` parameter pack
  552. | ``R`` ## *i* is the |intended argument type| of ``A`` ## *i*
  553. |
  554. | if ``A`` ## *i* is a result type of ``keyword<T>::`` |assignment operator|_
  555. | then
  556. | ``K`` ## *i* is ``T``
  557. | else
  558. | if some ``A`` ## *j* where *j* ≤ *i* is a result type of
  559. | ``keyword<T>::`` |assignment operator|_
  560. | *or* some ``P`` ## *j* in *j* ≤ *i* is **deduced**
  561. | then
  562. | if some *parameter spec* ``d`` ## *j* in ``D`` ## *i*
  563. | matches ``A`` ## *i*
  564. | then
  565. | ``K`` ## *i* is the |keyword tag type| of ``d`` ## *j*.
  566. | ``D``:sub:`i+1` is ``D`` ## *i* - [ ``d`` ## *j*]
  567. | else
  568. | ``K`` ## *i* is the |keyword tag type| of ``P`` ## *i*.
  569. .. |match| replace:: ``match``
  570. .. _match:
  571. ``match``
  572. A `Metafunction`_ used to remove a `forwarding function`_ from overload
  573. resolution.
  574. :Returns: if all elements in ``Params...`` are *satisfied* (see below), then
  575. ``parameters<Params...>``. Otherwise, ``match<Args...>::type`` is not
  576. defined.
  577. Each element ``P`` in ``Params...`` is **satisfied** if either:
  578. * ``P`` is the *unspecified* default
  579. * **or**, ``P`` is a *keyword tag type*
  580. * **or**, ``P`` is |optional|_ ``<X,F>`` and either
  581. - ``X`` is not ``K`` ## *i* for any *i*,
  582. - **or** ``X`` is some ``K`` ## *i* and ``mpl::apply<F,R`` ## *i*\
  583. ``>::type::value`` is ``true``
  584. * **or**, ``P`` is |required|_ ``<X,F>``, and
  585. - ``X`` is some ``K`` ## *i*, **and**
  586. - ``mpl::apply<F,R`` ## *i* ``>::type::value`` is ``true``
  587. .. |function call operator| replace:: ``operator()``
  588. .. _function call operator:
  589. ``operator()``
  590. :Synopsis:
  591. .. parsed-literal::
  592. template <typename ...Args>
  593. |ArgumentPack|_ operator()(Args&&... args) const;
  594. :Returns: An |ArgumentPack|_ containing, for each ``a`` ## *i*,
  595. - if ``a`` ## *i* is a single-element |ArgumentPack|, its element
  596. - Otherwise, a |tagged reference| with |kw|_ ``K`` ## *i* and *value*
  597. ``a`` ## *i*
  598. .. |optional| replace:: ``optional``
  599. .. |required| replace:: ``required``
  600. .. _optional:
  601. .. _required:
  602. ``optional``, ``required``
  603. --------------------------
  604. These templates describe the requirements on a function parameter.
  605. ``optional`` is defined in: |optional_header|_
  606. ``required`` is defined in: |required_header|_
  607. Both headers are included by: |preprocessor_header|_
  608. :Specializations model: |ParameterSpec|_
  609. .. parsed-literal::
  610. template <typename Tag, typename Predicate = *unspecified*>
  611. struct optional;
  612. template <typename Tag, typename Predicate = *unspecified*>
  613. struct required;
  614. The default value of ``Predicate`` is an unspecified `MPL Binary Metafunction
  615. Class`_ that returns ``mpl::true_`` for any argument. If
  616. |BOOST_PARAMETER_CAN_USE_MP11|_ is defined, then the default value of
  617. ``Predicate`` is also a |Boost_MP11|_-style quoted metafunction that returns
  618. ``mp11::mp_true`` for any argument.
  619. .. |deduced| replace:: ``deduced``
  620. .. _deduced:
  621. ``deduced``
  622. -----------
  623. This template is used to wrap the *keyword tag* argument to
  624. ``optional`` or ``required``.
  625. :Defined in: |deduced_header|_
  626. :Included by: |preprocessor_header|_
  627. .. parsed-literal::
  628. template <typename Tag>
  629. struct deduced;
  630. :Requires: nothing
  631. //////////////////////////////////////////////////////////////////////////////
  632. Metafunctions
  633. =============
  634. A `Metafunction`_ is conceptually a function that operates on, and returns,
  635. C++ types.
  636. .. |binding| replace:: ``binding``
  637. .. _binding:
  638. ``binding``
  639. -----------
  640. Returns the result type of indexing an argument pack with a
  641. |keyword tag type| or with a |tagged default|.
  642. :Defined in: |binding_header|_
  643. .. parsed-literal::
  644. template <typename A, typename K, typename D = void\_>
  645. struct binding
  646. {
  647. typedef … type;
  648. };
  649. :Requires: ``A`` must be a model of |ArgumentPack|_.
  650. :Returns: the reference type of the |tagged reference| in ``A`` having
  651. |keyword tag type| ``K``, if any. If no such |tagged reference| exists,
  652. returns ``D``.
  653. .. |lazy_binding| replace:: ``lazy_binding``
  654. .. _lazy_binding:
  655. ``lazy_binding``
  656. ----------------
  657. Returns the result type of indexing an argument pack with a
  658. |tagged lazy default|.
  659. :Defined in: |binding_header|_
  660. .. parsed-literal::
  661. template <typename A, typename K, typename F>
  662. struct lazy_binding
  663. {
  664. typedef … type;
  665. };
  666. :Requires: ``A`` must be a model of |ArgumentPack|_.
  667. :Returns: the reference type of the |tagged reference| in ``A`` having
  668. |keyword tag type| ``K``, if any. If no such |tagged reference| exists,
  669. returns |boost_result_of|_\ ``<F()>::type``. [#no_result_of]_
  670. .. |value_type| replace:: ``value_type``
  671. .. _value_type:
  672. ``value_type``
  673. --------------
  674. Returns the result type of indexing an argument pack with a
  675. |keyword tag type| or with a |tagged default|.
  676. :Defined in: |value_type_header|_
  677. .. parsed-literal::
  678. template <typename A, typename K, typename D = void\_>
  679. struct value_type
  680. {
  681. typedef … type;
  682. };
  683. :Requires: ``A`` must be a model of |ArgumentPack|_.
  684. :Returns: the (possibly const-qualified) type of the |tagged reference| in
  685. ``A`` having |keyword tag type| ``K``, if any. If no such
  686. |tagged reference| exists, returns ``D``. Equivalent to:
  687. .. parsed-literal::
  688. typename |boost_remove_reference|_\<
  689. typename |binding|_\<A, K, D>::type
  690. >::type
  691. … when ``D`` is not a reference type.
  692. .. |lazy_value_type| replace:: ``lazy_value_type``
  693. .. _lazy_value_type:
  694. ``lazy_value_type``
  695. -------------------
  696. Returns the result type of indexing an argument pack with a
  697. |tagged lazy default|.
  698. :Defined in: |value_type_header|_
  699. .. parsed-literal::
  700. template <typename A, typename K, typename F>
  701. struct lazy_value_type
  702. {
  703. typedef … type;
  704. };
  705. :Requires: ``A`` must be a model of |ArgumentPack|_.
  706. :Returns: the (possibly const-qualified) type of the |tagged reference| in
  707. ``A`` having |keyword tag type| ``K``, if any. If no such
  708. |tagged reference| exists, returns
  709. |boost_result_of|_\ ``<F()>::type``. [#no_result_of]_
  710. .. |are_tagged_arguments| replace:: ``are_tagged_arguments``
  711. .. _are_tagged_arguments:
  712. ``are_tagged_arguments``
  713. ------------------------
  714. :Defined in: |are_tagged_arguments_header|_
  715. .. parsed-literal::
  716. template <typename T0, typename ...Pack>
  717. struct are_tagged_arguments
  718. // : |mpl_true|_\ if T0 and all elements in Pack are
  719. // tagged reference types, |mpl_false|_\ otherwise.
  720. {
  721. };
  722. :Returns:
  723. ``mpl::true_`` if ``T0`` and all elements in parameter pack ``Pack`` are
  724. |tagged reference| types, ``mpl::false_`` otherwise.
  725. :Example usage:
  726. When implementing a Boost.Parameter-enabled constructor for a container that
  727. conforms to the C++ standard, one needs to remember that the standard requires
  728. the presence of other constructors that are typically defined as templates,
  729. such as range constructors. To avoid overload ambiguities between the two
  730. constructors, use this metafunction in conjunction with ``disable_if`` to
  731. define the range constructor.
  732. .. parsed-literal::
  733. template <typename B>
  734. class frontend : public B
  735. {
  736. struct _enabler
  737. {
  738. };
  739. public:
  740. |BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR|_\(frontend, (B))
  741. template <typename Iterator>
  742. frontend(
  743. Iterator itr
  744. , Iterator itr_end
  745. , typename |boost_disable_if|_\<
  746. are_tagged_arguments<Iterator>
  747. , _enabler
  748. >::type = _enabler()
  749. ) : B(itr, itr_end)
  750. {
  751. }
  752. };
  753. .. |is_argument_pack| replace:: ``is_argument_pack``
  754. .. _is_argument_pack:
  755. ``is_argument_pack``
  756. --------------------
  757. :Defined in: |is_argument_pack_header|_
  758. .. parsed-literal::
  759. template <typename T>
  760. struct is_argument_pack
  761. // : |mpl_true|_\ if T is a model of |ArgumentPack|_\,
  762. // |mpl_false|_\ otherwise.
  763. {
  764. };
  765. :Returns:
  766. ``mpl::true_`` if ``T`` is a model of |ArgumentPack|_, ``mpl::false_``
  767. otherwise.
  768. :Example usage:
  769. To avoid overload ambiguities between a constructor that takes in an
  770. |ArgumentPack|_ and a templated conversion constructor, use this
  771. metafunction in conjunction with ``enable_if``.
  772. .. parsed-literal::
  773. |BOOST_PARAMETER_NAME|_\(a0)
  774. template <typename T>
  775. class backend0
  776. {
  777. struct _enabler
  778. {
  779. };
  780. T a0;
  781. public:
  782. template <typename ArgPack>
  783. explicit backend0(
  784. ArgPack const& args
  785. , typename |boost_enable_if|_\<
  786. is_argument_pack<ArgPack>
  787. , _enabler
  788. >::type = _enabler()
  789. ) : a0(args[_a0])
  790. {
  791. }
  792. template <typename U>
  793. backend0(
  794. backend0<U> const& copy
  795. , typename |boost_enable_if|_\<
  796. |boost_is_convertible|_\<U,T>
  797. , _enabler
  798. >::type = _enabler()
  799. ) : a0(copy.get_a0())
  800. {
  801. }
  802. T const& get_a0() const
  803. {
  804. return this->a0;
  805. }
  806. };
  807. .. |result_of_compose| replace:: ``result_of::compose``
  808. .. _result_of_compose:
  809. ``result_of::compose``
  810. ----------------------
  811. Returns the result type of the |compose|_ function.
  812. :Defined in: |compose_header|_
  813. .. parsed-literal::
  814. template <typename ...TaggedArgs>
  815. struct compose
  816. : |boost_enable_if|_\<
  817. |are_tagged_arguments|_\<T0,Pack...>
  818. , |ArgumentPack|_
  819. >
  820. {
  821. };
  822. template <>
  823. struct compose<>
  824. {
  825. typedef *empty* |ArgumentPack|_ type;
  826. };
  827. :Requires: All elements in ``TaggedArgs`` must be |tagged reference| types, if
  828. specified.
  829. :Returns: the result type of the |compose|_ function.
  830. //////////////////////////////////////////////////////////////////////////////
  831. Function Templates
  832. ==================
  833. .. |compose| replace:: ``compose``
  834. .. _compose:
  835. ``compose``
  836. -----------
  837. :Defined in: |compose_header|_
  838. .. parsed-literal::
  839. template <typename ...Pack>
  840. constexpr typename |result_of_compose|_\<Pack...>::type
  841. compose(Pack const&... args);
  842. This function facilitates easier variadic argument composition. It is used by
  843. the |BOOST_PARAMETER_NO_SPEC_FUNCTION|_,
  844. |BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION|_,
  845. |BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION|_,
  846. |BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR|_,
  847. |BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR|_,
  848. |BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR|_, and
  849. |BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR|_ code generation macros. You
  850. can use it to write your own code generation macros if the ones provided by
  851. this library do not suffice.
  852. Unlike the |tagged reference| comma operator, the ``compose()`` function is
  853. variadic, as mentioned before. However, the |tagged reference| comma operator
  854. can be invoked indefinitely and therefore does not limit the size of the
  855. resulting |ArgumentPack|, while the ``compose()`` function cannot take in more
  856. than |BOOST_PARAMETER_COMPOSE_MAX_ARITY|_ arguments for compilers that do not
  857. support perfect forwarding.
  858. :Requires: All elements in ``args`` must be |tagged reference| objects, if
  859. specified.
  860. :Returns: an |ArgumentPack|_ containing all elements in ``args``, if
  861. specified; an empty |ArgumentPack|_ otherwise.
  862. :Example usage:
  863. .. parsed-literal::
  864. BOOST_PARAMETER_NAME(index)
  865. BOOST_PARAMETER_NAME(name)
  866. template <typename ArgumentPack>
  867. int print_name_and_index(ArgumentPack const& args)
  868. {
  869. std::cout << "index = " << args[_index];
  870. std::cout << "name = " << args[_name];
  871. std::cout << "; " << std::endl;
  872. return 0;
  873. }
  874. int y = print_name_and_index(compose(_index = 3, _name = "jones"));
  875. The |compose_cpp|_ test program shows more examples using this function.
  876. //////////////////////////////////////////////////////////////////////////////
  877. Code Generation Macros
  878. ======================
  879. Macros in this section can be used to ease the writing of code
  880. using the Parameter library by eliminating repetitive boilerplate.
  881. .. |BOOST_PARAMETER_FUNCTION| replace:: ``BOOST_PARAMETER_FUNCTION``
  882. .. _BOOST_PARAMETER_FUNCTION:
  883. ``BOOST_PARAMETER_FUNCTION(result, name, tag_namespace, arguments)``
  884. --------------------------------------------------------------------
  885. :Defined in: |preprocessor_header|_
  886. Generates a function that can take in positional arguments, composed
  887. arguments, named arguments, and deduced arguments.
  888. :Example usage:
  889. The return type of each of the following function templates falls under a
  890. different value category.
  891. .. parsed-literal::
  892. template <std::size_t N>
  893. |std_bitset|_\<N + 1> rvalue_bitset()
  894. {
  895. return |std_bitset|_\<N + 1>();
  896. }
  897. template <std::size_t N>
  898. |std_bitset|_\<N + 1> const rvalue_const_bitset()
  899. {
  900. return |std_bitset|_\<N + 1>();
  901. }
  902. template <std::size_t N>
  903. |std_bitset|_\<N + 1>& lvalue_bitset()
  904. {
  905. static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
  906. return lset;
  907. }
  908. template <std::size_t N>
  909. |std_bitset|_\<N + 1> const& lvalue_const_bitset()
  910. {
  911. static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
  912. return clset;
  913. }
  914. The ``U::evaluate_category`` static member function template has a simple job:
  915. to return the correct value category when passed in an object returned by one
  916. of the functions defined above. Assume that
  917. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
  918. .. parsed-literal::
  919. enum invoked
  920. {
  921. passed_by_lvalue_reference_to_const
  922. , passed_by_lvalue_reference
  923. , passed_by_rvalue_reference_to_const
  924. , passed_by_rvalue_reference
  925. };
  926. struct U
  927. {
  928. template <std::size_t N>
  929. static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
  930. {
  931. return passed_by_lvalue_reference_to_const;
  932. }
  933. template <std::size_t N>
  934. static invoked evaluate_category(|std_bitset|_\<N + 1>&)
  935. {
  936. return passed_by_lvalue_reference;
  937. }
  938. template <std::size_t N>
  939. static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
  940. {
  941. return passed_by_rvalue_reference_to_const;
  942. }
  943. template <std::size_t N>
  944. static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
  945. {
  946. return passed_by_rvalue_reference;
  947. }
  948. };
  949. Define the named parameters that will comprise the argument specification that
  950. this macro will use. Ensure that all their tag types are in the same
  951. namespace, which is ``kw`` in this case. The identifiers with leading
  952. underscores can be passed to the bracket operator of ``args`` to extract the
  953. same argument to which the corresponding named parameter (without underscores)
  954. is bound, as will be shown later.
  955. .. parsed-literal::
  956. |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
  957. |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
  958. |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
  959. |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
  960. Use the macro as a substitute for a normal function header. Enclose the
  961. return type ``bool`` in parentheses. For each parameter, also enclose the
  962. expected value type in parentheses. Since the value types are mutually
  963. exclusive, you can wrap the parameters in a ``(deduced …)``
  964. clause. Otherwise, just as with a normal function, the order in which you
  965. specify the parameters determines their position. Also, just as with a normal
  966. function, optional parameters have default values, whereas required parameters
  967. do not. Within the function body, either simply use the parameter name or
  968. pass the matching identifier with the leading underscore to the bracket
  969. operator of ``args`` to extract the corresponding argument. Note that the
  970. second method doesn't require ``std::forward`` to preserve value categories.
  971. .. parsed-literal::
  972. BOOST_PARAMETER_FUNCTION((bool), evaluate, kw,
  973. (deduced
  974. (required
  975. (lrc, (|std_bitset|_\<1>))
  976. (lr, (|std_bitset|_\<2>))
  977. )
  978. (optional
  979. (rrc, (|std_bitset|_\<3>), rvalue_const_bitset<2>())
  980. (rr, (|std_bitset|_\<4>), rvalue_bitset<3>())
  981. )
  982. )
  983. )
  984. {
  985. BOOST_TEST_EQ(
  986. passed_by_lvalue_reference_to_const
  987. , U::evaluate_category<0>(lrc)
  988. );
  989. BOOST_TEST_EQ(
  990. passed_by_lvalue_reference
  991. , U::evaluate_category<1>(lr)
  992. );
  993. BOOST_TEST_EQ(
  994. passed_by_rvalue_reference_to_const
  995. , U::evaluate_category<2>(|std_forward|_\<rrc0_type>(rrc0))
  996. );
  997. BOOST_TEST_EQ(
  998. passed_by_rvalue_reference
  999. , U::evaluate_category<3>(args[_rr0])
  1000. );
  1001. return true;
  1002. }
  1003. The following function calls are legal.
  1004. .. parsed-literal::
  1005. evaluate( // positional arguments
  1006. lvalue_const_bitset<0>()
  1007. , lvalue_bitset<1>()
  1008. , rvalue_const_bitset<2>()
  1009. , rvalue_bitset<3>()
  1010. );
  1011. evaluate( // positional arguments
  1012. lvalue_const_bitset<0>()
  1013. , lvalue_bitset<1>()
  1014. );
  1015. evaluate(( // composed arguments
  1016. _rr0 = rvalue_bitset<3>()
  1017. , _lrc0 = lvalue_const_bitset<0>()
  1018. , _lr0 = lvalue_bitset<1>()
  1019. , _rrc0 = rvalue_const_bitset<2>()
  1020. ));
  1021. evaluate( // named arguments
  1022. _rr0 = rvalue_bitset<3>()
  1023. , _lrc0 = lvalue_const_bitset<0>()
  1024. , _lr0 = lvalue_bitset<1>()
  1025. , _rrc0 = rvalue_const_bitset<2>()
  1026. );
  1027. evaluate( // named arguments
  1028. _lr0 = lvalue_bitset<1>()
  1029. , _lrc0 = lvalue_const_bitset<0>()
  1030. );
  1031. Because the parameters were wrapped in a ``(deduced …)`` clause, the following
  1032. function calls are also legal.
  1033. .. parsed-literal::
  1034. evaluate( // deduced arguments
  1035. rvalue_bitset<3>()
  1036. , lvalue_const_bitset<0>()
  1037. , lvalue_bitset<1>()
  1038. , rvalue_const_bitset<2>()
  1039. );
  1040. evaluate( // deduced arguments
  1041. lvalue_bitset<1>()
  1042. , lvalue_const_bitset<0>()
  1043. );
  1044. The |preprocessor_cpp|_, |preprocessor_deduced_cpp|_, and
  1045. |preprocessor_eval_cat_cpp|_ test programs demonstrate proper usage of this
  1046. macro.
  1047. **Macro parameters:**
  1048. * ``result`` is the parenthesized return type of the function.
  1049. * ``name`` is the base name of the function; it determines the name of the
  1050. generated forwarding functions.
  1051. * ``tag_namespace`` is the namespace in which the keywords used by the
  1052. function resides.
  1053. * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
  1054. *argument-specifiers*, as defined below.
  1055. **Argument specifiers syntax:**
  1056. .. parsed-literal::
  1057. argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
  1058. specifier-group0 ::= *specifier-group1* |
  1059. (
  1060. '**(**' '**deduced**'
  1061. *specifier-group1* {*specifier-group1*\ }
  1062. '**)**'
  1063. )
  1064. specifier-group1 ::=
  1065. (
  1066. '**(**' '**optional**'
  1067. *optional-specifier* {*optional-specifier*\ }
  1068. '**)**'
  1069. ) | (
  1070. '**(**' '**required**'
  1071. *required-specifier* {*required-specifier*\ }
  1072. '**)**'
  1073. )
  1074. optional-specifier ::=
  1075. '**(**'
  1076. *argument-name* '**,**' *restriction* '**,**' *default-value*
  1077. ')'
  1078. required-specifier ::=
  1079. '**(**' *argument-name* '**,**' *restriction* ')'
  1080. restriction ::=
  1081. ( '**\***' '**(**' *mfc* '**)**' ) |
  1082. ( '**(**' *type-name* '**)**' ) |
  1083. '**\***'
  1084. * ``argument-name`` is any valid C++ identifier.
  1085. * ``default-value`` is any valid C++ expression; if necessary, user code can
  1086. compute it in terms of ``previous-name ## _type``, where ``previous-name``
  1087. is the ``argument-name`` in a previous ``specifier-group0`` or
  1088. ``specifier-group1``. *This expression will be invoked exactly once.*
  1089. * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
  1090. be the type of the corresponding ``argument-name``, whose second argument
  1091. will be the entire |ArgumentPack|_, and whose return type is a `Boolean
  1092. Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
  1093. of ``previous-name ## _type``.
  1094. * ``type-name`` is either the name of a **target type** or an `MPL Binary
  1095. Metafunction Class`_ whose first argument will be the type of the
  1096. corresponding ``argument-name``, whose second argument will be the entire
  1097. |ArgumentPack|_, and whose return type is the **target type**. If
  1098. ``restriction`` uses this form, then the type of the generated name
  1099. ``argument-name ## _type`` will be computed in terms of the **target
  1100. type**, and the generated reference ``argument-name`` (but not its
  1101. corresponding entry in ``args``) will be cast to that type.
  1102. **Approximate expansion:**
  1103. Where:
  1104. * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
  1105. * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
  1106. .. parsed-literal::
  1107. // If **result** is a template instantiation of |boost_enable_if|_\,
  1108. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  1109. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  1110. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  1111. // |std_enable_if|_\:
  1112. template <typename Args>
  1113. using boost_param_result\_ ## __LINE__ ## **name** = **result**;
  1114. // If **result** is a simple return type:
  1115. template <typename Args>
  1116. struct boost_param_result\_ ## __LINE__ ## **name**
  1117. {
  1118. typedef **result** type;
  1119. };
  1120. struct boost_param_params\_ ## __LINE__ ## **name**
  1121. : |parameters|_\<
  1122. *list of parameter specifications, based on arguments*
  1123. >
  1124. {
  1125. };
  1126. typedef boost_param_params\_ ## __LINE__ ## **name**
  1127. boost_param_parameters\_ ## __LINE__ ## **name**;
  1128. template <typename Args>
  1129. typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type
  1130. boost_param_impl ## __LINE__ ## **name**\ (Args const&);
  1131. template <typename A0, …, typename A ## **n**>
  1132. **result** **name**\ (
  1133. A0&& a0, …, A ## **n**\ && a ## **n**
  1134. , typename boost_param_parameters\_ ## __LINE__ ## **name**
  1135. ::match<A0, …, A ## **n**>::type
  1136. = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
  1137. )
  1138. {
  1139. return boost_param_impl ## __LINE__ ## **name**\ (
  1140. boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
  1141. |std_forward|_\<A0>(a0)
  1142. , …
  1143. , |std_forward|_\<A ## **n**>(a ## **n**)
  1144. )
  1145. );
  1146. }
  1147. :vellipsis:`⋮`
  1148. template <typename A0, …, typename A ## **m**>
  1149. **result** **name**\ (
  1150. A0&& a0, …, A ## **m**\ && a ## **m**
  1151. , typename boost_param_parameters\_ ## __LINE__ ## **name**
  1152. ::match<A0, …, A ## **m**>::type
  1153. = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
  1154. )
  1155. {
  1156. return boost_param_impl ## __LINE__ ## **name**\ (
  1157. boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
  1158. |std_forward|_\<A0>(a0)
  1159. , …
  1160. , |std_forward|_\<A ## **m**>(a ## **m**)
  1161. )
  1162. );
  1163. }
  1164. template <
  1165. typename ResultType
  1166. , typename Args
  1167. , typename *argument name* ## **0** ## _type
  1168. , …
  1169. , typename *argument name* ## **n** ## _type
  1170. >
  1171. ResultType
  1172. boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
  1173. (ResultType(*)())
  1174. , Args const& args
  1175. , *argument name* ## **0** ## _type&& *argument name* ## **0**
  1176. , …
  1177. , *argument name* ## **n** ## _type&& *argument name* ## **m**
  1178. );
  1179. :vellipsis:`⋮`
  1180. template <
  1181. typename ResultType
  1182. , typename Args
  1183. , typename *argument name* ## **0** ## _type
  1184. , …
  1185. , typename *argument name* ## **m** ## _type
  1186. >
  1187. ResultType
  1188. boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
  1189. (ResultType(*)())
  1190. , Args const& args
  1191. , *argument name* ## **0** ## _type&& *argument name* ## **0**
  1192. , …
  1193. , *argument name* ## **m** ## _type&& *argument name* ## **m**
  1194. );
  1195. template <typename Args>
  1196. typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type
  1197. boost_param_impl ## __LINE__ ## **name**\ (Args const& args)
  1198. {
  1199. return boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
  1200. static_cast<
  1201. typename boost_param_result\_ ## __LINE__ ## **name**\ <
  1202. Args
  1203. >::type(*)()
  1204. >(|std_nullptr|_\)
  1205. , args
  1206. , |std_forward|_\<
  1207. typename |value_type|_\<
  1208. Args
  1209. , *keyword tag type of required parameter* ## **0**
  1210. >::type
  1211. >(args[ *keyword object of required parameter* ## **0**])
  1212. , …
  1213. , |std_forward|_\<
  1214. typename |value_type|_\<
  1215. Args
  1216. , *keyword tag type of required parameter* ## **n**
  1217. >::type
  1218. >(args[ *keyword object of required parameter* ## **n**])
  1219. );
  1220. }
  1221. template <
  1222. typename ResultType
  1223. , typename Args
  1224. , typename *argument name* ## **0** ## _type
  1225. , …
  1226. , typename *argument name* ## **n** ## _type
  1227. >
  1228. ResultType
  1229. boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
  1230. (ResultType(*)())
  1231. , Args const& args
  1232. , *argument name* ## **0** ## _type&& *argument name* ## **0**
  1233. , …
  1234. , *argument name* ## **n** ## _type&& *argument name* ## **n**
  1235. )
  1236. {
  1237. return boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
  1238. static_cast<ResultType(*)()>(|std_nullptr|_\)
  1239. , (args, *keyword object of optional parameter* ## **n + 1** =
  1240. *default value of optional parameter* ## **n + 1**
  1241. )
  1242. , |std_forward|_\<*argument name* ## **0** ## _type>(
  1243. *argument name* ## **0**
  1244. )
  1245. , …
  1246. , |std_forward|_\<*argument name* ## **n** ## _type>(
  1247. *argument name* ## **n**
  1248. )
  1249. , |std_forward|_\<
  1250. typename |value_type|_\<
  1251. Args
  1252. , *keyword tag type of optional parameter* ## **n + 1**
  1253. >::type
  1254. >(*default value of optional parameter* ## **n + 1**)
  1255. );
  1256. }
  1257. :vellipsis:`⋮`
  1258. template <
  1259. typename ResultType
  1260. , typename Args
  1261. , typename *argument name* ## **0** ## _type
  1262. , …
  1263. , typename *argument name* ## **m** ## _type
  1264. >
  1265. ResultType
  1266. boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
  1267. (ResultType(*)())
  1268. , Args const& args
  1269. , *argument name* ## **0** ## _type&& *argument name* ## **0**
  1270. , …
  1271. , *argument name* ## **m** ## _type&& *argument name* ## **m**
  1272. )
  1273. .. |BOOST_PARAMETER_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_MEMBER_FUNCTION``
  1274. .. _BOOST_PARAMETER_MEMBER_FUNCTION:
  1275. ``BOOST_PARAMETER_MEMBER_FUNCTION(result, name, tag_namespace, arguments)``
  1276. ---------------------------------------------------------------------------
  1277. :Defined in: |preprocessor_header|_
  1278. Generates a member function that can take in positional arguments, composed
  1279. arguments, named arguments, and deduced arguments.
  1280. :Example usage:
  1281. The return type of each of the following function templates falls under a
  1282. different value category.
  1283. .. parsed-literal::
  1284. template <std::size_t N>
  1285. |std_bitset|_\<N + 1> rvalue_bitset()
  1286. {
  1287. return |std_bitset|_\<N + 1>();
  1288. }
  1289. template <std::size_t N>
  1290. |std_bitset|_\<N + 1> const rvalue_const_bitset()
  1291. {
  1292. return |std_bitset|_\<N + 1>();
  1293. }
  1294. template <std::size_t N>
  1295. |std_bitset|_\<N + 1>& lvalue_bitset()
  1296. {
  1297. static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
  1298. return lset;
  1299. }
  1300. template <std::size_t N>
  1301. |std_bitset|_\<N + 1> const& lvalue_const_bitset()
  1302. {
  1303. static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
  1304. return clset;
  1305. }
  1306. The ``U::evaluate_category`` static member function template has a simple job:
  1307. to return the correct value category when passed in an object returned by one
  1308. of the functions defined above. Assume that
  1309. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
  1310. .. parsed-literal::
  1311. enum invoked
  1312. {
  1313. passed_by_lvalue_reference_to_const
  1314. , passed_by_lvalue_reference
  1315. , passed_by_rvalue_reference_to_const
  1316. , passed_by_rvalue_reference
  1317. };
  1318. struct U
  1319. {
  1320. template <std::size_t N>
  1321. static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
  1322. {
  1323. return passed_by_lvalue_reference_to_const;
  1324. }
  1325. template <std::size_t N>
  1326. static invoked evaluate_category(|std_bitset|_\<N + 1>&)
  1327. {
  1328. return passed_by_lvalue_reference;
  1329. }
  1330. template <std::size_t N>
  1331. static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
  1332. {
  1333. return passed_by_rvalue_reference_to_const;
  1334. }
  1335. template <std::size_t N>
  1336. static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
  1337. {
  1338. return passed_by_rvalue_reference;
  1339. }
  1340. };
  1341. Define the named parameters that will comprise the argument specification that
  1342. this macro will use. Ensure that all their tag types are in the same
  1343. namespace, which is ``kw`` in this case. The identifiers with leading
  1344. underscores can be passed to the bracket operator of ``args`` to extract the
  1345. same argument to which the corresponding named parameter (without underscores)
  1346. is bound, as will be shown later.
  1347. .. parsed-literal::
  1348. |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
  1349. |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
  1350. |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
  1351. |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
  1352. Use the macro as a substitute for a normal ``static`` member function
  1353. header. Enclose the return type ``bool`` in parentheses. For each parameter,
  1354. also enclose the expected value type in parentheses. Since the value types
  1355. are mutually exclusive, you can wrap the parameters in a ``(deduced …)``
  1356. clause. Otherwise, just as with a normal function, the order in which you
  1357. specify the parameters determines their position. Also, just as with a normal
  1358. function, optional parameters have default values, whereas required parameters
  1359. do not. Within the function body, either simply use the parameter name or
  1360. pass the matching identifier with the leading underscore to the bracket
  1361. operator of ``args`` to extract the corresponding argument. Note that the
  1362. second method doesn't require ``std::forward`` to preserve value categories.
  1363. .. parsed-literal::
  1364. struct B
  1365. {
  1366. BOOST_PARAMETER_MEMBER_FUNCTION((bool), static evaluate, kw,
  1367. (deduced
  1368. (required
  1369. (lrc, (|std_bitset|_\<1>))
  1370. (lr, (|std_bitset|_\<2>))
  1371. )
  1372. (optional
  1373. (rrc, (|std_bitset|_\<3>), rvalue_const_bitset<2>())
  1374. (rr, (|std_bitset|_\<4>), rvalue_bitset<3>())
  1375. )
  1376. )
  1377. )
  1378. {
  1379. BOOST_TEST_EQ(
  1380. passed_by_lvalue_reference_to_const
  1381. , U::evaluate_category<0>(lrc)
  1382. );
  1383. BOOST_TEST_EQ(
  1384. passed_by_lvalue_reference
  1385. , U::evaluate_category<1>(lr)
  1386. );
  1387. BOOST_TEST_EQ(
  1388. passed_by_rvalue_reference_to_const
  1389. , U::evaluate_category<2>(|std_forward|_\<rrc0_type>(rrc0))
  1390. );
  1391. BOOST_TEST_EQ(
  1392. passed_by_rvalue_reference
  1393. , U::evaluate_category<3>(args[_rr0])
  1394. );
  1395. return true;
  1396. }
  1397. };
  1398. The following function calls are legal.
  1399. .. parsed-literal::
  1400. B::evaluate( // positional arguments
  1401. lvalue_const_bitset<0>()
  1402. , lvalue_bitset<1>()
  1403. , rvalue_const_bitset<2>()
  1404. , rvalue_bitset<3>()
  1405. );
  1406. B::evaluate( // positional arguments
  1407. lvalue_const_bitset<0>()
  1408. , lvalue_bitset<1>()
  1409. );
  1410. B::evaluate(( // composed arguments
  1411. _rr0 = rvalue_bitset<3>()
  1412. , _lrc0 = lvalue_const_bitset<0>()
  1413. , _lr0 = lvalue_bitset<1>()
  1414. , _rrc0 = rvalue_const_bitset<2>()
  1415. ));
  1416. B::evaluate( // named arguments
  1417. _rr0 = rvalue_bitset<3>()
  1418. , _lrc0 = lvalue_const_bitset<0>()
  1419. , _lr0 = lvalue_bitset<1>()
  1420. , _rrc0 = rvalue_const_bitset<2>()
  1421. );
  1422. B::evaluate( // named arguments
  1423. _lr0 = lvalue_bitset<1>()
  1424. , _lrc0 = lvalue_const_bitset<0>()
  1425. );
  1426. Because the parameters were wrapped in a ``(deduced …)`` clause, the following
  1427. function calls are also legal.
  1428. .. parsed-literal::
  1429. B::evaluate( // deduced arguments
  1430. rvalue_bitset<3>()
  1431. , lvalue_const_bitset<0>()
  1432. , lvalue_bitset<1>()
  1433. , rvalue_const_bitset<2>()
  1434. );
  1435. B::evaluate( // deduced arguments
  1436. lvalue_bitset<1>()
  1437. , lvalue_const_bitset<0>()
  1438. );
  1439. The |preprocessor_cpp|_ and |preprocessor_eval_cat_cpp|_ test programs
  1440. demonstrate proper usage of this macro.
  1441. **Macro parameters:**
  1442. * ``result`` is the parenthesized return type of the function.
  1443. * ``name`` is the base name of the function; it determines the name of the
  1444. generated forwarding functions. ``name`` may be qualified by the
  1445. ``static`` keyword to declare the member function and its helpers as not
  1446. associated with any object of the enclosing type.
  1447. * ``tag_namespace`` is the namespace in which the keywords used by the
  1448. function resides.
  1449. * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
  1450. *argument-specifiers*, as defined below.
  1451. **Argument specifiers syntax:**
  1452. .. parsed-literal::
  1453. argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
  1454. specifier-group0 ::= *specifier-group1* |
  1455. (
  1456. '**(**' '**deduced**'
  1457. *specifier-group1* {*specifier-group1*\ }
  1458. '**)**'
  1459. )
  1460. specifier-group1 ::=
  1461. (
  1462. '**(**' '**optional**'
  1463. *optional-specifier* {*optional-specifier*\ }
  1464. '**)**'
  1465. ) | (
  1466. '**(**' '**required**'
  1467. *required-specifier* {*required-specifier*\ }
  1468. '**)**'
  1469. )
  1470. optional-specifier ::=
  1471. '**(**'
  1472. *argument-name* '**,**' *restriction* '**,**' *default-value*
  1473. ')'
  1474. required-specifier ::=
  1475. '**(**' *argument-name* '**,**' *restriction* ')'
  1476. restriction ::=
  1477. ( '**\***' '**(**' *mfc* '**)**' ) |
  1478. ( '**(**' *type-name* '**)**' ) |
  1479. '**\***'
  1480. * ``argument-name`` is any valid C++ identifier.
  1481. * ``default-value`` is any valid C++ expression; if necessary, user code can
  1482. compute it in terms of ``previous-name ## _type``, where ``previous-name``
  1483. is the ``argument-name`` in a previous ``specifier-group0`` or
  1484. ``specifier-group1``. *This expression will be invoked exactly once.*
  1485. * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
  1486. be the type of the corresponding ``argument-name``, whose second argument
  1487. will be the entire |ArgumentPack|_, and whose return type is a `Boolean
  1488. Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
  1489. of ``previous-name ## _type``.
  1490. * ``type-name`` is either the name of a **target type** or an `MPL Binary
  1491. Metafunction Class`_ whose first argument will be the type of the
  1492. corresponding ``argument-name``, whose second argument will be the entire
  1493. |ArgumentPack|_, and whose return type is the **target type**. If
  1494. ``restriction`` uses this form, then the type of the generated name
  1495. ``argument-name ## _type`` will be computed in terms of the **target
  1496. type**, and the generated reference ``argument-name`` (but not its
  1497. corresponding entry in ``args``) will be cast to that type.
  1498. **Approximate expansion:**
  1499. Where:
  1500. * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
  1501. * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
  1502. .. parsed-literal::
  1503. // If **result** is a template instantiation of |boost_enable_if|_\,
  1504. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  1505. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  1506. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  1507. // |std_enable_if|_\:
  1508. template <typename Args>
  1509. using boost_param_result\_ ## __LINE__ ## **name** = **result**;
  1510. // If **result** is a simple return type:
  1511. template <typename Args>
  1512. struct boost_param_result\_ ## __LINE__ ## **name**
  1513. {
  1514. typedef **result** type;
  1515. };
  1516. struct boost_param_params\_ ## __LINE__ ## **name**
  1517. : |parameters|_\<
  1518. *list of parameter specifications, based on arguments*
  1519. >
  1520. {
  1521. };
  1522. typedef boost_param_params\_ ## __LINE__ ## **name**
  1523. boost_param_parameters\_ ## __LINE__ ## **name**;
  1524. template <typename A0, …, typename A ## **n**>
  1525. **result** **name**\ (
  1526. A0&& a0, …, A ## **n**\ && a ## **n**
  1527. , typename boost_param_parameters\_ ## __LINE__ ## **name**
  1528. ::match<A0, …, A ## **n**>::type
  1529. = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
  1530. )
  1531. {
  1532. return this->boost_param_impl ## __LINE__ ## **name**\ (
  1533. boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
  1534. |std_forward|_\<A0>(a0)
  1535. , …
  1536. , |std_forward|_\<A ## **n**>(a ## **n**)
  1537. )
  1538. );
  1539. }
  1540. :vellipsis:`⋮`
  1541. template <typename A0, …, typename A ## **m**>
  1542. **result** **name**\ (
  1543. A0&& a0, …, A ## **m**\ && a ## **m**
  1544. , typename boost_param_parameters\_ ## __LINE__ ## **name**
  1545. ::match<A0, …, A ## **m**>::type
  1546. = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
  1547. )
  1548. {
  1549. return this->boost_param_impl ## __LINE__ ## **name**\ (
  1550. boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
  1551. |std_forward|_\<A0>(a0)
  1552. , …
  1553. , |std_forward|_\<A ## **m**>(a ## **m**)
  1554. )
  1555. );
  1556. }
  1557. template <typename Args>
  1558. typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type
  1559. boost_param_impl ## __LINE__ ## **name**\ (Args const& args)
  1560. {
  1561. return this->boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
  1562. static_cast<
  1563. typename boost_param_result\_ ## __LINE__ ## **name**\ <
  1564. Args
  1565. >::type(*)()
  1566. >(|std_nullptr|_\)
  1567. , args
  1568. , |std_forward|_\<
  1569. typename |value_type|_\<
  1570. Args
  1571. , *keyword tag type of required parameter* ## **0**
  1572. >::type
  1573. >(args[ *keyword object of required parameter* ## **0**])
  1574. , …
  1575. , |std_forward|_\<
  1576. typename |value_type|_\<
  1577. Args
  1578. , *keyword tag type of required parameter* ## **n**
  1579. >::type
  1580. >(args[ *keyword object of required parameter* ## **n**])
  1581. );
  1582. }
  1583. template <
  1584. typename ResultType
  1585. , typename Args
  1586. , typename *argument name* ## **0** ## _type
  1587. , …
  1588. , typename *argument name* ## **n** ## _type
  1589. >
  1590. ResultType
  1591. boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
  1592. (ResultType(*)())
  1593. , Args const& args
  1594. , *argument name* ## **0** ## _type&& *argument name* ## **0**
  1595. , …
  1596. , *argument name* ## **n** ## _type&& *argument name* ## **n**
  1597. )
  1598. {
  1599. return this->boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
  1600. static_cast<ResultType(*)()>(|std_nullptr|_\)
  1601. , (args, *keyword object of optional parameter* ## **n + 1** =
  1602. *default value of optional parameter* ## **n + 1**
  1603. )
  1604. , |std_forward|_\<*argument name* ## **0** ## _type>(
  1605. *argument name* ## **0**
  1606. )
  1607. , …
  1608. , |std_forward|_\<*argument name* ## **n** ## _type>(
  1609. *argument name* ## **n**
  1610. )
  1611. , |std_forward|_\<
  1612. typename |value_type|_\<
  1613. Args
  1614. , *keyword tag type of optional parameter* ## **n + 1**
  1615. >::type
  1616. >(*default value of optional parameter* ## **n + 1**)
  1617. );
  1618. }
  1619. :vellipsis:`⋮`
  1620. template <
  1621. typename ResultType
  1622. , typename Args
  1623. , typename *argument name* ## **0** ## _type
  1624. , …
  1625. , typename *argument name* ## **m** ## _type
  1626. >
  1627. ResultType
  1628. boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ (
  1629. (ResultType(*)())
  1630. , Args const& args
  1631. , *argument name* ## **0** ## _type&& *argument name* ## **0**
  1632. , …
  1633. , *argument name* ## **m** ## _type&& *argument name* ## **m**
  1634. )
  1635. .. |BOOST_PARAMETER_CONST_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_CONST_MEMBER_FUNCTION``
  1636. .. _BOOST_PARAMETER_CONST_MEMBER_FUNCTION:
  1637. ``BOOST_PARAMETER_CONST_MEMBER_FUNCTION(result, name, tag_ns, arguments)``
  1638. --------------------------------------------------------------------------
  1639. :Defined in: |preprocessor_header|_
  1640. Generates a member function that can take in positional arguments, composed
  1641. arguments, named arguments, and deduced arguments.
  1642. :Example usage:
  1643. The return type of each of the following function templates falls under a
  1644. different value category.
  1645. .. parsed-literal::
  1646. template <std::size_t N>
  1647. |std_bitset|_\<N + 1> rvalue_bitset()
  1648. {
  1649. return |std_bitset|_\<N + 1>();
  1650. }
  1651. template <std::size_t N>
  1652. |std_bitset|_\<N + 1> const rvalue_const_bitset()
  1653. {
  1654. return |std_bitset|_\<N + 1>();
  1655. }
  1656. template <std::size_t N>
  1657. |std_bitset|_\<N + 1>& lvalue_bitset()
  1658. {
  1659. static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
  1660. return lset;
  1661. }
  1662. template <std::size_t N>
  1663. |std_bitset|_\<N + 1> const& lvalue_const_bitset()
  1664. {
  1665. static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
  1666. return clset;
  1667. }
  1668. The ``U::evaluate_category`` static member function template has a simple job:
  1669. to return the correct value category when passed in an object returned by one
  1670. of the functions defined above. Assume that
  1671. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
  1672. .. parsed-literal::
  1673. enum invoked
  1674. {
  1675. passed_by_lvalue_reference_to_const
  1676. , passed_by_lvalue_reference
  1677. , passed_by_rvalue_reference_to_const
  1678. , passed_by_rvalue_reference
  1679. };
  1680. struct U
  1681. {
  1682. template <std::size_t N>
  1683. static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
  1684. {
  1685. return passed_by_lvalue_reference_to_const;
  1686. }
  1687. template <std::size_t N>
  1688. static invoked evaluate_category(|std_bitset|_\<N + 1>&)
  1689. {
  1690. return passed_by_lvalue_reference;
  1691. }
  1692. template <std::size_t N>
  1693. static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
  1694. {
  1695. return passed_by_rvalue_reference_to_const;
  1696. }
  1697. template <std::size_t N>
  1698. static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
  1699. {
  1700. return passed_by_rvalue_reference;
  1701. }
  1702. };
  1703. Define the named parameters that will comprise the argument specification that
  1704. this macro will use. Ensure that all their tag types are in the same
  1705. namespace, which is ``kw`` in this case. The identifiers with leading
  1706. underscores can be passed to the bracket operator of ``args`` to extract the
  1707. same argument to which the corresponding named parameter (without underscores)
  1708. is bound, as will be shown later.
  1709. .. parsed-literal::
  1710. |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
  1711. |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
  1712. |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
  1713. |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
  1714. Use the macro as a substitute for a normal ``const`` member function
  1715. header. Enclose the return type ``bool`` in parentheses. For each parameter,
  1716. also enclose the expected value type in parentheses. Since the value types
  1717. are mutually exclusive, you can wrap the parameters in a ``(deduced …)``
  1718. clause. Otherwise, just as with a normal function, the order in which you
  1719. specify the parameters determines their position. Also, just as with a normal
  1720. function, optional parameters have default values, whereas required parameters
  1721. do not. Within the function body, either simply use the parameter name or
  1722. pass the matching identifier with the leading underscore to the bracket
  1723. operator of ``args`` to extract the corresponding argument. Note that the
  1724. second method doesn't require ``std::forward`` to preserve value categories.
  1725. .. parsed-literal::
  1726. struct B
  1727. {
  1728. B()
  1729. {
  1730. }
  1731. BOOST_PARAMETER_CONST_MEMBER_FUNCTION((bool), evaluate, kw,
  1732. (deduced
  1733. (required
  1734. (lrc, (|std_bitset|_\<1>))
  1735. (lr, (|std_bitset|_\<2>))
  1736. )
  1737. (optional
  1738. (rrc, (|std_bitset|_\<3>), rvalue_const_bitset<2>())
  1739. (rr, (|std_bitset|_\<4>), rvalue_bitset<3>())
  1740. )
  1741. )
  1742. )
  1743. {
  1744. BOOST_TEST_EQ(
  1745. passed_by_lvalue_reference_to_const
  1746. , U::evaluate_category<0>(lrc)
  1747. );
  1748. BOOST_TEST_EQ(
  1749. passed_by_lvalue_reference
  1750. , U::evaluate_category<1>(lr)
  1751. );
  1752. BOOST_TEST_EQ(
  1753. passed_by_rvalue_reference_to_const
  1754. , U::evaluate_category<2>(|std_forward|_\<rrc0_type>(rrc0))
  1755. );
  1756. BOOST_TEST_EQ(
  1757. passed_by_rvalue_reference
  1758. , U::evaluate_category<3>(args[_rr0])
  1759. );
  1760. return true;
  1761. }
  1762. };
  1763. The following function calls are legal.
  1764. .. parsed-literal::
  1765. B const b = B();
  1766. b.evaluate( // positional arguments
  1767. lvalue_const_bitset<0>()
  1768. , lvalue_bitset<1>()
  1769. , rvalue_const_bitset<2>()
  1770. , rvalue_bitset<3>()
  1771. );
  1772. b.evaluate( // positional arguments
  1773. lvalue_const_bitset<0>()
  1774. , lvalue_bitset<1>()
  1775. );
  1776. b.evaluate(( // composed arguments
  1777. _rr0 = rvalue_bitset<3>()
  1778. , _lrc0 = lvalue_const_bitset<0>()
  1779. , _lr0 = lvalue_bitset<1>()
  1780. , _rrc0 = rvalue_const_bitset<2>()
  1781. ));
  1782. b.evaluate( // named arguments
  1783. _rr0 = rvalue_bitset<3>()
  1784. , _lrc0 = lvalue_const_bitset<0>()
  1785. , _lr0 = lvalue_bitset<1>()
  1786. , _rrc0 = rvalue_const_bitset<2>()
  1787. );
  1788. b.evaluate( // named arguments
  1789. _lr0 = lvalue_bitset<1>()
  1790. , _lrc0 = lvalue_const_bitset<0>()
  1791. );
  1792. Because the parameters were wrapped in a ``(deduced …)`` clause, the following
  1793. function calls are also legal.
  1794. .. parsed-literal::
  1795. b.evaluate( // deduced arguments
  1796. rvalue_bitset<3>()
  1797. , lvalue_const_bitset<0>()
  1798. , lvalue_bitset<1>()
  1799. , rvalue_const_bitset<2>()
  1800. );
  1801. b.evaluate( // deduced arguments
  1802. lvalue_bitset<1>()
  1803. , lvalue_const_bitset<0>()
  1804. );
  1805. The |preprocessor_cpp|_ test program demonstrates proper usage of this macro.
  1806. **Macro parameters:**
  1807. * ``result`` is the parenthesized return type of the function.
  1808. * ``name`` is the base name of the function; it determines the name of the
  1809. generated forwarding functions.
  1810. * ``tag_namespace`` is the namespace in which the keywords used by the
  1811. function resides.
  1812. * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
  1813. *argument-specifiers*, as defined below.
  1814. **Argument specifiers syntax:**
  1815. .. parsed-literal::
  1816. argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
  1817. specifier-group0 ::= *specifier-group1* |
  1818. (
  1819. '**(**' '**deduced**'
  1820. *specifier-group1* {*specifier-group1*\ }
  1821. '**)**'
  1822. )
  1823. specifier-group1 ::=
  1824. (
  1825. '**(**' '**optional**'
  1826. *optional-specifier* {*optional-specifier*\ }
  1827. '**)**'
  1828. ) | (
  1829. '**(**' '**required**'
  1830. *required-specifier* {*required-specifier*\ }
  1831. '**)**'
  1832. )
  1833. optional-specifier ::=
  1834. '**(**'
  1835. *argument-name* '**,**' *restriction* '**,**' *default-value*
  1836. ')'
  1837. required-specifier ::=
  1838. '**(**' *argument-name* '**,**' *restriction* ')'
  1839. restriction ::=
  1840. ( '**\***' '**(**' *mfc* '**)**' ) |
  1841. ( '**(**' *type-name* '**)**' ) |
  1842. '**\***'
  1843. * ``argument-name`` is any valid C++ identifier.
  1844. * ``default-value`` is any valid C++ expression; if necessary, user code can
  1845. compute it in terms of ``previous-name ## _type``, where ``previous-name``
  1846. is the ``argument-name`` in a previous ``specifier-group0`` or
  1847. ``specifier-group1``. *This expression will be invoked exactly once.*
  1848. * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
  1849. be the type of the corresponding ``argument-name``, whose second argument
  1850. will be the entire |ArgumentPack|_, and whose return type is a `Boolean
  1851. Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
  1852. of ``previous-name ## _type``.
  1853. * ``type-name`` is either the name of a **target type** or an `MPL Binary
  1854. Metafunction Class`_ whose first argument will be the type of the
  1855. corresponding ``argument-name``, whose second argument will be the entire
  1856. |ArgumentPack|_, and whose return type is the **target type**. If
  1857. ``restriction`` uses this form, then the type of the generated name
  1858. ``argument-name ## _type`` will be computed in terms of the **target
  1859. type**, and the generated reference ``argument-name`` (but not its
  1860. corresponding entry in ``args``) will be cast to that type.
  1861. **Approximate expansion:**
  1862. Where:
  1863. * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
  1864. * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
  1865. .. parsed-literal::
  1866. // If **result** is a template instantiation of |boost_enable_if|_\,
  1867. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  1868. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  1869. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  1870. // |std_enable_if|_\:
  1871. template <typename Args>
  1872. using boost_param_result_const\_ ## __LINE__ ## **name** = **result**;
  1873. // If **result** is a simple return type:
  1874. template <typename Args>
  1875. struct boost_param_result_const\_ ## __LINE__ ## **name**
  1876. {
  1877. typedef **result** type;
  1878. };
  1879. struct boost_param_params_const\_ ## __LINE__ ## **name**
  1880. : |parameters|_\<
  1881. *list of parameter specifications, based on arguments*
  1882. >
  1883. {
  1884. };
  1885. typedef boost_param_params_const\_ ## __LINE__ ## **name**
  1886. boost_param_parameters_const\_ ## __LINE__ ## **name**;
  1887. template <typename A0, …, typename A ## **n**>
  1888. **result** **name**\ (
  1889. A0&& a0, …, A ## **n**\ && a ## **n**
  1890. , typename boost_param_parameters_const\_ ## __LINE__ ## **name**
  1891. ::match<A0, …, A ## **n**>::type
  1892. = boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()
  1893. ) const
  1894. {
  1895. return this->boost_param_impl_const ## __LINE__ ## **name**\ (
  1896. boost_param_parameters_const\_ ## __LINE__ ## **name**\ (
  1897. |std_forward|_\<A0>(a0)
  1898. , …
  1899. , |std_forward|_\<A ## **n**>(a ## **n**)
  1900. )
  1901. );
  1902. }
  1903. :vellipsis:`⋮`
  1904. template <typename A0, …, typename A ## **m**>
  1905. **result** **name**\ (
  1906. A0&& a0, …, A ## **m**\ && a ## **m**
  1907. , typename boost_param_parameters_const\_ ## __LINE__ ## **name**
  1908. ::match<A0, …, A ## **m**>::type
  1909. = boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()
  1910. ) const
  1911. {
  1912. return this->boost_param_impl_const ## __LINE__ ## **name**\ (
  1913. boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()(
  1914. |std_forward|_\<A0>(a0)
  1915. , …
  1916. , |std_forward|_\<A ## **m**>(a ## **m**)
  1917. )
  1918. );
  1919. }
  1920. template <typename Args>
  1921. typename boost_param_result_const\_ ## __LINE__ ## **name**\ <Args>::type
  1922. boost_param_impl_const ## __LINE__ ## **name**\ (Args const& args) const
  1923. {
  1924. return this->
  1925. boost_param_dispatch_const_0boost\_ ## __LINE__ ## **name**\ (
  1926. static_cast<
  1927. typename boost_param_result_const\_ ## __LINE__ ## **name**\ <
  1928. Args
  1929. >::type(*)()
  1930. >(|std_nullptr|_\)
  1931. , args
  1932. , |std_forward|_\<
  1933. typename |value_type|_\<
  1934. Args
  1935. , *keyword tag type of required parameter* ## **0**
  1936. >::type
  1937. >(args[ *keyword object of required parameter* ## **0**])
  1938. , …
  1939. , |std_forward|_\<
  1940. typename |value_type|_\<
  1941. Args
  1942. , *keyword tag type of required parameter* ## **n**
  1943. >::type
  1944. >(args[ *keyword object of required parameter* ## **n**])
  1945. );
  1946. }
  1947. template <
  1948. typename ResultType
  1949. , typename Args
  1950. , typename *argument name* ## **0** ## _type
  1951. , …
  1952. , typename *argument name* ## **n** ## _type
  1953. >
  1954. ResultType
  1955. boost_param_dispatch_const_0boost\_ ## __LINE__ ## **name**\ (
  1956. (ResultType(*)())
  1957. , Args const& args
  1958. , *argument name* ## **0** ## _type&& *argument name* ## **0**
  1959. , …
  1960. , *argument name* ## **n** ## _type&& *argument name* ## **n**
  1961. ) const
  1962. {
  1963. return this->
  1964. boost_param_dispatch_const_0boost\_ ## __LINE__ ## **name**\ (
  1965. static_cast<ResultType(*)()>(|std_nullptr|_\)
  1966. , (args, *keyword object of optional parameter* ## **n + 1** =
  1967. *default value of optional parameter* ## **n + 1**
  1968. )
  1969. , |std_forward|_\<*argument name* ## **0** ## _type>(
  1970. *argument name* ## **0**
  1971. )
  1972. , …
  1973. , |std_forward|_\<*argument name* ## **n** ## _type>(
  1974. *argument name* ## **n**
  1975. )
  1976. , |std_forward|_\<
  1977. typename |value_type|_\<
  1978. Args
  1979. , *keyword tag type of optional parameter* ## **n + 1**
  1980. >::type
  1981. >(*default value of optional parameter* ## **n + 1**)
  1982. );
  1983. }
  1984. :vellipsis:`⋮`
  1985. template <
  1986. typename ResultType
  1987. , typename Args
  1988. , typename *argument name* ## **0** ## _type
  1989. , …
  1990. , typename *argument name* ## **m** ## _type
  1991. >
  1992. ResultType
  1993. boost_param_dispatch_const_0boost\_ ## __LINE__ ## **name**\ (
  1994. (ResultType(*)())
  1995. , Args const& args
  1996. , *argument name* ## **0** ## _type&& *argument name* ## **0**
  1997. , …
  1998. , *argument name* ## **m** ## _type&& *argument name* ## **m**
  1999. ) const
  2000. .. |BOOST_PARAMETER_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_FUNCTION_CALL_OPERATOR``
  2001. .. _BOOST_PARAMETER_FUNCTION_CALL_OPERATOR:
  2002. ``BOOST_PARAMETER_FUNCTION_CALL_OPERATOR(result, tag_namespace, arguments)``
  2003. ----------------------------------------------------------------------------
  2004. :Defined in: |preprocessor_header|_
  2005. Generates a function call operator that can take in positional arguments,
  2006. composed arguments, named arguments, and deduced arguments.
  2007. :Example usage:
  2008. Define the named parameters that will comprise the argument specification that
  2009. this macro will use. Ensure that all their tag types are in the same
  2010. namespace, which is ``tag`` by default.
  2011. .. parsed-literal::
  2012. |BOOST_PARAMETER_NAME|_\(y)
  2013. |BOOST_PARAMETER_NAME|_\(z)
  2014. Use the macro as a substitute for a normal function call operator
  2015. header. Enclose the return type in parentheses. For each parameter, also
  2016. enclose the expected value type in parentheses. Since the value types are
  2017. mutually exclusive, you can wrap the parameters in a ``(deduced …)``
  2018. clause. This is especially useful when implementing multiple
  2019. Boost.Parameter-enabled function call operator overloads.
  2020. .. parsed-literal::
  2021. class char_reader
  2022. {
  2023. int index;
  2024. char const* key;
  2025. public:
  2026. explicit char_reader(char const* k) : index(0), key(k)
  2027. {
  2028. }
  2029. BOOST_PARAMETER_FUNCTION_CALL_OPERATOR((void), tag,
  2030. (deduced
  2031. (required
  2032. (y, (int))
  2033. (z, (char const*))
  2034. )
  2035. )
  2036. )
  2037. {
  2038. this->index = y;
  2039. this->key = z;
  2040. }
  2041. |BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR|_\((char), tag,
  2042. (deduced
  2043. (required
  2044. (y, (bool))
  2045. (z, (|std_map|_\<char const*, |std_string|_\>))
  2046. )
  2047. )
  2048. )
  2049. {
  2050. return y ? (
  2051. (z.find(this->key)->second)[this->index]
  2052. ) : this->key[this->index];
  2053. }
  2054. };
  2055. As with regular argument-dependent lookup, the value types of the arguments
  2056. passed in determine which function call operator overload gets invoked.
  2057. .. parsed-literal::
  2058. char const* keys[] = {"foo", "bar", "baz"};
  2059. |std_map|_\<char const*, |std_string|_\> k2s;
  2060. k2s[keys[0]] = |std_string|_\("qux");
  2061. k2s[keys[1]] = |std_string|_\("wmb");
  2062. k2s[keys[2]] = |std_string|_\("zxc");
  2063. char_reader r(keys[0]);
  2064. // positional arguments
  2065. BOOST_TEST_EQ('q', (r(true, k2s)));
  2066. BOOST_TEST_EQ('f', (r(false, k2s)));
  2067. // named arguments
  2068. r(_z = keys[1], _y = 1);
  2069. BOOST_TEST_EQ('m', (r(_z = k2s, _y = true)));
  2070. BOOST_TEST_EQ('a', (r(_z = k2s, _y = false)));
  2071. // deduced arguments
  2072. r(keys[2], 2);
  2073. BOOST_TEST_EQ('c', (r(k2s, true)));
  2074. BOOST_TEST_EQ('z', (r(k2s, false)));
  2075. The |preprocessor_cpp|_ and |preprocessor_deduced_cpp|_ test programs
  2076. demonstrate proper usage of this macro.
  2077. **Macro parameters:**
  2078. * ``result`` is the parenthesized return type of the function call operator.
  2079. * ``tag_namespace`` is the namespace in which the keywords used by the
  2080. function call operator resides.
  2081. * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
  2082. *argument-specifiers*, as defined below.
  2083. **Argument specifiers syntax:**
  2084. .. parsed-literal::
  2085. argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
  2086. specifier-group0 ::= *specifier-group1* |
  2087. (
  2088. '**(**' '**deduced**'
  2089. *specifier-group1* {*specifier-group1*\ }
  2090. '**)**'
  2091. )
  2092. specifier-group1 ::=
  2093. (
  2094. '**(**' '**optional**'
  2095. *optional-specifier* {*optional-specifier*\ }
  2096. '**)**'
  2097. ) | (
  2098. '**(**' '**required**'
  2099. *required-specifier* {*required-specifier*\ }
  2100. '**)**'
  2101. )
  2102. optional-specifier ::=
  2103. '**(**'
  2104. *argument-name* '**,**' *restriction* '**,**' *default-value*
  2105. ')'
  2106. required-specifier ::=
  2107. '**(**' *argument-name* '**,**' *restriction* ')'
  2108. restriction ::=
  2109. ( '**\***' '**(**' *mfc* '**)**' ) |
  2110. ( '**(**' *type-name* '**)**' ) |
  2111. '**\***'
  2112. * ``argument-name`` is any valid C++ identifier.
  2113. * ``default-value`` is any valid C++ expression; if necessary, user code can
  2114. compute it in terms of ``previous-name ## _type``, where ``previous-name``
  2115. is the ``argument-name`` in a previous ``specifier-group0`` or
  2116. ``specifier-group1``. *This expression will be invoked exactly once.*
  2117. * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
  2118. be the type of the corresponding ``argument-name``, whose second argument
  2119. will be the entire |ArgumentPack|_, and whose return type is a `Boolean
  2120. Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
  2121. of ``previous-name ## _type``.
  2122. * ``type-name`` is either the name of a **target type** or an `MPL Binary
  2123. Metafunction Class`_ whose first argument will be the type of the
  2124. corresponding ``argument-name``, whose second argument will be the entire
  2125. |ArgumentPack|_, and whose return type is the **target type**. If
  2126. ``restriction`` uses this form, then the type of the generated name
  2127. ``argument-name ## _type`` will be computed in terms of the **target
  2128. type**, and the generated reference ``argument-name`` (but not its
  2129. corresponding entry in ``args``) will be cast to that type.
  2130. **Approximate expansion:**
  2131. Where:
  2132. * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
  2133. * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
  2134. .. parsed-literal::
  2135. // If **result** is a template instantiation of |boost_enable_if|_\,
  2136. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  2137. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  2138. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  2139. // |std_enable_if|_\:
  2140. template <typename Args>
  2141. using boost_param_result\_ ## __LINE__ ## operator = **result**;
  2142. // If **result** is a simple return type:
  2143. template <typename Args>
  2144. struct boost_param_result\_ ## __LINE__ ## operator
  2145. {
  2146. typedef **result** type;
  2147. };
  2148. struct boost_param_params\_ ## __LINE__ ## operator
  2149. : |parameters|_\<
  2150. *list of parameter specifications, based on arguments*
  2151. >
  2152. {
  2153. };
  2154. typedef boost_param_params\_ ## __LINE__ ## operator
  2155. boost_param_parameters\_ ## __LINE__ ## operator;
  2156. template <typename A0, …, typename A ## **n**>
  2157. **result** operator()(
  2158. A0&& a0, …, A ## **n**\ && a ## **n**
  2159. , typename boost_param_parameters\_ ## __LINE__ ## operator::match<
  2160. A0, …, A ## **n**
  2161. >::type = boost_param_parameters\_ ## __LINE__ ## operator()
  2162. )
  2163. {
  2164. return this->boost_param_impl ## __LINE__ ## operator(
  2165. boost_param_parameters\_ ## __LINE__ ## operator()(
  2166. |std_forward|_\<A0>(a0)
  2167. , …
  2168. , |std_forward|_\<A ## **n**>(a ## **n**)
  2169. )
  2170. );
  2171. }
  2172. :vellipsis:`⋮`
  2173. template <typename A0, …, typename A ## **m**>
  2174. **result** operator()(
  2175. A0&& a0, …, A ## **m**\ && a ## **m**
  2176. , typename boost_param_parameters\_ ## __LINE__ ## operator::match<
  2177. A0, …, A ## **m**
  2178. >::type = boost_param_parameters\_ ## __LINE__ ## operator()
  2179. )
  2180. {
  2181. return this->boost_param_impl ## __LINE__ ## operator(
  2182. boost_param_parameters\_ ## __LINE__ ## operator()(
  2183. |std_forward|_\<A0>(a0)
  2184. , …
  2185. , |std_forward|_\<A ## **m**>(a ## **m**)
  2186. )
  2187. );
  2188. }
  2189. template <typename Args>
  2190. typename boost_param_result\_ ## __LINE__ ## operator<Args>::type
  2191. boost_param_impl ## __LINE__ ## operator(Args const& args)
  2192. {
  2193. return this->boost_param_dispatch_0boost\_ ## __LINE__ ## operator(
  2194. static_cast<
  2195. typename boost_param_result\_ ## __LINE__ ## operator<
  2196. Args
  2197. >::type(*)()
  2198. >(|std_nullptr|_\)
  2199. , args
  2200. , |std_forward|_\<
  2201. typename |value_type|_\<
  2202. Args
  2203. , *keyword tag type of required parameter* ## **0**
  2204. >::type
  2205. >(args[ *keyword object of required parameter* ## **0**])
  2206. , …
  2207. , |std_forward|_\<
  2208. typename |value_type|_\<
  2209. Args
  2210. , *keyword tag type of required parameter* ## **n**
  2211. >::type
  2212. >(args[ *keyword object of required parameter* ## **n**])
  2213. );
  2214. }
  2215. template <
  2216. typename ResultType
  2217. , typename Args
  2218. , typename *argument name* ## **0** ## _type
  2219. , …
  2220. , typename *argument name* ## **n** ## _type
  2221. >
  2222. ResultType
  2223. boost_param_dispatch_0boost\_ ## __LINE__ ## operator(
  2224. (ResultType(*)())
  2225. , Args const& args
  2226. , *argument name* ## **0** ## _type&& *argument name* ## **0**
  2227. , …
  2228. , *argument name* ## **n** ## _type&& *argument name* ## **n**
  2229. )
  2230. {
  2231. return this->boost_param_dispatch_0boost\_ ## __LINE__ ## operator(
  2232. static_cast<ResultType(*)()>(|std_nullptr|_\)
  2233. , (args, *keyword object of optional parameter* ## **n + 1** =
  2234. *default value of optional parameter* ## **n + 1**
  2235. )
  2236. , |std_forward|_\<*argument name* ## **0** ## _type>(
  2237. *argument name* ## **0**
  2238. )
  2239. , …
  2240. , |std_forward|_\<*argument name* ## **n** ## _type>(
  2241. *argument name* ## **n**
  2242. )
  2243. , |std_forward|_\<
  2244. typename |value_type|_\<
  2245. Args
  2246. , *keyword tag type of optional parameter* ## **n + 1**
  2247. >::type
  2248. >(*default value of optional parameter* ## **n + 1**)
  2249. );
  2250. }
  2251. :vellipsis:`⋮`
  2252. template <
  2253. typename ResultType
  2254. , typename Args
  2255. , typename *argument name* ## **0** ## _type
  2256. , …
  2257. , typename *argument name* ## **m** ## _type
  2258. >
  2259. ResultType
  2260. boost_param_dispatch_0boost\_ ## __LINE__ ## operator(
  2261. (ResultType(*)())
  2262. , Args const& args
  2263. , *argument name* ## **0** ## _type&& *argument name* ## **0**
  2264. , …
  2265. , *argument name* ## **m** ## _type&& *argument name* ## **m**
  2266. )
  2267. .. |BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR``
  2268. .. _BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR:
  2269. ``BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, arguments)``
  2270. ---------------------------------------------------------------------------
  2271. :Defined in: |preprocessor_header|_
  2272. Generates a function call operator that can take in positional arguments,
  2273. composed arguments, named arguments, and deduced arguments.
  2274. :Example usage:
  2275. The return type of each of the following function templates falls under a
  2276. different value category.
  2277. .. parsed-literal::
  2278. template <std::size_t N>
  2279. |std_bitset|_\<N + 1> rvalue_bitset()
  2280. {
  2281. return |std_bitset|_\<N + 1>();
  2282. }
  2283. template <std::size_t N>
  2284. |std_bitset|_\<N + 1> const rvalue_const_bitset()
  2285. {
  2286. return |std_bitset|_\<N + 1>();
  2287. }
  2288. template <std::size_t N>
  2289. |std_bitset|_\<N + 1>& lvalue_bitset()
  2290. {
  2291. static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
  2292. return lset;
  2293. }
  2294. template <std::size_t N>
  2295. |std_bitset|_\<N + 1> const& lvalue_const_bitset()
  2296. {
  2297. static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
  2298. return clset;
  2299. }
  2300. The ``U::evaluate_category`` static member function template has a simple job:
  2301. to return the correct value category when passed in an object returned by one
  2302. of the functions defined above. Assume that
  2303. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
  2304. .. parsed-literal::
  2305. enum invoked
  2306. {
  2307. passed_by_lvalue_reference_to_const
  2308. , passed_by_lvalue_reference
  2309. , passed_by_rvalue_reference_to_const
  2310. , passed_by_rvalue_reference
  2311. };
  2312. struct U
  2313. {
  2314. template <std::size_t N>
  2315. static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
  2316. {
  2317. return passed_by_lvalue_reference_to_const;
  2318. }
  2319. template <std::size_t N>
  2320. static invoked evaluate_category(|std_bitset|_\<N + 1>&)
  2321. {
  2322. return passed_by_lvalue_reference;
  2323. }
  2324. template <std::size_t N>
  2325. static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
  2326. {
  2327. return passed_by_rvalue_reference_to_const;
  2328. }
  2329. template <std::size_t N>
  2330. static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
  2331. {
  2332. return passed_by_rvalue_reference;
  2333. }
  2334. };
  2335. Define the named parameters that will comprise the argument specification that
  2336. this macro will use. Ensure that all their tag types are in the same
  2337. namespace, which is ``kw`` in this case. The identifiers with leading
  2338. underscores can be passed to the bracket operator of ``args`` to extract the
  2339. same argument to which the corresponding named parameter (without underscores)
  2340. is bound, as will be shown later.
  2341. .. parsed-literal::
  2342. |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
  2343. |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
  2344. |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
  2345. |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
  2346. Use the macro as a substitute for a normal ``const`` function call operator
  2347. header. Enclose the return type ``bool`` in parentheses. For each parameter,
  2348. also enclose the expected value type in parentheses. Since the value types
  2349. are mutually exclusive, you can wrap the parameters in a ``(deduced …)``
  2350. clause. Otherwise, just as with a normal function, the order in which you
  2351. specify the parameters determines their position. Also, just as with a normal
  2352. function, optional parameters have default values, whereas required parameters
  2353. do not. Within the function body, either simply use the parameter name or
  2354. pass the matching identifier with the leading underscore to the bracket
  2355. operator of ``args`` to extract the corresponding argument. Note that the
  2356. second method doesn't require ``std::forward`` to preserve value categories.
  2357. .. parsed-literal::
  2358. struct B
  2359. {
  2360. B()
  2361. {
  2362. }
  2363. BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR((bool), kw,
  2364. (deduced
  2365. (required
  2366. (lrc, (|std_bitset|_\<1>))
  2367. (lr, (|std_bitset|_\<2>))
  2368. )
  2369. (optional
  2370. (rrc, (|std_bitset|_\<3>), rvalue_const_bitset<2>())
  2371. (rr, (|std_bitset|_\<4>), rvalue_bitset<3>())
  2372. )
  2373. )
  2374. )
  2375. {
  2376. BOOST_TEST_EQ(
  2377. passed_by_lvalue_reference_to_const
  2378. , U::evaluate_category<0>(lrc)
  2379. );
  2380. BOOST_TEST_EQ(
  2381. passed_by_lvalue_reference
  2382. , U::evaluate_category<1>(lr)
  2383. );
  2384. BOOST_TEST_EQ(
  2385. passed_by_rvalue_reference_to_const
  2386. , U::evaluate_category<2>(|std_forward|_\<rrc0_type>(rrc0))
  2387. );
  2388. BOOST_TEST_EQ(
  2389. passed_by_rvalue_reference
  2390. , U::evaluate_category<3>(args[_rr0])
  2391. );
  2392. return true;
  2393. }
  2394. };
  2395. The following function calls are legal.
  2396. .. parsed-literal::
  2397. B const b = B();
  2398. b( // positional arguments
  2399. lvalue_const_bitset<0>()
  2400. , lvalue_bitset<1>()
  2401. , rvalue_const_bitset<2>()
  2402. , rvalue_bitset<3>()
  2403. );
  2404. b( // positional arguments
  2405. lvalue_const_bitset<0>()
  2406. , lvalue_bitset<1>()
  2407. );
  2408. b(( // composed arguments
  2409. _rr0 = rvalue_bitset<3>()
  2410. , _lrc0 = lvalue_const_bitset<0>()
  2411. , _lr0 = lvalue_bitset<1>()
  2412. , _rrc0 = rvalue_const_bitset<2>()
  2413. ));
  2414. b( // named arguments
  2415. _rr0 = rvalue_bitset<3>()
  2416. , _lrc0 = lvalue_const_bitset<0>()
  2417. , _lr0 = lvalue_bitset<1>()
  2418. , _rrc0 = rvalue_const_bitset<2>()
  2419. );
  2420. b( // named arguments
  2421. _lr0 = lvalue_bitset<1>()
  2422. , _lrc0 = lvalue_const_bitset<0>()
  2423. );
  2424. Because the parameters were wrapped in a ``(deduced …)`` clause, the following
  2425. function calls are also legal.
  2426. .. parsed-literal::
  2427. b( // deduced arguments
  2428. rvalue_bitset<3>()
  2429. , lvalue_const_bitset<0>()
  2430. , lvalue_bitset<1>()
  2431. , rvalue_const_bitset<2>()
  2432. );
  2433. b( // deduced arguments
  2434. lvalue_bitset<1>()
  2435. , lvalue_const_bitset<0>()
  2436. );
  2437. The |preprocessor_cpp|_, |preprocessor_deduced_cpp|_, and
  2438. |preprocessor_eval_cat_8_cpp|_ test programs demonstrate proper usage of this
  2439. macro.
  2440. **Macro parameters:**
  2441. * ``result`` is the parenthesized return type of the function call operator.
  2442. * ``tag_namespace`` is the namespace in which the keywords used by the
  2443. function call operator resides.
  2444. * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
  2445. *argument-specifiers*, as defined below.
  2446. **Argument specifiers syntax:**
  2447. .. parsed-literal::
  2448. argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
  2449. specifier-group0 ::= *specifier-group1* |
  2450. (
  2451. '**(**' '**deduced**'
  2452. *specifier-group1* {*specifier-group1*\ }
  2453. '**)**'
  2454. )
  2455. specifier-group1 ::=
  2456. (
  2457. '**(**' '**optional**'
  2458. *optional-specifier* {*optional-specifier*\ }
  2459. '**)**'
  2460. ) | (
  2461. '**(**' '**required**'
  2462. *required-specifier* {*required-specifier*\ }
  2463. '**)**'
  2464. )
  2465. optional-specifier ::=
  2466. '**(**'
  2467. *argument-name* '**,**' *restriction* '**,**' *default-value*
  2468. ')'
  2469. required-specifier ::=
  2470. '**(**' *argument-name* '**,**' *restriction* ')'
  2471. restriction ::=
  2472. ( '**\***' '**(**' *mfc* '**)**' ) |
  2473. ( '**(**' *type-name* '**)**' ) |
  2474. '**\***'
  2475. * ``argument-name`` is any valid C++ identifier.
  2476. * ``default-value`` is any valid C++ expression; if necessary, user code can
  2477. compute it in terms of ``previous-name ## _type``, where ``previous-name``
  2478. is the ``argument-name`` in a previous ``specifier-group0`` or
  2479. ``specifier-group1``. *This expression will be invoked exactly once.*
  2480. * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
  2481. be the type of the corresponding ``argument-name``, whose second argument
  2482. will be the entire |ArgumentPack|_, and whose return type is a `Boolean
  2483. Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
  2484. of ``previous-name ## _type``.
  2485. * ``type-name`` is either the name of a **target type** or an `MPL Binary
  2486. Metafunction Class`_ whose first argument will be the type of the
  2487. corresponding ``argument-name``, whose second argument will be the entire
  2488. |ArgumentPack|_, and whose return type is the **target type**. If
  2489. ``restriction`` uses this form, then the type of the generated name
  2490. ``argument-name ## _type`` will be computed in terms of the **target
  2491. type**, and the generated reference ``argument-name`` (but not its
  2492. corresponding entry in ``args``) will be cast to that type.
  2493. **Approximate expansion:**
  2494. Where:
  2495. * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
  2496. * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
  2497. .. parsed-literal::
  2498. // If **result** is a template instantiation of |boost_enable_if|_\,
  2499. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  2500. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  2501. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  2502. // |std_enable_if|_\:
  2503. template <typename Args>
  2504. using boost_param_result_const\_ ## __LINE__ ## operator = **result**;
  2505. // If **result** is a simple return type:
  2506. template <typename Args>
  2507. struct boost_param_result_const\_ ## __LINE__ ## operator
  2508. {
  2509. typedef **result** type;
  2510. };
  2511. struct boost_param_params_const\_ ## __LINE__ ## operator
  2512. : |parameters|_\<
  2513. *list of parameter specifications, based on arguments*
  2514. >
  2515. {
  2516. };
  2517. typedef boost_param_params_const\_ ## __LINE__ ## operator
  2518. boost_param_parameters_const\_ ## __LINE__ ## operator;
  2519. template <typename A0, …, typename A ## **n**>
  2520. **result** operator()(
  2521. A0&& a0, …, A ## **n**\ && a ## **n**
  2522. , typename boost_param_parameters_const\_ ## __LINE__ ## operator
  2523. ::match<A0, …, A ## **n**>::type
  2524. = boost_param_parameters_const\_ ## __LINE__ ## operator()
  2525. ) const
  2526. {
  2527. return this->boost_param_impl_const ## __LINE__ ## operator(
  2528. boost_param_parameters_const\_ ## __LINE__ ## operator()(
  2529. |std_forward|_\<A0>(a0)
  2530. , …
  2531. , |std_forward|_\<A ## **n**>(a ## **n**)
  2532. )
  2533. );
  2534. }
  2535. :vellipsis:`⋮`
  2536. template <typename A0, …, typename A ## **m**>
  2537. **result** operator()(
  2538. A0&& a0, …, A ## **m**\ && a ## **m**
  2539. , typename boost_param_parameters_const\_ ## __LINE__ ## operator
  2540. ::match<A0, …, A ## **m**>::type
  2541. = boost_param_parameters_const\_ ## __LINE__ ## operator()
  2542. ) const
  2543. {
  2544. return this->boost_param_impl_const ## __LINE__ ## operator(
  2545. boost_param_parameters_const\_ ## __LINE__ ## operator()(
  2546. |std_forward|_\<A0>(a0)
  2547. , …
  2548. , |std_forward|_\<A ## **m**>(a ## **m**)
  2549. )
  2550. );
  2551. }
  2552. template <typename Args>
  2553. typename boost_param_result_const\_ ## __LINE__ ## operator<Args>::type
  2554. boost_param_impl_const ## __LINE__ ## operator(Args const& args) const
  2555. {
  2556. return this->
  2557. boost_param_dispatch_const_0boost\_ ## __LINE__ ## operator(
  2558. static_cast<
  2559. typename boost_param_result_const\_ ## __LINE__ ## operator<
  2560. Args
  2561. >::type(*)()
  2562. >(|std_nullptr|_\)
  2563. , args
  2564. , |std_forward|_\<
  2565. typename |value_type|_\<
  2566. Args
  2567. , *keyword tag type of required parameter* ## **0**
  2568. >::type
  2569. >(args[ *keyword object of required parameter* ## **0**])
  2570. , …
  2571. , |std_forward|_\<
  2572. typename |value_type|_\<
  2573. Args
  2574. , *keyword tag type of required parameter* ## **n**
  2575. >::type
  2576. >(args[ *keyword object of required parameter* ## **n**])
  2577. );
  2578. }
  2579. template <
  2580. typename ResultType
  2581. , typename Args
  2582. , typename *argument name* ## **0** ## _type
  2583. , …
  2584. , typename *argument name* ## **n** ## _type
  2585. >
  2586. ResultType
  2587. boost_param_dispatch_const_0boost\_ ## __LINE__ ## operator(
  2588. (ResultType(*)())
  2589. , Args const& args
  2590. , *argument name* ## **0** ## _type&& *argument name* ## **0**
  2591. , …
  2592. , *argument name* ## **n** ## _type&& *argument name* ## **n**
  2593. ) const
  2594. {
  2595. return this->
  2596. boost_param_dispatch_const_0boost\_ ## __LINE__ ## operator(
  2597. static_cast<ResultType(*)()>(|std_nullptr|_\)
  2598. , (args, *keyword object of optional parameter* ## **n + 1** =
  2599. *default value of optional parameter* ## **n + 1**
  2600. )
  2601. , |std_forward|_\<*argument name* ## **0** ## _type>(
  2602. *argument name* ## **0**
  2603. )
  2604. , …
  2605. , |std_forward|_\<*argument name* ## **n** ## _type>(
  2606. *argument name* ## **n**
  2607. )
  2608. , |std_forward|_\<
  2609. typename |value_type|_\<
  2610. Args
  2611. , *keyword tag type of optional parameter* ## **n + 1**
  2612. >::type
  2613. >(*default value of optional parameter* ## **n + 1**)
  2614. );
  2615. }
  2616. :vellipsis:`⋮`
  2617. template <
  2618. typename ResultType
  2619. , typename Args
  2620. , typename *argument name* ## **0** ## _type
  2621. , …
  2622. , typename *argument name* ## **m** ## _type
  2623. >
  2624. ResultType
  2625. boost_param_dispatch_const_0boost\_ ## __LINE__ ## operator(
  2626. (ResultType(*)())
  2627. , Args const& args
  2628. , *argument name* ## **0** ## _type&& *argument name* ## **0**
  2629. , …
  2630. , *argument name* ## **m** ## _type&& *argument name* ## **m**
  2631. ) const
  2632. .. |BOOST_PARAMETER_CONSTRUCTOR| replace:: ``BOOST_PARAMETER_CONSTRUCTOR``
  2633. .. _BOOST_PARAMETER_CONSTRUCTOR:
  2634. ``BOOST_PARAMETER_CONSTRUCTOR(cls, impl, tag_namespace, arguments)``
  2635. --------------------------------------------------------------------
  2636. :Defined in: |preprocessor_header|_
  2637. Generates a constructor that can take in positional arguments, composed
  2638. arguments, named arguments, and deduced arguments.
  2639. :Example usage:
  2640. Define the named parameters that will comprise the argument specification that
  2641. this macro will use. Ensure that all their tag types are in the same
  2642. namespace, which is ``tag`` by default.
  2643. .. parsed-literal::
  2644. |BOOST_PARAMETER_NAME|_\(y)
  2645. |BOOST_PARAMETER_NAME|_\(z)
  2646. In the base class, implement a delegate constructor template that takes in an
  2647. |ArgumentPack|_. You must pass the identifiers with leading underscores to
  2648. ``args`` in order to extract the corresponding arguments.
  2649. .. parsed-literal::
  2650. class char_read_base
  2651. {
  2652. int index;
  2653. char const* key;
  2654. public:
  2655. template <typename Args>
  2656. explicit char_read_base(Args const& args)
  2657. : index(args[_y]), key(args[_z])
  2658. {
  2659. }
  2660. |BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR|_\((char), tag,
  2661. (deduced
  2662. (required
  2663. (y, (bool))
  2664. (z, (|std_map|_\<char const*, |std_string|_\>))
  2665. )
  2666. )
  2667. )
  2668. {
  2669. return y ? (
  2670. (z.find(this->key)->second)[this->index]
  2671. ) : this->key[this->index];
  2672. }
  2673. };
  2674. Use the macro as a substitute for a normal constructor definition. Note the
  2675. lack of an explicit body. Enclose the base type in parentheses. For each
  2676. parameter, also enclose the expected value type in parentheses. Since the
  2677. value types are mutually exclusive, you can wrap the parameters in a
  2678. ``(deduced …)`` clause.
  2679. .. parsed-literal::
  2680. struct char_reader : public char_read_base
  2681. {
  2682. BOOST_PARAMETER_CONSTRUCTOR(char_reader, (char_read_base), tag,
  2683. (deduced
  2684. (required
  2685. (y, (int))
  2686. (z, (char const*))
  2687. )
  2688. )
  2689. )
  2690. };
  2691. The following ``char_reader`` constructor calls are legal.
  2692. .. parsed-literal::
  2693. char const* keys[] = {"foo", "bar", "baz"};
  2694. |std_map|_\<char const*, |std_string|_\> k2s;
  2695. k2s[keys[0]] = |std_string|_\("qux");
  2696. k2s[keys[1]] = |std_string|_\("wmb");
  2697. k2s[keys[2]] = |std_string|_\("zxc");
  2698. // positional arguments
  2699. char_reader r0(0, keys[0]);
  2700. BOOST_TEST_EQ('q', (r0(true, k2s)));
  2701. BOOST_TEST_EQ('f', (r0(false, k2s)));
  2702. // named arguments
  2703. char_reader r1(_z = keys[1], _y = 1);
  2704. BOOST_TEST_EQ('m', (r1(_z = k2s, _y = true)));
  2705. BOOST_TEST_EQ('a', (r1(_z = k2s, _y = false)));
  2706. // deduced arguments
  2707. char_reader r2(keys[2], 2);
  2708. BOOST_TEST_EQ('c', (r2(k2s, true)));
  2709. BOOST_TEST_EQ('z', (r2(k2s, false)));
  2710. The |preprocessor_cpp|_ and |preprocessor_deduced_cpp|_ test programs
  2711. demonstrate proper usage of this macro.
  2712. **Macro parameters:**
  2713. * ``cls`` is the name of the enclosing class.
  2714. * ``impl`` is the parenthesized implementation base class for ``cls``.
  2715. * ``tag_namespace`` is the namespace in which the keywords used by the
  2716. constructor resides.
  2717. * ``arguments`` is a list of *argument-specifiers*, as defined below.
  2718. **Argument specifiers syntax:**
  2719. .. parsed-literal::
  2720. argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
  2721. specifier-group0 ::= *specifier-group1* |
  2722. (
  2723. '**(**' '**deduced**'
  2724. *specifier-group1* {*specifier-group1*\ }
  2725. '**)**'
  2726. )
  2727. specifier-group1 ::=
  2728. (
  2729. '**(**' '**optional**'
  2730. *specifier* {*specifier*\ }
  2731. '**)**'
  2732. ) | (
  2733. '**(**' '**required**'
  2734. *specifier* {*specifier*\ }
  2735. '**)**'
  2736. )
  2737. specifier ::=
  2738. '**(**' *argument-name* '**,**' *restriction* ')'
  2739. restriction ::=
  2740. ( '**\***' '**(**' *mfc* '**)**' ) |
  2741. ( '**(**' *type-name* '**)**' ) |
  2742. '**\***'
  2743. * ``argument-name`` is any valid C++ identifier.
  2744. * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
  2745. be the type of the corresponding ``argument-name``, whose second argument
  2746. will be the entire |ArgumentPack|_, and whose return type is a `Boolean
  2747. Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
  2748. of ``previous-name ## _type``.
  2749. * ``type-name`` is either the name of a **target type** or an `MPL Binary
  2750. Metafunction Class`_ whose first argument will be the type of the
  2751. corresponding ``argument-name``, whose second argument will be the entire
  2752. |ArgumentPack|_, and whose return type is the **target type**.
  2753. Note that *specifier* does not include *default-value*. It is up to the
  2754. delegate constructor in ``impl`` to determine the default value of all
  2755. optional arguments.
  2756. **Approximate expansion:**
  2757. Where:
  2758. * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
  2759. * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
  2760. .. parsed-literal::
  2761. struct boost_param_params\_ ## __LINE__ ## ctor
  2762. : |parameters|_\<
  2763. *list of parameter specifications, based on arguments*
  2764. >
  2765. {
  2766. };
  2767. typedef boost_param_params\_ ## __LINE__ ## ctor
  2768. constructor_parameters ## __LINE__;
  2769. template <typename A0, …, typename A ## **n**>
  2770. **cls**\ (A0&& a0, …, A ## **n** && a ## **n**)
  2771. : **impl**\ (
  2772. constructor_parameters ## __LINE__(
  2773. |std_forward|_\<A0>(a0)
  2774. , …
  2775. , |std_forward|_\<A ## **n**>(a ## **n**)
  2776. )
  2777. )
  2778. {
  2779. }
  2780. :vellipsis:`⋮`
  2781. template <typename A0, …, typename A ## **m**>
  2782. **cls**\ (A0&& a0, …, A ## **m** && a ## **m**)
  2783. : **impl**\ (
  2784. constructor_parameters ## __LINE__(
  2785. |std_forward|_\<A0>(a0)
  2786. , …
  2787. , |std_forward|_\<A ## **m**>(a ## **m**)
  2788. )
  2789. )
  2790. {
  2791. }
  2792. .. |BOOST_PARAMETER_BASIC_FUNCTION| replace:: ``BOOST_PARAMETER_BASIC_FUNCTION``
  2793. .. _BOOST_PARAMETER_BASIC_FUNCTION:
  2794. ``BOOST_PARAMETER_BASIC_FUNCTION(result, name, tag_namespace, arguments)``
  2795. --------------------------------------------------------------------------
  2796. :Defined in: |preprocessor_header|_
  2797. Generates a function that can take in positional arguments, composed
  2798. arguments, named arguments, and deduced arguments.
  2799. :Example usage:
  2800. The return type of each of the following function templates falls under a
  2801. different value category.
  2802. .. parsed-literal::
  2803. template <std::size_t N>
  2804. |std_bitset|_\<N + 1> rvalue_bitset()
  2805. {
  2806. return |std_bitset|_\<N + 1>();
  2807. }
  2808. template <std::size_t N>
  2809. |std_bitset|_\<N + 1> const rvalue_const_bitset()
  2810. {
  2811. return |std_bitset|_\<N + 1>();
  2812. }
  2813. template <std::size_t N>
  2814. |std_bitset|_\<N + 1>& lvalue_bitset()
  2815. {
  2816. static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
  2817. return lset;
  2818. }
  2819. template <std::size_t N>
  2820. |std_bitset|_\<N + 1> const& lvalue_const_bitset()
  2821. {
  2822. static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
  2823. return clset;
  2824. }
  2825. The ``U::evaluate_category`` static member function template has a simple job:
  2826. to return the correct value category when passed in an object returned by one
  2827. of the functions defined above. Assume that
  2828. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
  2829. .. parsed-literal::
  2830. enum invoked
  2831. {
  2832. passed_by_lvalue_reference_to_const
  2833. , passed_by_lvalue_reference
  2834. , passed_by_rvalue_reference_to_const
  2835. , passed_by_rvalue_reference
  2836. };
  2837. struct U
  2838. {
  2839. template <std::size_t N>
  2840. static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
  2841. {
  2842. return passed_by_lvalue_reference_to_const;
  2843. }
  2844. template <std::size_t N>
  2845. static invoked evaluate_category(|std_bitset|_\<N + 1>&)
  2846. {
  2847. return passed_by_lvalue_reference;
  2848. }
  2849. template <std::size_t N>
  2850. static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
  2851. {
  2852. return passed_by_rvalue_reference_to_const;
  2853. }
  2854. template <std::size_t N>
  2855. static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
  2856. {
  2857. return passed_by_rvalue_reference;
  2858. }
  2859. };
  2860. Define the named parameters that will comprise the argument specification that
  2861. this macro will use. Ensure that all their tag types are in the same
  2862. namespace, which is ``kw`` in this case. The identifiers with leading
  2863. underscores can be passed to the bracket operator of ``args`` to extract the
  2864. same argument to which the corresponding named parameter (without underscores)
  2865. is bound, as will be shown later.
  2866. .. parsed-literal::
  2867. |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
  2868. |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
  2869. |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
  2870. |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
  2871. Use the macro as a substitute for a normal function header. Enclose the
  2872. return type ``bool`` in parentheses. For each parameter, also enclose the
  2873. expected value type in parentheses. Since the value types are mutually
  2874. exclusive, you can wrap the parameters in a ``(deduced …)``
  2875. clause. Otherwise, just as with a normal function, the order in which you
  2876. specify the parameters determines their position. However, unlike a normal
  2877. function, default values must be specified within the function body. Also
  2878. within the function body, you must pass the matching identifier with the
  2879. leading underscore to the bracket operator of ``args`` to extract the
  2880. corresponding argument, but at least this doesn't require ``std::forward`` to
  2881. preserve value categories.
  2882. .. parsed-literal::
  2883. BOOST_PARAMETER_BASIC_FUNCTION((bool), evaluate, kw,
  2884. (deduced
  2885. (required
  2886. (lrc, (|std_bitset|_\<1>))
  2887. (lr, (|std_bitset|_\<2>))
  2888. )
  2889. (optional
  2890. (rrc, (|std_bitset|_\<3>))
  2891. (rr, (|std_bitset|_\<4>))
  2892. )
  2893. )
  2894. )
  2895. {
  2896. BOOST_TEST_EQ(
  2897. passed_by_lvalue_reference_to_const
  2898. , U::evaluate_category<0>(args[_lrc])
  2899. );
  2900. BOOST_TEST_EQ(
  2901. passed_by_lvalue_reference
  2902. , U::evaluate_category<1>(args[_lr])
  2903. );
  2904. BOOST_TEST_EQ(
  2905. passed_by_rvalue_reference_to_const
  2906. , U::evaluate_category<2>(
  2907. args[_rrc0 | rvalue_const_bitset<2>()]
  2908. )
  2909. );
  2910. BOOST_TEST_EQ(
  2911. passed_by_rvalue_reference
  2912. , U::evaluate_category<3>(args[_rr0 | rvalue_bitset<3>()])
  2913. );
  2914. return true;
  2915. }
  2916. The following function calls are legal.
  2917. .. parsed-literal::
  2918. evaluate( // positional arguments
  2919. lvalue_const_bitset<0>()
  2920. , lvalue_bitset<1>()
  2921. , rvalue_const_bitset<2>()
  2922. , rvalue_bitset<3>()
  2923. );
  2924. evaluate( // positional arguments
  2925. lvalue_const_bitset<0>()
  2926. , lvalue_bitset<1>()
  2927. );
  2928. evaluate(( // composed arguments
  2929. _rr0 = rvalue_bitset<3>()
  2930. , _lrc0 = lvalue_const_bitset<0>()
  2931. , _lr0 = lvalue_bitset<1>()
  2932. , _rrc0 = rvalue_const_bitset<2>()
  2933. ));
  2934. evaluate( // named arguments
  2935. _rr0 = rvalue_bitset<3>()
  2936. , _lrc0 = lvalue_const_bitset<0>()
  2937. , _lr0 = lvalue_bitset<1>()
  2938. , _rrc0 = rvalue_const_bitset<2>()
  2939. );
  2940. evaluate( // named arguments
  2941. _lr0 = lvalue_bitset<1>()
  2942. , _lrc0 = lvalue_const_bitset<0>()
  2943. );
  2944. Because the parameters were wrapped in a ``(deduced …)`` clause, the following
  2945. function calls are also legal.
  2946. .. parsed-literal::
  2947. evaluate( // deduced arguments
  2948. rvalue_bitset<3>()
  2949. , lvalue_const_bitset<0>()
  2950. , lvalue_bitset<1>()
  2951. , rvalue_const_bitset<2>()
  2952. );
  2953. evaluate( // deduced arguments
  2954. lvalue_bitset<1>()
  2955. , lvalue_const_bitset<0>()
  2956. );
  2957. The |preprocessor_cpp|_ test program demonstrates proper usage of this macro.
  2958. **Macro parameters:**
  2959. * ``result`` is the parenthesized return type of the function.
  2960. * ``name`` is the base name of the function; it determines the name of the
  2961. generated forwarding functions.
  2962. * ``tag_namespace`` is the namespace in which the keywords used by the
  2963. function resides.
  2964. * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
  2965. *argument-specifiers*, as defined below.
  2966. **Argument specifiers syntax:**
  2967. .. parsed-literal::
  2968. argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
  2969. specifier-group0 ::= *specifier-group1* |
  2970. (
  2971. '**(**' '**deduced**'
  2972. *specifier-group1* {*specifier-group1*\ }
  2973. '**)**'
  2974. )
  2975. specifier-group1 ::=
  2976. (
  2977. '**(**' '**optional**'
  2978. *specifier* {*specifier*\ }
  2979. '**)**'
  2980. ) | (
  2981. '**(**' '**required**'
  2982. *specifier* {*specifier*\ }
  2983. '**)**'
  2984. )
  2985. specifier ::=
  2986. '**(**' *argument-name* '**,**' *restriction* ')'
  2987. restriction ::=
  2988. ( '**\***' '**(**' *mfc* '**)**' ) |
  2989. ( '**(**' *type-name* '**)**' ) |
  2990. '**\***'
  2991. * ``argument-name`` is any valid C++ identifier.
  2992. * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
  2993. be the type of the corresponding ``argument-name``, whose second argument
  2994. will be the entire |ArgumentPack|_, and whose return type is a `Boolean
  2995. Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
  2996. of ``previous-name ## _type``.
  2997. * ``type-name`` is either the name of a **target type** or an `MPL Binary
  2998. Metafunction Class`_ whose first argument will be the type of the
  2999. corresponding ``argument-name``, whose second argument will be the entire
  3000. |ArgumentPack|_, and whose return type is the **target type**.
  3001. Note that *specifier* does not include *default-value*. It is up to the
  3002. function body to determine the default value of all optional arguments.
  3003. **Approximate expansion:**
  3004. Where:
  3005. * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
  3006. * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
  3007. .. parsed-literal::
  3008. // If **result** is a template instantiation of |boost_enable_if|_\,
  3009. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  3010. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  3011. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  3012. // |std_enable_if|_\:
  3013. template <typename Args>
  3014. using boost_param_result\_ ## __LINE__ ## **name** = **result**;
  3015. // If **result** is a simple return type:
  3016. template <typename Args>
  3017. struct boost_param_result\_ ## __LINE__ ## **name**
  3018. {
  3019. typedef **result** type;
  3020. };
  3021. struct boost_param_params\_ ## __LINE__ ## **name**
  3022. : |parameters|_\<
  3023. *list of parameter specifications, based on arguments*
  3024. >
  3025. {
  3026. };
  3027. typedef boost_param_params\_ ## __LINE__ ## **name**
  3028. boost_param_parameters\_ ## __LINE__ ## **name**;
  3029. template <typename Args>
  3030. typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type
  3031. boost_param_impl ## **name**\ (Args const&);
  3032. template <typename A0, …, typename A ## **n**>
  3033. **result** **name**\ (
  3034. A0&& a0, …, A ## **n**\ && a ## **n**
  3035. , typename boost_param_parameters\_ ## __LINE__ ## **name**
  3036. ::match<A0, …, A ## **n**>::type
  3037. = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
  3038. )
  3039. {
  3040. return boost_param_impl ## __LINE__ ## **name**\ (
  3041. boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
  3042. |std_forward|_\<A0>(a0)
  3043. , …
  3044. , |std_forward|_\<A ## **n**>(a ## **n**)
  3045. )
  3046. );
  3047. }
  3048. :vellipsis:`⋮`
  3049. template <typename A0, …, typename A ## **m**>
  3050. **result** **name**\ (
  3051. A0&& a0, …, A ## **m**\ && a ## **m**
  3052. , typename boost_param_parameters\_ ## __LINE__ ## **name**
  3053. ::match<A0, …, A ## **m**>::type
  3054. = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
  3055. )
  3056. {
  3057. return boost_param_impl ## __LINE__ ## **name**\ (
  3058. boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
  3059. |std_forward|_\<A0>(a0)
  3060. , …
  3061. , |std_forward|_\<A ## **m**>(a ## **m**)
  3062. )
  3063. );
  3064. }
  3065. template <typename Args>
  3066. typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type
  3067. boost_param_impl ## __LINE__ ## **name**\ (Args const& args)
  3068. Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
  3069. available for use within the function body.
  3070. .. |BOOST_PARAMETER_BASIC_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_BASIC_MEMBER_FUNCTION``
  3071. .. _BOOST_PARAMETER_BASIC_MEMBER_FUNCTION:
  3072. ``BOOST_PARAMETER_BASIC_MEMBER_FUNCTION(result, name, tag_ns, arguments)``
  3073. --------------------------------------------------------------------------
  3074. :Defined in: |preprocessor_header|_
  3075. Generates a member function that can take in positional arguments, composed
  3076. arguments, named arguments, and deduced arguments.
  3077. :Example usage:
  3078. The return type of each of the following function templates falls under a
  3079. different value category.
  3080. .. parsed-literal::
  3081. template <std::size_t N>
  3082. |std_bitset|_\<N + 1> rvalue_bitset()
  3083. {
  3084. return |std_bitset|_\<N + 1>();
  3085. }
  3086. template <std::size_t N>
  3087. |std_bitset|_\<N + 1> const rvalue_const_bitset()
  3088. {
  3089. return |std_bitset|_\<N + 1>();
  3090. }
  3091. template <std::size_t N>
  3092. |std_bitset|_\<N + 1>& lvalue_bitset()
  3093. {
  3094. static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
  3095. return lset;
  3096. }
  3097. template <std::size_t N>
  3098. |std_bitset|_\<N + 1> const& lvalue_const_bitset()
  3099. {
  3100. static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
  3101. return clset;
  3102. }
  3103. The ``U::evaluate_category`` static member function template has a simple job:
  3104. to return the correct value category when passed in an object returned by one
  3105. of the functions defined above. Assume that
  3106. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
  3107. .. parsed-literal::
  3108. enum invoked
  3109. {
  3110. passed_by_lvalue_reference_to_const
  3111. , passed_by_lvalue_reference
  3112. , passed_by_rvalue_reference_to_const
  3113. , passed_by_rvalue_reference
  3114. };
  3115. struct U
  3116. {
  3117. template <std::size_t N>
  3118. static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
  3119. {
  3120. return passed_by_lvalue_reference_to_const;
  3121. }
  3122. template <std::size_t N>
  3123. static invoked evaluate_category(|std_bitset|_\<N + 1>&)
  3124. {
  3125. return passed_by_lvalue_reference;
  3126. }
  3127. template <std::size_t N>
  3128. static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
  3129. {
  3130. return passed_by_rvalue_reference_to_const;
  3131. }
  3132. template <std::size_t N>
  3133. static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
  3134. {
  3135. return passed_by_rvalue_reference;
  3136. }
  3137. };
  3138. Define the named parameters that will comprise the argument specification that
  3139. this macro will use. Ensure that all their tag types are in the same
  3140. namespace, which is ``kw`` in this case. The identifiers with leading
  3141. underscores can be passed to the bracket operator of ``args`` to extract the
  3142. same argument to which the corresponding named parameter (without underscores)
  3143. is bound, as will be shown later.
  3144. .. parsed-literal::
  3145. |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
  3146. |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
  3147. |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
  3148. |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
  3149. Use the macro as a substitute for a normal ``static`` member function
  3150. header. Enclose the return type ``bool`` in parentheses. For each parameter,
  3151. also enclose the expected value type in parentheses. Since the value types
  3152. are mutually exclusive, you can wrap the parameters in a ``(deduced …)``
  3153. clause. Otherwise, just as with a normal function, the order in which you
  3154. specify the parameters determines their position. However, unlike a normal
  3155. function, default values must be specified within the function body. Also
  3156. within the function body, you must pass the matching identifier with the
  3157. leading underscore to the bracket operator of ``args`` to extract the
  3158. corresponding argument, but at least this doesn't require ``std::forward`` to
  3159. preserve value categories.
  3160. .. parsed-literal::
  3161. struct B
  3162. {
  3163. BOOST_PARAMETER_BASIC_MEMBER_FUNCTION((bool), static evaluate, kw,
  3164. (deduced
  3165. (required
  3166. (lrc, (|std_bitset|_\<1>))
  3167. (lr, (|std_bitset|_\<2>))
  3168. )
  3169. (optional
  3170. (rrc, (|std_bitset|_\<3>))
  3171. (rr, (|std_bitset|_\<4>))
  3172. )
  3173. )
  3174. )
  3175. {
  3176. BOOST_TEST_EQ(
  3177. passed_by_lvalue_reference_to_const
  3178. , U::evaluate_category<0>(args[_lrc])
  3179. );
  3180. BOOST_TEST_EQ(
  3181. passed_by_lvalue_reference
  3182. , U::evaluate_category<1>(args[_lr])
  3183. );
  3184. BOOST_TEST_EQ(
  3185. passed_by_rvalue_reference_to_const
  3186. , U::evaluate_category<2>(
  3187. args[_rrc0 | rvalue_const_bitset<2>()]
  3188. )
  3189. );
  3190. BOOST_TEST_EQ(
  3191. passed_by_rvalue_reference
  3192. , U::evaluate_category<3>(
  3193. args[_rr0 | rvalue_bitset<3>()]
  3194. )
  3195. );
  3196. return true;
  3197. }
  3198. };
  3199. The following function calls are legal.
  3200. .. parsed-literal::
  3201. B::evaluate( // positional arguments
  3202. lvalue_const_bitset<0>()
  3203. , lvalue_bitset<1>()
  3204. , rvalue_const_bitset<2>()
  3205. , rvalue_bitset<3>()
  3206. );
  3207. B::evaluate( // positional arguments
  3208. lvalue_const_bitset<0>()
  3209. , lvalue_bitset<1>()
  3210. );
  3211. B::evaluate(( // composed arguments
  3212. _rr0 = rvalue_bitset<3>()
  3213. , _lrc0 = lvalue_const_bitset<0>()
  3214. , _lr0 = lvalue_bitset<1>()
  3215. , _rrc0 = rvalue_const_bitset<2>()
  3216. ));
  3217. B::evaluate( // named arguments
  3218. _rr0 = rvalue_bitset<3>()
  3219. , _lrc0 = lvalue_const_bitset<0>()
  3220. , _lr0 = lvalue_bitset<1>()
  3221. , _rrc0 = rvalue_const_bitset<2>()
  3222. );
  3223. B::evaluate( // named arguments
  3224. _lr0 = lvalue_bitset<1>()
  3225. , _lrc0 = lvalue_const_bitset<0>()
  3226. );
  3227. Because the parameters were wrapped in a ``(deduced …)`` clause, the following
  3228. function calls are also legal.
  3229. .. parsed-literal::
  3230. B::evaluate( // deduced arguments
  3231. rvalue_bitset<3>()
  3232. , lvalue_const_bitset<0>()
  3233. , lvalue_bitset<1>()
  3234. , rvalue_const_bitset<2>()
  3235. );
  3236. B::evaluate( // deduced arguments
  3237. lvalue_bitset<1>()
  3238. , lvalue_const_bitset<0>()
  3239. );
  3240. The |preprocessor_cpp|_ test program demonstrates proper usage of this macro.
  3241. **Macro parameters:**
  3242. * ``result`` is the parenthesized return type of the function.
  3243. * ``name`` is the base name of the function; it determines the name of the
  3244. generated forwarding functions. ``name`` may be qualified by the
  3245. ``static`` keyword to declare the member function and its helpers as not
  3246. associated with any object of the enclosing type.
  3247. * ``tag_namespace`` is the namespace in which the keywords used by the
  3248. function resides.
  3249. * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
  3250. *argument-specifiers*, as defined below.
  3251. **Argument specifiers syntax:**
  3252. .. parsed-literal::
  3253. argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
  3254. specifier-group0 ::= *specifier-group1* |
  3255. (
  3256. '**(**' '**deduced**'
  3257. *specifier-group1* {*specifier-group1*\ }
  3258. '**)**'
  3259. )
  3260. specifier-group1 ::=
  3261. (
  3262. '**(**' '**optional**'
  3263. *specifier* {*specifier*\ }
  3264. '**)**'
  3265. ) | (
  3266. '**(**' '**required**'
  3267. *specifier* {*specifier*\ }
  3268. '**)**'
  3269. )
  3270. specifier ::=
  3271. '**(**' *argument-name* '**,**' *restriction* ')'
  3272. restriction ::=
  3273. ( '**\***' '**(**' *mfc* '**)**' ) |
  3274. ( '**(**' *type-name* '**)**' ) |
  3275. '**\***'
  3276. * ``argument-name`` is any valid C++ identifier.
  3277. * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
  3278. be the type of the corresponding ``argument-name``, whose second argument
  3279. will be the entire |ArgumentPack|_, and whose return type is a `Boolean
  3280. Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
  3281. of ``previous-name ## _type``.
  3282. * ``type-name`` is either the name of a **target type** or an `MPL Binary
  3283. Metafunction Class`_ whose first argument will be the type of the
  3284. corresponding ``argument-name``, whose second argument will be the entire
  3285. |ArgumentPack|_, and whose return type is the **target type**.
  3286. Note that *specifier* does not include *default-value*. It is up to the
  3287. function body to determine the default value of all optional arguments.
  3288. **Approximate expansion:**
  3289. Where:
  3290. * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
  3291. * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
  3292. .. parsed-literal::
  3293. // If **result** is a template instantiation of |boost_enable_if|_\,
  3294. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  3295. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  3296. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  3297. // |std_enable_if|_\:
  3298. template <typename Args>
  3299. using boost_param_result\_ ## __LINE__ ## **name** = **result**;
  3300. // If **result** is a simple return type:
  3301. template <typename Args>
  3302. struct boost_param_result\_ ## __LINE__ ## **name**
  3303. {
  3304. typedef **result** type;
  3305. };
  3306. struct boost_param_params\_ ## __LINE__ ## **name**
  3307. : |parameters|_\<
  3308. *list of parameter specifications, based on arguments*
  3309. >
  3310. {
  3311. };
  3312. typedef boost_param_params\_ ## __LINE__ ## **name**
  3313. boost_param_parameters\_ ## __LINE__ ## **name**;
  3314. template <typename A0, …, typename A ## **n**>
  3315. **result** **name**\ (
  3316. A0&& a0, …, A ## **n**\ && a ## **n**
  3317. , typename boost_param_parameters\_ ## __LINE__ ## **name**
  3318. ::match<A0, …, A ## **n**>::type
  3319. = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
  3320. )
  3321. {
  3322. return this->boost_param_impl ## **name**\ (
  3323. boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
  3324. |std_forward|_\<A0>(a0)
  3325. , …
  3326. , |std_forward|_\<A ## **n**>(a ## **n**)
  3327. )
  3328. );
  3329. }
  3330. :vellipsis:`⋮`
  3331. template <typename A0, …, typename A ## **m**>
  3332. **result** **name**\ (
  3333. A0&& a0, …, A ## **m**\ && a ## **m**
  3334. , typename boost_param_parameters\_ ## __LINE__ ## **name**
  3335. ::match<A0, …, A ## **m**>::type
  3336. = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
  3337. )
  3338. {
  3339. return this->boost_param_impl ## **name**\ (
  3340. boost_param_parameters\_ ## __LINE__ ## **name**\ ()(
  3341. |std_forward|_\<A0>(a0)
  3342. , …
  3343. , |std_forward|_\<A ## **m**>(a ## **m**)
  3344. )
  3345. );
  3346. }
  3347. template <typename Args>
  3348. typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type
  3349. boost_param_impl ## **name**\ (Args const& args)
  3350. Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
  3351. available for use within the function body.
  3352. .. |BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION``
  3353. .. _BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION:
  3354. ``BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION(result, name, tag_ns, args)``
  3355. ---------------------------------------------------------------------------
  3356. :Defined in: |preprocessor_header|_
  3357. Generates a member function that can take in positional arguments, composed
  3358. arguments, named arguments, and deduced arguments.
  3359. :Example usage:
  3360. The return type of each of the following function templates falls under a
  3361. different value category.
  3362. .. parsed-literal::
  3363. template <std::size_t N>
  3364. |std_bitset|_\<N + 1> rvalue_bitset()
  3365. {
  3366. return |std_bitset|_\<N + 1>();
  3367. }
  3368. template <std::size_t N>
  3369. |std_bitset|_\<N + 1> const rvalue_const_bitset()
  3370. {
  3371. return |std_bitset|_\<N + 1>();
  3372. }
  3373. template <std::size_t N>
  3374. |std_bitset|_\<N + 1>& lvalue_bitset()
  3375. {
  3376. static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
  3377. return lset;
  3378. }
  3379. template <std::size_t N>
  3380. |std_bitset|_\<N + 1> const& lvalue_const_bitset()
  3381. {
  3382. static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
  3383. return clset;
  3384. }
  3385. The ``U::evaluate_category`` static member function template has a simple job:
  3386. to return the correct value category when passed in an object returned by one
  3387. of the functions defined above. Assume that
  3388. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
  3389. .. parsed-literal::
  3390. enum invoked
  3391. {
  3392. passed_by_lvalue_reference_to_const
  3393. , passed_by_lvalue_reference
  3394. , passed_by_rvalue_reference_to_const
  3395. , passed_by_rvalue_reference
  3396. };
  3397. struct U
  3398. {
  3399. template <std::size_t N>
  3400. static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
  3401. {
  3402. return passed_by_lvalue_reference_to_const;
  3403. }
  3404. template <std::size_t N>
  3405. static invoked evaluate_category(|std_bitset|_\<N + 1>&)
  3406. {
  3407. return passed_by_lvalue_reference;
  3408. }
  3409. template <std::size_t N>
  3410. static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
  3411. {
  3412. return passed_by_rvalue_reference_to_const;
  3413. }
  3414. template <std::size_t N>
  3415. static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
  3416. {
  3417. return passed_by_rvalue_reference;
  3418. }
  3419. };
  3420. Define the named parameters that will comprise the argument specification that
  3421. this macro will use. Ensure that all their tag types are in the same
  3422. namespace, which is ``kw`` in this case. The identifiers with leading
  3423. underscores can be passed to the bracket operator of ``args`` to extract the
  3424. same argument to which the corresponding named parameter (without underscores)
  3425. is bound, as will be shown later.
  3426. .. parsed-literal::
  3427. |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
  3428. |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
  3429. |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
  3430. |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
  3431. Use the macro as a substitute for a normal ``const`` member function
  3432. header. Enclose the return type ``bool`` in parentheses. For each parameter,
  3433. also enclose the expected value type in parentheses. Since the value types
  3434. are mutually exclusive, you can wrap the parameters in a ``(deduced …)``
  3435. clause. Otherwise, just as with a normal function, the order in which you
  3436. specify the parameters determines their position. However, unlike a normal
  3437. function, default values must be specified within the function body. Also
  3438. within the function body, you must pass the matching identifier with the
  3439. leading underscore to the bracket operator of ``args`` to extract the
  3440. corresponding argument, but at least this doesn't require ``std::forward`` to
  3441. preserve value categories.
  3442. .. parsed-literal::
  3443. struct B
  3444. {
  3445. B()
  3446. {
  3447. }
  3448. BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION((bool), evaluate, kw,
  3449. (deduced
  3450. (required
  3451. (lrc, (|std_bitset|_\<1>))
  3452. (lr, (|std_bitset|_\<2>))
  3453. )
  3454. (optional
  3455. (rrc, (|std_bitset|_\<3>))
  3456. (rr, (|std_bitset|_\<4>))
  3457. )
  3458. )
  3459. )
  3460. {
  3461. BOOST_TEST_EQ(
  3462. passed_by_lvalue_reference_to_const
  3463. , U::evaluate_category<0>(args[_lrc])
  3464. );
  3465. BOOST_TEST_EQ(
  3466. passed_by_lvalue_reference
  3467. , U::evaluate_category<1>(args[_lr])
  3468. );
  3469. BOOST_TEST_EQ(
  3470. passed_by_rvalue_reference_to_const
  3471. , U::evaluate_category<2>(
  3472. args[_rrc0 | rvalue_const_bitset<2>()]
  3473. )
  3474. );
  3475. BOOST_TEST_EQ(
  3476. passed_by_rvalue_reference
  3477. , U::evaluate_category<3>(
  3478. args[_rr0 | rvalue_bitset<3>()]
  3479. )
  3480. );
  3481. return true;
  3482. }
  3483. };
  3484. The following function calls are legal.
  3485. .. parsed-literal::
  3486. B const b = B();
  3487. b.evaluate( // positional arguments
  3488. lvalue_const_bitset<0>()
  3489. , lvalue_bitset<1>()
  3490. , rvalue_const_bitset<2>()
  3491. , rvalue_bitset<3>()
  3492. );
  3493. b.evaluate( // positional arguments
  3494. lvalue_const_bitset<0>()
  3495. , lvalue_bitset<1>()
  3496. );
  3497. b.evaluate(( // composed arguments
  3498. _rr0 = rvalue_bitset<3>()
  3499. , _lrc0 = lvalue_const_bitset<0>()
  3500. , _lr0 = lvalue_bitset<1>()
  3501. , _rrc0 = rvalue_const_bitset<2>()
  3502. ));
  3503. b.evaluate( // named arguments
  3504. _rr0 = rvalue_bitset<3>()
  3505. , _lrc0 = lvalue_const_bitset<0>()
  3506. , _lr0 = lvalue_bitset<1>()
  3507. , _rrc0 = rvalue_const_bitset<2>()
  3508. );
  3509. b.evaluate( // named arguments
  3510. _lr0 = lvalue_bitset<1>()
  3511. , _lrc0 = lvalue_const_bitset<0>()
  3512. );
  3513. Because the parameters were wrapped in a ``(deduced …)`` clause, the following
  3514. function calls are also legal.
  3515. .. parsed-literal::
  3516. b.evaluate( // deduced arguments
  3517. rvalue_bitset<3>()
  3518. , lvalue_const_bitset<0>()
  3519. , lvalue_bitset<1>()
  3520. , rvalue_const_bitset<2>()
  3521. );
  3522. b.evaluate( // deduced arguments
  3523. lvalue_bitset<1>()
  3524. , lvalue_const_bitset<0>()
  3525. );
  3526. The |preprocessor_cpp|_ test program demonstrates proper usage of this macro.
  3527. **Macro parameters:**
  3528. * ``result`` is the parenthesized return type of the function.
  3529. * ``name`` is the base name of the function; it determines the name of the
  3530. generated forwarding functions.
  3531. * ``tag_namespace`` is the namespace in which the keywords used by the
  3532. function resides.
  3533. * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
  3534. *argument-specifiers*, as defined below.
  3535. **Argument specifiers syntax:**
  3536. .. parsed-literal::
  3537. argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
  3538. specifier-group0 ::= *specifier-group1* |
  3539. (
  3540. '**(**' '**deduced**'
  3541. *specifier-group1* {*specifier-group1*\ }
  3542. '**)**'
  3543. )
  3544. specifier-group1 ::=
  3545. (
  3546. '**(**' '**optional**'
  3547. *specifier* {*specifier*\ }
  3548. '**)**'
  3549. ) | (
  3550. '**(**' '**required**'
  3551. *specifier* {*specifier*\ }
  3552. '**)**'
  3553. )
  3554. specifier ::=
  3555. '**(**' *argument-name* '**,**' *restriction* ')'
  3556. restriction ::=
  3557. ( '**\***' '**(**' *mfc* '**)**' ) |
  3558. ( '**(**' *type-name* '**)**' ) |
  3559. '**\***'
  3560. * ``argument-name`` is any valid C++ identifier.
  3561. * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
  3562. be the type of the corresponding ``argument-name``, whose second argument
  3563. will be the entire |ArgumentPack|_, and whose return type is a `Boolean
  3564. Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
  3565. of ``previous-name ## _type``.
  3566. * ``type-name`` is either the name of a **target type** or an `MPL Binary
  3567. Metafunction Class`_ whose first argument will be the type of the
  3568. corresponding ``argument-name``, whose second argument will be the entire
  3569. |ArgumentPack|_, and whose return type is the **target type**.
  3570. Note that *specifier* does not include *default-value*. It is up to the
  3571. function body to determine the default value of all optional arguments.
  3572. **Approximate expansion:**
  3573. Where:
  3574. * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
  3575. * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
  3576. .. parsed-literal::
  3577. // If **result** is a template instantiation of |boost_enable_if|_\,
  3578. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  3579. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  3580. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  3581. // |std_enable_if|_\:
  3582. template <typename Args>
  3583. using boost_param_result_const\_ ## __LINE__ ## **name** = **result**;
  3584. // If **result** is a simple return type:
  3585. template <typename Args>
  3586. struct boost_param_result_const\_ ## __LINE__ ## **name**
  3587. {
  3588. typedef **result** type;
  3589. };
  3590. struct boost_param_params_const\_ ## __LINE__ ## **name**
  3591. : |parameters|_\<
  3592. *list of parameter specifications, based on arguments*
  3593. >
  3594. {
  3595. };
  3596. typedef boost_param_params_const\_ ## __LINE__ ## **name**
  3597. boost_param_parameters_const\_ ## __LINE__ ## **name**;
  3598. template <typename A0, …, typename A ## **n**>
  3599. **result** **name**\ (
  3600. A0&& a0, …, A ## **n**\ && a ## **n**
  3601. , typename boost_param_parameters_const\_ ## __LINE__ ## **name**
  3602. ::match<A0, …, A ## **n**>::type
  3603. = boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()
  3604. ) const
  3605. {
  3606. return this->boost_param_impl_const ## __LINE__ ## **name**\ (
  3607. boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()(
  3608. |std_forward|_\<A0>(a0)
  3609. , …
  3610. , |std_forward|_\<A ## **n**>(a ## **n**)
  3611. )
  3612. );
  3613. }
  3614. :vellipsis:`⋮`
  3615. template <typename A0, …, typename A ## **m**>
  3616. **result** **name**\ (
  3617. A0&& a0, …, A ## **m**\ && a ## **m**
  3618. , typename boost_param_parameters_const\_ ## __LINE__ ## **name**
  3619. ::match<A0, …, A ## **m**>::type
  3620. = boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()
  3621. ) const
  3622. {
  3623. return this->boost_param_impl_const ## __LINE__ ## **name**\ (
  3624. boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()(
  3625. |std_forward|_\<A0>(a0)
  3626. , …
  3627. , |std_forward|_\<A ## **m**>(a ## **m**)
  3628. )
  3629. );
  3630. }
  3631. template <typename Args>
  3632. typename boost_param_result_const\_ ## __LINE__ ## **name**\ <Args>::type
  3633. boost_param_impl_const ## __LINE__ ## **name**\ (Args const& args) const
  3634. Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
  3635. available for use within the function body.
  3636. .. |BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR``
  3637. .. _BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR:
  3638. ``BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR(result, tag_ns, arguments)``
  3639. ---------------------------------------------------------------------------
  3640. :Defined in: |preprocessor_header|_
  3641. Generates a function call operator that can take in positional arguments,
  3642. composed arguments, named arguments, and deduced arguments.
  3643. :Example usage:
  3644. Define the named parameters that will comprise the argument specification that
  3645. this macro will use. Ensure that all their tag types are in the same
  3646. namespace, which is ``tag`` by default.
  3647. .. parsed-literal::
  3648. |BOOST_PARAMETER_NAME|_\(y)
  3649. |BOOST_PARAMETER_NAME|_\(z)
  3650. Use the macro as a substitute for a normal function call operator
  3651. header. Enclose the return type in parentheses. For each parameter, also
  3652. enclose the expected value type in parentheses. Since the value types are
  3653. mutually exclusive, you can wrap the parameters in a ``(deduced …)``
  3654. clause. This is especially useful when implementing multiple
  3655. Boost.Parameter-enabled function call operator overloads.
  3656. .. parsed-literal::
  3657. class char_reader
  3658. {
  3659. int index;
  3660. char const* key;
  3661. public:
  3662. explicit char_reader(char const* k) : index(0), key(k)
  3663. {
  3664. }
  3665. BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR((void), tag,
  3666. (deduced
  3667. (required
  3668. (y, (int))
  3669. (z, (char const*))
  3670. )
  3671. )
  3672. )
  3673. {
  3674. this->index = args[_y];
  3675. this->key = args[_z];
  3676. }
  3677. |BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR|_\((char), tag,
  3678. (deduced
  3679. (required
  3680. (y, (bool))
  3681. (z, (|std_map|_\<char const*, |std_string|_\>))
  3682. )
  3683. )
  3684. )
  3685. {
  3686. return args[_y] ? (
  3687. (args[_z].find(this->key)->second)[this->index]
  3688. ) : this->key[this->index];
  3689. }
  3690. };
  3691. As with regular argument-dependent lookup, the value types of the arguments
  3692. passed in determine which function call operator overload gets invoked.
  3693. .. parsed-literal::
  3694. char const* keys[] = {"foo", "bar", "baz"};
  3695. |std_map|_\<char const*, |std_string|_\> k2s;
  3696. k2s[keys[0]] = |std_string|_\("qux");
  3697. k2s[keys[1]] = |std_string|_\("wmb");
  3698. k2s[keys[2]] = |std_string|_\("zxc");
  3699. char_reader r(keys[0]);
  3700. // positional arguments
  3701. BOOST_TEST_EQ('q', (r(true, k2s)));
  3702. BOOST_TEST_EQ('f', (r(false, k2s)));
  3703. // named arguments
  3704. r(_z = keys[1], _y = 1);
  3705. BOOST_TEST_EQ('m', (r(_z = k2s, _y = true)));
  3706. BOOST_TEST_EQ('a', (r(_z = k2s, _y = false)));
  3707. // deduced arguments
  3708. r(keys[2], 2);
  3709. BOOST_TEST_EQ('c', (r(k2s, true)));
  3710. BOOST_TEST_EQ('z', (r(k2s, false)));
  3711. The |preprocessor_cpp|_ test program demonstrates proper usage of this macro.
  3712. **Macro parameters:**
  3713. * ``result`` is the parenthesized return type of the function call operator.
  3714. * ``tag_namespace`` is the namespace in which the keywords used by the
  3715. function call operator resides.
  3716. * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
  3717. *argument-specifiers*, as defined below.
  3718. **Argument specifiers syntax:**
  3719. .. parsed-literal::
  3720. argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
  3721. specifier-group0 ::= *specifier-group1* |
  3722. (
  3723. '**(**' '**deduced**'
  3724. *specifier-group1* {*specifier-group1*\ }
  3725. '**)**'
  3726. )
  3727. specifier-group1 ::=
  3728. (
  3729. '**(**' '**optional**'
  3730. *specifier* {*specifier*\ }
  3731. '**)**'
  3732. ) | (
  3733. '**(**' '**required**'
  3734. *specifier* {*specifier*\ }
  3735. '**)**'
  3736. )
  3737. specifier ::=
  3738. '**(**' *argument-name* '**,**' *restriction* ')'
  3739. restriction ::=
  3740. ( '**\***' '**(**' *mfc* '**)**' ) |
  3741. ( '**(**' *type-name* '**)**' ) |
  3742. '**\***'
  3743. * ``argument-name`` is any valid C++ identifier.
  3744. * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
  3745. be the type of the corresponding ``argument-name``, whose second argument
  3746. will be the entire |ArgumentPack|_, and whose return type is a `Boolean
  3747. Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
  3748. of ``previous-name ## _type``.
  3749. * ``type-name`` is either the name of a **target type** or an `MPL Binary
  3750. Metafunction Class`_ whose first argument will be the type of the
  3751. corresponding ``argument-name``, whose second argument will be the entire
  3752. |ArgumentPack|_, and whose return type is the **target type**.
  3753. Note that *specifier* does not include *default-value*. It is up to the
  3754. function body to determine the default value of all optional arguments.
  3755. **Approximate expansion:**
  3756. Where:
  3757. * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
  3758. * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
  3759. .. parsed-literal::
  3760. // If **result** is a template instantiation of |boost_enable_if|_\,
  3761. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  3762. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  3763. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  3764. // |std_enable_if|_\:
  3765. template <typename Args>
  3766. using boost_param_result\_ ## __LINE__ ## operator = **result**;
  3767. // If **result** is a simple return type:
  3768. template <typename Args>
  3769. struct boost_param_result\_ ## __LINE__ ## operator
  3770. {
  3771. typedef **result** type;
  3772. };
  3773. struct boost_param_params\_ ## __LINE__ ## operator
  3774. : |parameters|_\<
  3775. *list of parameter specifications, based on arguments*
  3776. >
  3777. {
  3778. };
  3779. typedef boost_param_params\_ ## __LINE__ ## operator
  3780. boost_param_parameters\_ ## __LINE__ ## operator;
  3781. template <typename A0, …, typename A ## **n**>
  3782. **result** operator()(
  3783. A0&& a0, …, A ## **n**\ && a ## **n**
  3784. , typename boost_param_parameters\_ ## __LINE__ ## operator::match<
  3785. A0, …, A ## **n**
  3786. >::type = boost_param_parameters\_ ## __LINE__ ## operator()
  3787. )
  3788. {
  3789. return this->boost_param_impl ## __LINE__ ## operator(
  3790. boost_param_parameters\_ ## __LINE__ ## operator()(
  3791. |std_forward|_\<A0>(a0)
  3792. , …
  3793. , |std_forward|_\<A ## **n**>(a ## **n**)
  3794. )
  3795. );
  3796. }
  3797. :vellipsis:`⋮`
  3798. template <typename A0, …, typename A ## **m**>
  3799. **result** operator()(
  3800. A0&& a0, …, A ## **m**\ && a ## **m**
  3801. , typename boost_param_parameters\_ ## __LINE__ ## operator::match<
  3802. A0, …, A ## **m**
  3803. >::type = boost_param_parameters\_ ## __LINE__ ## operator()
  3804. )
  3805. {
  3806. return this->boost_param_impl ## __LINE__ ## operator(
  3807. boost_param_parameters\_ ## __LINE__ ## operator()(
  3808. |std_forward|_\<A0>(a0)
  3809. , …
  3810. , |std_forward|_\<A ## **m**>(a ## **m**)
  3811. )
  3812. );
  3813. }
  3814. template <typename Args>
  3815. typename boost_param_result\_ ## __LINE__ ## operator<Args>::type
  3816. boost_param_impl ## __LINE__ ## operator(Args const& args)
  3817. Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
  3818. available for use within the function call operator body.
  3819. .. |BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR``
  3820. .. _BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR:
  3821. ``BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, args)``
  3822. ----------------------------------------------------------------------------
  3823. :Defined in: |preprocessor_header|_
  3824. Generates a function call operator that can take in positional arguments,
  3825. composed arguments, named arguments, and deduced arguments.
  3826. :Example usage:
  3827. The return type of each of the following function templates falls under a
  3828. different value category.
  3829. .. parsed-literal::
  3830. template <std::size_t N>
  3831. |std_bitset|_\<N + 1> rvalue_bitset()
  3832. {
  3833. return |std_bitset|_\<N + 1>();
  3834. }
  3835. template <std::size_t N>
  3836. |std_bitset|_\<N + 1> const rvalue_const_bitset()
  3837. {
  3838. return |std_bitset|_\<N + 1>();
  3839. }
  3840. template <std::size_t N>
  3841. |std_bitset|_\<N + 1>& lvalue_bitset()
  3842. {
  3843. static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
  3844. return lset;
  3845. }
  3846. template <std::size_t N>
  3847. |std_bitset|_\<N + 1> const& lvalue_const_bitset()
  3848. {
  3849. static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
  3850. return clset;
  3851. }
  3852. The ``U::evaluate_category`` static member function template has a simple job:
  3853. to return the correct value category when passed in an object returned by one
  3854. of the functions defined above. Assume that
  3855. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
  3856. .. parsed-literal::
  3857. enum invoked
  3858. {
  3859. passed_by_lvalue_reference_to_const
  3860. , passed_by_lvalue_reference
  3861. , passed_by_rvalue_reference_to_const
  3862. , passed_by_rvalue_reference
  3863. };
  3864. struct U
  3865. {
  3866. template <std::size_t N>
  3867. static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
  3868. {
  3869. return passed_by_lvalue_reference_to_const;
  3870. }
  3871. template <std::size_t N>
  3872. static invoked evaluate_category(|std_bitset|_\<N + 1>&)
  3873. {
  3874. return passed_by_lvalue_reference;
  3875. }
  3876. template <std::size_t N>
  3877. static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
  3878. {
  3879. return passed_by_rvalue_reference_to_const;
  3880. }
  3881. template <std::size_t N>
  3882. static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
  3883. {
  3884. return passed_by_rvalue_reference;
  3885. }
  3886. };
  3887. Define the named parameters that will comprise the argument specification that
  3888. this macro will use. Ensure that all their tag types are in the same
  3889. namespace, which is ``kw`` in this case. The identifiers with leading
  3890. underscores can be passed to the bracket operator of ``args`` to extract the
  3891. same argument to which the corresponding named parameter (without underscores)
  3892. is bound, as will be shown later.
  3893. .. parsed-literal::
  3894. |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc))
  3895. |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr))
  3896. |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc))
  3897. |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr))
  3898. Use the macro as a substitute for a normal ``const`` function call operator
  3899. header. Enclose the return type ``bool`` in parentheses. For each parameter,
  3900. also enclose the expected value type in parentheses. Since the value types
  3901. are mutually exclusive, you can wrap the parameters in a ``(deduced …)``
  3902. clause. Otherwise, just as with a normal function, the order in which you
  3903. specify the parameters determines their position. However, unlike a normal
  3904. function, default values must be specified within the function body. Also
  3905. within the function body, you must pass the matching identifier with the
  3906. leading underscore to the bracket operator of ``args`` to extract the
  3907. corresponding argument, but at least this doesn't require ``std::forward`` to
  3908. preserve value categories.
  3909. .. parsed-literal::
  3910. struct B
  3911. {
  3912. B()
  3913. {
  3914. }
  3915. BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR((bool), kw,
  3916. (deduced
  3917. (required
  3918. (lrc, (|std_bitset|_\<1>))
  3919. (lr, (|std_bitset|_\<2>))
  3920. )
  3921. (optional
  3922. (rrc, (|std_bitset|_\<3>))
  3923. (rr, (|std_bitset|_\<4>))
  3924. )
  3925. )
  3926. )
  3927. {
  3928. BOOST_TEST_EQ(
  3929. passed_by_lvalue_reference_to_const
  3930. , U::evaluate_category<0>(args[_lrc])
  3931. );
  3932. BOOST_TEST_EQ(
  3933. passed_by_lvalue_reference
  3934. , U::evaluate_category<1>(args[_lr])
  3935. );
  3936. BOOST_TEST_EQ(
  3937. passed_by_rvalue_reference_to_const
  3938. , U::evaluate_category<2>(
  3939. args[_rrc0 | rvalue_const_bitset<2>()]
  3940. )
  3941. );
  3942. BOOST_TEST_EQ(
  3943. passed_by_rvalue_reference
  3944. , U::evaluate_category<3>(
  3945. args[_rr0 | rvalue_bitset<3>()]
  3946. )
  3947. );
  3948. return true;
  3949. }
  3950. };
  3951. The following function calls are legal.
  3952. .. parsed-literal::
  3953. B const b = B();
  3954. b( // positional arguments
  3955. lvalue_const_bitset<0>()
  3956. , lvalue_bitset<1>()
  3957. , rvalue_const_bitset<2>()
  3958. , rvalue_bitset<3>()
  3959. );
  3960. b( // positional arguments
  3961. lvalue_const_bitset<0>()
  3962. , lvalue_bitset<1>()
  3963. );
  3964. b(( // composed arguments
  3965. _rr0 = rvalue_bitset<3>()
  3966. , _lrc0 = lvalue_const_bitset<0>()
  3967. , _lr0 = lvalue_bitset<1>()
  3968. , _rrc0 = rvalue_const_bitset<2>()
  3969. ));
  3970. b( // named arguments
  3971. _rr0 = rvalue_bitset<3>()
  3972. , _lrc0 = lvalue_const_bitset<0>()
  3973. , _lr0 = lvalue_bitset<1>()
  3974. , _rrc0 = rvalue_const_bitset<2>()
  3975. );
  3976. b( // named arguments
  3977. _lr0 = lvalue_bitset<1>()
  3978. , _lrc0 = lvalue_const_bitset<0>()
  3979. );
  3980. Because the parameters were wrapped in a ``(deduced …)`` clause, the following
  3981. function calls are also legal.
  3982. .. parsed-literal::
  3983. b( // deduced arguments
  3984. rvalue_bitset<3>()
  3985. , lvalue_const_bitset<0>()
  3986. , lvalue_bitset<1>()
  3987. , rvalue_const_bitset<2>()
  3988. );
  3989. b( // deduced arguments
  3990. lvalue_bitset<1>()
  3991. , lvalue_const_bitset<0>()
  3992. );
  3993. The |preprocessor_cpp|_ test program demonstrates proper usage of this macro.
  3994. **Macro parameters:**
  3995. * ``result`` is the parenthesized return type of the function call operator.
  3996. * ``tag_namespace`` is the namespace in which the keywords used by the
  3997. function call operator resides.
  3998. * ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of
  3999. *argument-specifiers*, as defined below.
  4000. **Argument specifiers syntax:**
  4001. .. parsed-literal::
  4002. argument-specifiers ::= *specifier-group0* {*specifier-group0*\ }
  4003. specifier-group0 ::= *specifier-group1* |
  4004. (
  4005. '**(**' '**deduced**'
  4006. *specifier-group1* {*specifier-group1*\ }
  4007. '**)**'
  4008. )
  4009. specifier-group1 ::=
  4010. (
  4011. '**(**' '**optional**'
  4012. *specifier* {*specifier*\ }
  4013. '**)**'
  4014. ) | (
  4015. '**(**' '**required**'
  4016. *specifier* {*specifier*\ }
  4017. '**)**'
  4018. )
  4019. specifier ::=
  4020. '**(**' *argument-name* '**,**' *restriction* ')'
  4021. restriction ::=
  4022. ( '**\***' '**(**' *mfc* '**)**' ) |
  4023. ( '**(**' *type-name* '**)**' ) |
  4024. '**\***'
  4025. * ``argument-name`` is any valid C++ identifier.
  4026. * ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will
  4027. be the type of the corresponding ``argument-name``, whose second argument
  4028. will be the entire |ArgumentPack|_, and whose return type is a `Boolean
  4029. Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms
  4030. of ``previous-name ## _type``.
  4031. * ``type-name`` is either the name of a **target type** or an `MPL Binary
  4032. Metafunction Class`_ whose first argument will be the type of the
  4033. corresponding ``argument-name``, whose second argument will be the entire
  4034. |ArgumentPack|_, and whose return type is the **target type**.
  4035. Note that *specifier* does not include *default-value*. It is up to the
  4036. function body to determine the default value of all optional arguments.
  4037. **Approximate expansion:**
  4038. Where:
  4039. * ``n`` denotes the *minimum* arity, as determined from ``arguments``.
  4040. * ``m`` denotes the *maximum* arity, as determined from ``arguments``.
  4041. .. parsed-literal::
  4042. // If **result** is a template instantiation of |boost_enable_if|_\,
  4043. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  4044. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  4045. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  4046. // |std_enable_if|_\:
  4047. template <typename Args>
  4048. using boost_param_result_const\_ ## __LINE__ ## operator = **result**;
  4049. // If **result** is a simple return type:
  4050. template <typename Args>
  4051. struct boost_param_result_const\_ ## __LINE__ ## operator
  4052. {
  4053. typedef **result** type;
  4054. };
  4055. struct boost_param_params_const\_ ## __LINE__ ## operator
  4056. : |parameters|_\<
  4057. *list of parameter specifications, based on arguments*
  4058. >
  4059. {
  4060. };
  4061. typedef boost_param_params_const\_ ## __LINE__ ## operator
  4062. boost_param_parameters_const\_ ## __LINE__ ## operator;
  4063. template <typename A0, …, typename A ## **n**>
  4064. **result** operator()(
  4065. A0&& a0, …, A ## **n**\ && a ## **n**
  4066. , typename boost_param_parameters_const\_ ## __LINE__ ## operator
  4067. ::match<A0, …, A ## **n**>::type
  4068. = boost_param_parameters_const\_ ## __LINE__ ## operator()
  4069. ) const
  4070. {
  4071. return this->boost_param_impl_const ## __LINE__ ## operator(
  4072. boost_param_parameters_const\_ ## __LINE__ ## operator()(
  4073. |std_forward|_\<A0>(a0)
  4074. , …
  4075. , |std_forward|_\<A ## **n**>(a ## **n**)
  4076. )
  4077. );
  4078. }
  4079. :vellipsis:`⋮`
  4080. template <typename A0, …, typename A ## **m**>
  4081. **result** operator()(
  4082. A0&& a0, …, A ## **m**\ && a ## **m**
  4083. , typename boost_param_parameters_const\_ ## __LINE__ ## operator
  4084. ::match<A0, …, A ## **m**>::type
  4085. = boost_param_parameters_const\_ ## __LINE__ ## operator()
  4086. ) const
  4087. {
  4088. return this->boost_param_impl_const ## __LINE__ ## operator(
  4089. boost_param_parameters_const\_ ## __LINE__ ## operator()(
  4090. |std_forward|_\<A0>(a0)
  4091. , …
  4092. , |std_forward|_\<A ## **m**>(a ## **m**)
  4093. )
  4094. );
  4095. }
  4096. template <typename Args>
  4097. typename boost_param_result_const\_ ## __LINE__ ## operator<Args>::type
  4098. boost_param_impl_const ## __LINE__ ## operator(Args const& args) const
  4099. Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
  4100. available for use within the function call operator body.
  4101. .. |BOOST_PARAMETER_NO_SPEC_FUNCTION| replace:: ``BOOST_PARAMETER_NO_SPEC_FUNCTION``
  4102. .. _BOOST_PARAMETER_NO_SPEC_FUNCTION:
  4103. ``BOOST_PARAMETER_NO_SPEC_FUNCTION(result, name)``
  4104. --------------------------------------------------
  4105. :Defined in: |preprocessor_no_spec_header|_
  4106. Generates a function that can take in named arguments.
  4107. :Example usage:
  4108. The return type of each of the following function templates falls under a
  4109. different value category.
  4110. .. parsed-literal::
  4111. template <std::size_t N>
  4112. |std_bitset|_\<N + 1> rvalue_bitset()
  4113. {
  4114. return |std_bitset|_\<N + 1>();
  4115. }
  4116. template <std::size_t N>
  4117. |std_bitset|_\<N + 1> const rvalue_const_bitset()
  4118. {
  4119. return |std_bitset|_\<N + 1>();
  4120. }
  4121. template <std::size_t N>
  4122. |std_bitset|_\<N + 1>& lvalue_bitset()
  4123. {
  4124. static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
  4125. return lset;
  4126. }
  4127. template <std::size_t N>
  4128. |std_bitset|_\<N + 1> const& lvalue_const_bitset()
  4129. {
  4130. static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
  4131. return clset;
  4132. }
  4133. The ``U::evaluate_category`` static member function template has a simple job:
  4134. to return the correct value category when passed in an object returned by one
  4135. of the functions defined above. Assume that
  4136. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
  4137. .. parsed-literal::
  4138. enum invoked
  4139. {
  4140. passed_by_lvalue_reference_to_const
  4141. , passed_by_lvalue_reference
  4142. , passed_by_rvalue_reference_to_const
  4143. , passed_by_rvalue_reference
  4144. };
  4145. struct U
  4146. {
  4147. template <std::size_t N>
  4148. static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
  4149. {
  4150. return passed_by_lvalue_reference_to_const;
  4151. }
  4152. template <std::size_t N>
  4153. static invoked evaluate_category(|std_bitset|_\<N + 1>&)
  4154. {
  4155. return passed_by_lvalue_reference;
  4156. }
  4157. template <std::size_t N>
  4158. static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
  4159. {
  4160. return passed_by_rvalue_reference_to_const;
  4161. }
  4162. template <std::size_t N>
  4163. static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
  4164. {
  4165. return passed_by_rvalue_reference;
  4166. }
  4167. };
  4168. Named parameters are required when invoking the function; however, none of
  4169. their tags need to be in the same namespace.
  4170. .. parsed-literal::
  4171. |BOOST_PARAMETER_NAME|_\((_lrc, kw0) in(lrc))
  4172. |BOOST_PARAMETER_NAME|_\((_lr, kw1) in_out(lr))
  4173. |BOOST_PARAMETER_NAME|_\((_rrc, kw2) in(rrc))
  4174. |BOOST_PARAMETER_NAME|_\((_rr, kw3) consume(rr))
  4175. Use the macro as a substitute for a variadic function header. Enclose the
  4176. return type ``bool`` in parentheses.
  4177. .. parsed-literal::
  4178. BOOST_PARAMETER_NO_SPEC_FUNCTION((bool), evaluate)
  4179. {
  4180. BOOST_TEST_EQ(
  4181. passed_by_lvalue_reference_to_const
  4182. , U::evaluate_category<0>(args[_lrc])
  4183. );
  4184. BOOST_TEST_EQ(
  4185. passed_by_lvalue_reference
  4186. , U::evaluate_category<1>(args[_lr])
  4187. );
  4188. BOOST_TEST_EQ(
  4189. passed_by_rvalue_reference_to_const
  4190. , U::evaluate_category<2>(
  4191. args[_rrc | rvalue_const_bitset<2>()]
  4192. )
  4193. );
  4194. BOOST_TEST_EQ(
  4195. passed_by_rvalue_reference
  4196. , U::evaluate_category<3>(args[_rr | rvalue_bitset<3>()])
  4197. );
  4198. return true;
  4199. }
  4200. To invoke the function, bind all its arguments to named parameters.
  4201. .. parsed-literal::
  4202. evaluate(
  4203. _rr0 = rvalue_bitset<3>()
  4204. , _lrc0 = lvalue_const_bitset<0>()
  4205. , _lr0 = lvalue_bitset<1>()
  4206. , _rrc0 = rvalue_const_bitset<2>()
  4207. );
  4208. evaluate(
  4209. _lr0 = lvalue_bitset<1>()
  4210. , _lrc0 = lvalue_const_bitset<0>()
  4211. );
  4212. The |preproc_eval_cat_no_spec_cpp|_ test program demonstrates proper usage of
  4213. this macro.
  4214. **Macro parameters:**
  4215. * ``result`` is the parenthesized return type of the function.
  4216. * ``name`` is the base name of the function; it determines the name of the
  4217. generated implementation function.
  4218. **Argument specifiers syntax:**
  4219. None.
  4220. **Approximate expansion:**
  4221. .. parsed-literal::
  4222. // If **result** is a template instantiation of |boost_enable_if|_\,
  4223. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  4224. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  4225. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  4226. // |std_enable_if|_\:
  4227. template <typename TaggedArg0, typename ...TaggedArgs>
  4228. using boost_param_no_spec_result\_ ## __LINE__ ## **name** = **result**;
  4229. // If **result** is a simple return type:
  4230. template <typename TaggedArg0, typename ...TaggedArgs>
  4231. struct boost_param_no_spec_result\_ ## __LINE__ ## **name**
  4232. {
  4233. typedef **result** type;
  4234. };
  4235. template <typename ResultType, typename Args>
  4236. ResultType
  4237. boost_param_no_spec_impl ## __LINE__ ## **name**\ (
  4238. (ResultType(*)())
  4239. , Args const& args
  4240. );
  4241. template <typename TaggedArg0, typename ...TaggedArgs>
  4242. inline typename |boost_lazy_enable_if|_\<
  4243. |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...>
  4244. , boost_param_no_spec_result\_ ## __LINE__ ## **name**\ <
  4245. TaggedArg0
  4246. , TaggedArgs...
  4247. >
  4248. >::type
  4249. **name**\ (TaggedArg0 const& arg0, TaggedArgs const&... args)
  4250. {
  4251. return boost_param_no_spec_impl ## __LINE__ ## **name**\ (
  4252. static_cast<
  4253. typename
  4254. boost_param_no_spec_result\_ ## __LINE__ ## **name**\ <
  4255. TaggedArg0
  4256. , TaggedArgs...
  4257. >::type(*)()
  4258. >(|std_nullptr|_\)
  4259. , |compose|_\(arg0, args...)
  4260. );
  4261. }
  4262. template <typename ResultType, typename Args>
  4263. ResultType
  4264. boost_param_no_spec_impl ## __LINE__ ## **name**\ (
  4265. (ResultType(*)())
  4266. , Args const& args
  4267. )
  4268. Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
  4269. available for use within the function body.
  4270. .. |BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION``
  4271. .. _BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION:
  4272. ``BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION(result, name)``
  4273. ---------------------------------------------------------
  4274. :Defined in: |preprocessor_no_spec_header|_
  4275. Generates a member function that can take in named arguments.
  4276. :Example usage:
  4277. When designing a front-end class template whose back-end is configurable via
  4278. parameterized inheritance, it can be useful to omit argument specifiers from
  4279. a named-parameter member function so that the delegate member functions of the
  4280. back-end classes can enforce their own specifications.
  4281. .. parsed-literal::
  4282. template <typename B>
  4283. struct frontend : B
  4284. {
  4285. frontend() : B()
  4286. {
  4287. }
  4288. BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION((void), initialize)
  4289. {
  4290. this->initialize_impl(args);
  4291. }
  4292. };
  4293. Named parameters are required when invoking the member function; however, none
  4294. of their tags need to be in the same namespace.
  4295. .. parsed-literal::
  4296. |BOOST_PARAMETER_NAME|_\(a0)
  4297. |BOOST_PARAMETER_NAME|_\(a1)
  4298. |BOOST_PARAMETER_NAME|_\(a2)
  4299. For this example, each of the back-end class templates requires its own
  4300. parameter to be present in the argument pack. In practice, such parameters
  4301. should be optional, with default values.
  4302. .. parsed-literal::
  4303. template <typename T>
  4304. class backend0
  4305. {
  4306. T a0;
  4307. public:
  4308. backend0() : a0()
  4309. {
  4310. }
  4311. T const& get_a0() const
  4312. {
  4313. return this->a0;
  4314. }
  4315. protected:
  4316. template <typename ArgPack>
  4317. void initialize_impl(ArgPack const& args)
  4318. {
  4319. this->a0 = args[_a0];
  4320. }
  4321. };
  4322. template <typename B, typename T>
  4323. class backend1 : public B
  4324. {
  4325. T a1;
  4326. public:
  4327. backend1() : B(), a1()
  4328. {
  4329. }
  4330. T const& get_a1() const
  4331. {
  4332. return this->a1;
  4333. }
  4334. protected:
  4335. template <typename ArgPack>
  4336. void initialize_impl(ArgPack const& args)
  4337. {
  4338. B::initialize_impl(args);
  4339. this->a1 = args[_a1];
  4340. }
  4341. };
  4342. template <typename B, typename T>
  4343. class backend2 : public B
  4344. {
  4345. T a2;
  4346. public:
  4347. backend2() : B(), a2()
  4348. {
  4349. }
  4350. T const& get_a2() const
  4351. {
  4352. return this->a2;
  4353. }
  4354. protected:
  4355. template <typename ArgPack>
  4356. void initialize_impl(ArgPack const& args)
  4357. {
  4358. B::initialize_impl(args);
  4359. this->a2 = args[_a2];
  4360. }
  4361. };
  4362. This example shows that while ``backend0`` must always be the root base class
  4363. template and that ``frontend`` must always be the most derived class template,
  4364. the other back-ends can be chained together in different orders.
  4365. .. parsed-literal::
  4366. char const* p = "foo";
  4367. frontend<
  4368. backend2<backend1<backend0<char const*>, char>, int>
  4369. > composed_obj0;
  4370. frontend<
  4371. backend1<backend2<backend0<char const*>, int>, char>
  4372. > composed_obj1;
  4373. composed_obj0.initialize(_a2 = 4, _a1 = ' ', _a0 = p);
  4374. composed_obj1.initialize(_a0 = p, _a1 = ' ', _a2 = 4);
  4375. BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
  4376. BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
  4377. BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
  4378. The |parameterized_inheritance_cpp|_ and |preproc_eval_cat_no_spec_cpp|_ test
  4379. programs demonstrate proper usage of this macro.
  4380. **Macro parameters:**
  4381. * ``result`` is the parenthesized return type of the function.
  4382. * ``name`` is the base name of the function; it determines the name of the
  4383. generated implementation function. ``name`` may be qualified by the
  4384. ``static`` keyword to declare the member function and its helpers as not
  4385. associated with any object of the enclosing type.
  4386. **Argument specifiers syntax:**
  4387. None.
  4388. **Approximate expansion:**
  4389. .. parsed-literal::
  4390. // If **result** is a template instantiation of |boost_enable_if|_\,
  4391. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  4392. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  4393. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  4394. // |std_enable_if|_\:
  4395. template <typename TaggedArg0, typename ...TaggedArgs>
  4396. using boost_param_no_spec_result\_ ## __LINE__ ## **name** = **result**;
  4397. // If **result** is a simple return type:
  4398. template <typename TaggedArg0, typename ...TaggedArgs>
  4399. struct boost_param_no_spec_result\_ ## __LINE__ ## **name**
  4400. {
  4401. typedef **result** type;
  4402. };
  4403. template <typename TaggedArg0, typename ...TaggedArgs>
  4404. inline typename |boost_lazy_enable_if|_\<
  4405. |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...>
  4406. , boost_param_no_spec_result\_ ## __LINE__ ## **name**\ <
  4407. TaggedArg0
  4408. , TaggedArgs...
  4409. >
  4410. >::type
  4411. **name**\ (TaggedArg0 const& arg0, TaggedArgs const&... args)
  4412. {
  4413. return this->boost_param_no_spec_impl ## __LINE__ ## **name**\ (
  4414. static_cast<
  4415. typename
  4416. boost_param_no_spec_result\_ ## __LINE__ ## **name**\ <
  4417. TaggedArg0
  4418. , TaggedArgs...
  4419. >::type(*)()
  4420. >(|std_nullptr|_\)
  4421. , |compose|_\(arg0, args...)
  4422. );
  4423. }
  4424. template <typename ResultType, typename Args>
  4425. ResultType
  4426. boost_param_no_spec_impl ## __LINE__ ## **name**\ (
  4427. (ResultType(*)())
  4428. , Args const& args
  4429. )
  4430. Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
  4431. available for use within the function body.
  4432. .. |BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION``
  4433. .. _BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION:
  4434. ``BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION(result, name)``
  4435. ---------------------------------------------------------------
  4436. :Defined in: |preprocessor_no_spec_header|_
  4437. Generates a member function that can take in named arguments.
  4438. :Example usage:
  4439. The return type of each of the following function templates falls under a
  4440. different value category.
  4441. .. parsed-literal::
  4442. template <std::size_t N>
  4443. |std_bitset|_\<N + 1> rvalue_bitset()
  4444. {
  4445. return |std_bitset|_\<N + 1>();
  4446. }
  4447. template <std::size_t N>
  4448. |std_bitset|_\<N + 1> const rvalue_const_bitset()
  4449. {
  4450. return |std_bitset|_\<N + 1>();
  4451. }
  4452. template <std::size_t N>
  4453. |std_bitset|_\<N + 1>& lvalue_bitset()
  4454. {
  4455. static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
  4456. return lset;
  4457. }
  4458. template <std::size_t N>
  4459. |std_bitset|_\<N + 1> const& lvalue_const_bitset()
  4460. {
  4461. static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
  4462. return clset;
  4463. }
  4464. The ``U::evaluate_category`` static member function template has a simple job:
  4465. to return the correct value category when passed in an object returned by one
  4466. of the functions defined above. Assume that
  4467. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
  4468. .. parsed-literal::
  4469. enum invoked
  4470. {
  4471. passed_by_lvalue_reference_to_const
  4472. , passed_by_lvalue_reference
  4473. , passed_by_rvalue_reference_to_const
  4474. , passed_by_rvalue_reference
  4475. };
  4476. struct U
  4477. {
  4478. template <std::size_t N>
  4479. static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
  4480. {
  4481. return passed_by_lvalue_reference_to_const;
  4482. }
  4483. template <std::size_t N>
  4484. static invoked evaluate_category(|std_bitset|_\<N + 1>&)
  4485. {
  4486. return passed_by_lvalue_reference;
  4487. }
  4488. template <std::size_t N>
  4489. static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
  4490. {
  4491. return passed_by_rvalue_reference_to_const;
  4492. }
  4493. template <std::size_t N>
  4494. static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
  4495. {
  4496. return passed_by_rvalue_reference;
  4497. }
  4498. };
  4499. Named parameters are required when invoking the member function; however, none
  4500. of their tags need to be in the same namespace.
  4501. .. parsed-literal::
  4502. |BOOST_PARAMETER_NAME|_\((_lrc, kw0) in(lrc))
  4503. |BOOST_PARAMETER_NAME|_\((_lr, kw1) in_out(lr))
  4504. |BOOST_PARAMETER_NAME|_\((_rrc, kw2) in(rrc))
  4505. |BOOST_PARAMETER_NAME|_\((_rr, kw3) consume(rr))
  4506. Use the macro as a substitute for a variadic function header. Enclose the
  4507. return type ``bool`` in parentheses. The macro will qualify the function with
  4508. the ``const`` keyword.
  4509. .. parsed-literal::
  4510. struct D
  4511. {
  4512. D()
  4513. {
  4514. }
  4515. BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION((bool), evaluate_m)
  4516. {
  4517. BOOST_TEST_EQ(
  4518. passed_by_lvalue_reference_to_const
  4519. , U::evaluate_category<0>(args[_lrc])
  4520. );
  4521. BOOST_TEST_EQ(
  4522. passed_by_lvalue_reference
  4523. , U::evaluate_category<1>(args[_lr])
  4524. );
  4525. BOOST_TEST_EQ(
  4526. passed_by_rvalue_reference_to_const
  4527. , U::evaluate_category<2>(
  4528. args[_rrc | rvalue_const_bitset<2>()]
  4529. )
  4530. );
  4531. BOOST_TEST_EQ(
  4532. passed_by_rvalue_reference
  4533. , U::evaluate_category<3>(
  4534. args[_rr | rvalue_bitset<3>()]
  4535. )
  4536. );
  4537. return true;
  4538. }
  4539. };
  4540. To invoke the member function, bind all its arguments to named parameters.
  4541. .. parsed-literal::
  4542. D const d = D();
  4543. d.evaluate_m(
  4544. _rr0 = rvalue_bitset<3>()
  4545. , _lrc0 = lvalue_const_bitset<0>()
  4546. , _lr0 = lvalue_bitset<1>()
  4547. , _rrc0 = rvalue_const_bitset<2>()
  4548. );
  4549. d.evaluate_m(
  4550. _lr0 = lvalue_bitset<1>()
  4551. , _lrc0 = lvalue_const_bitset<0>()
  4552. );
  4553. The |preproc_eval_cat_no_spec_cpp|_ test program demonstrates proper usage of
  4554. this macro.
  4555. **Macro parameters:**
  4556. * ``result`` is the parenthesized return type of the function.
  4557. * ``name`` is the base name of the function; it determines the name of the
  4558. generated implementation function.
  4559. **Argument specifiers syntax:**
  4560. None.
  4561. **Approximate expansion:**
  4562. .. parsed-literal::
  4563. // If **result** is a template instantiation of |boost_enable_if|_\,
  4564. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  4565. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  4566. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  4567. // |std_enable_if|_\:
  4568. template <typename TaggedArg0, typename ...TaggedArgs>
  4569. using boost_param_no_spec_result_const\_ ## __LINE__ ## **name** = **result**;
  4570. // If **result** is a simple return type:
  4571. template <typename TaggedArg0, typename ...TaggedArgs>
  4572. struct boost_param_no_spec_result_const\_ ## __LINE__ ## **name**
  4573. {
  4574. typedef **result** type;
  4575. };
  4576. template <typename TaggedArg0, typename ...TaggedArgs>
  4577. inline typename |boost_lazy_enable_if|_\<
  4578. |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...>
  4579. , boost_param_no_spec_result_const\_ ## __LINE__ ## **name**\ <
  4580. TaggedArg0
  4581. , TaggedArgs...
  4582. >
  4583. >::type
  4584. **name**\ (TaggedArg0 const& arg0, TaggedArgs const&... args) const
  4585. {
  4586. return this->boost_param_no_spec_impl_const ## __LINE__ ## **name**\ (
  4587. static_cast<
  4588. typename
  4589. boost_param_no_spec_result_const\_ ## __LINE__ ## **name**\ <
  4590. TaggedArg0
  4591. , TaggedArgs...
  4592. >::type(*)()
  4593. >(|std_nullptr|_\)
  4594. , |compose|_\(arg0, args...)
  4595. );
  4596. }
  4597. template <typename ResultType, typename Args>
  4598. ResultType
  4599. boost_param_no_spec_impl_const ## __LINE__ ## **name**\ (
  4600. (ResultType(*)())
  4601. , Args const& args
  4602. ) const
  4603. Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
  4604. available for use within the function body.
  4605. .. |BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR``
  4606. .. _BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR:
  4607. ``BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR(result)``
  4608. ----------------------------------------------------------
  4609. :Defined in: |preprocessor_no_spec_header|_
  4610. Generates a function call operator that can take in named arguments.
  4611. :Example usage:
  4612. When designing a front-end class template whose back-end is configurable via
  4613. parameterized inheritance, it can be useful to omit argument specifiers from
  4614. a named-parameter function call operator so that the delegate member functions
  4615. of the back-end classes can enforce their own specifications.
  4616. .. parsed-literal::
  4617. template <typename B>
  4618. struct frontend : B
  4619. {
  4620. frontend() : B()
  4621. {
  4622. }
  4623. BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR((void))
  4624. {
  4625. this->initialize_impl(args);
  4626. }
  4627. };
  4628. Named parameters are required when invoking the function call operator;
  4629. however, none of their tags need to be in the same namespace.
  4630. .. parsed-literal::
  4631. |BOOST_PARAMETER_NAME|_\(a0)
  4632. |BOOST_PARAMETER_NAME|_\(a1)
  4633. |BOOST_PARAMETER_NAME|_\(a2)
  4634. For this example, each of the back-end class templates requires its own
  4635. parameter to be present in the argument pack. In practice, such parameters
  4636. should be optional, with default values.
  4637. .. parsed-literal::
  4638. template <typename T>
  4639. class backend0
  4640. {
  4641. T a0;
  4642. public:
  4643. backend0() : a0()
  4644. {
  4645. }
  4646. T const& get_a0() const
  4647. {
  4648. return this->a0;
  4649. }
  4650. protected:
  4651. template <typename ArgPack>
  4652. void initialize_impl(ArgPack const& args)
  4653. {
  4654. this->a0 = args[_a0];
  4655. }
  4656. };
  4657. template <typename B, typename T>
  4658. class backend1 : public B
  4659. {
  4660. T a1;
  4661. public:
  4662. backend1() : B(), a1()
  4663. {
  4664. }
  4665. T const& get_a1() const
  4666. {
  4667. return this->a1;
  4668. }
  4669. protected:
  4670. template <typename ArgPack>
  4671. void initialize_impl(ArgPack const& args)
  4672. {
  4673. B::initialize_impl(args);
  4674. this->a1 = args[_a1];
  4675. }
  4676. };
  4677. template <typename B, typename T>
  4678. class backend2 : public B
  4679. {
  4680. T a2;
  4681. public:
  4682. backend2() : B(), a2()
  4683. {
  4684. }
  4685. T const& get_a2() const
  4686. {
  4687. return this->a2;
  4688. }
  4689. protected:
  4690. template <typename ArgPack>
  4691. void initialize_impl(ArgPack const& args)
  4692. {
  4693. B::initialize_impl(args);
  4694. this->a2 = args[_a2];
  4695. }
  4696. };
  4697. This example shows that while ``backend0`` must always be the root base class
  4698. template and that ``frontend`` must always be the most derived class template,
  4699. the other back-ends can be chained together in different orders.
  4700. .. parsed-literal::
  4701. char const* p = "foo";
  4702. frontend<
  4703. backend2<backend1<backend0<char const*>, char>, int>
  4704. > composed_obj0;
  4705. frontend<
  4706. backend1<backend2<backend0<char const*>, int>, char>
  4707. > composed_obj1;
  4708. composed_obj0(_a2 = 4, _a1 = ' ', _a0 = p);
  4709. composed_obj1(_a0 = p, _a1 = ' ', _a2 = 4);
  4710. BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
  4711. BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
  4712. BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
  4713. The |parameterized_inheritance_cpp|_ and |preproc_eval_cat_no_spec_cpp|_ test
  4714. programs demonstrate proper usage of this macro.
  4715. **Macro parameters:**
  4716. * ``result`` is the parenthesized return type of the function call operator.
  4717. **Argument specifiers syntax:**
  4718. None.
  4719. **Approximate expansion:**
  4720. .. parsed-literal::
  4721. // If **result** is a template instantiation of |boost_enable_if|_\,
  4722. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  4723. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  4724. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  4725. // |std_enable_if|_\:
  4726. template <typename TaggedArg0, typename ...TaggedArgs>
  4727. using boost_param_no_spec_result\_ ## __LINE__ ## operator = **result**;
  4728. // If **result** is a simple return type:
  4729. template <typename TaggedArg0, typename ...TaggedArgs>
  4730. struct boost_param_no_spec_result\_ ## __LINE__ ## operator
  4731. {
  4732. typedef **result** type;
  4733. };
  4734. template <typename TaggedArg0, typename ...TaggedArgs>
  4735. inline typename |boost_lazy_enable_if|_\<
  4736. |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...>
  4737. , boost_param_no_spec_result\_ ## __LINE__ ## operator<
  4738. TaggedArg0
  4739. , TaggedArgs...
  4740. >
  4741. >::type
  4742. operator()(TaggedArg0 const& arg0, TaggedArgs const&... args)
  4743. {
  4744. return this->boost_param_no_spec_impl ## __LINE__ ## operator(
  4745. static_cast<
  4746. typename
  4747. boost_param_no_spec_result\_ ## __LINE__ ## operator<
  4748. TaggedArg0
  4749. , TaggedArgs...
  4750. >::type(*)()
  4751. >(|std_nullptr|_\)
  4752. , |compose|_\(arg0, args...)
  4753. );
  4754. }
  4755. template <typename ResultType, typename Args>
  4756. ResultType
  4757. boost_param_no_spec_impl ## __LINE__ ## operator(
  4758. (ResultType(*)())
  4759. , Args const& args
  4760. )
  4761. Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
  4762. available for use within the function body.
  4763. .. |BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR``
  4764. .. _BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR:
  4765. ``BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR(result)``
  4766. ----------------------------------------------------------------
  4767. :Defined in: |preprocessor_no_spec_header|_
  4768. Generates a function call operator that can take in named arguments.
  4769. :Example usage:
  4770. The return type of each of the following function templates falls under a
  4771. different value category.
  4772. .. parsed-literal::
  4773. template <std::size_t N>
  4774. |std_bitset|_\<N + 1> rvalue_bitset()
  4775. {
  4776. return |std_bitset|_\<N + 1>();
  4777. }
  4778. template <std::size_t N>
  4779. |std_bitset|_\<N + 1> const rvalue_const_bitset()
  4780. {
  4781. return |std_bitset|_\<N + 1>();
  4782. }
  4783. template <std::size_t N>
  4784. |std_bitset|_\<N + 1>& lvalue_bitset()
  4785. {
  4786. static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
  4787. return lset;
  4788. }
  4789. template <std::size_t N>
  4790. |std_bitset|_\<N + 1> const& lvalue_const_bitset()
  4791. {
  4792. static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
  4793. return clset;
  4794. }
  4795. The ``U::evaluate_category`` static member function template has a simple job:
  4796. to return the correct value category when passed in an object returned by one
  4797. of the functions defined above. Assume that
  4798. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
  4799. .. parsed-literal::
  4800. enum invoked
  4801. {
  4802. passed_by_lvalue_reference_to_const
  4803. , passed_by_lvalue_reference
  4804. , passed_by_rvalue_reference_to_const
  4805. , passed_by_rvalue_reference
  4806. };
  4807. struct U
  4808. {
  4809. template <std::size_t N>
  4810. static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
  4811. {
  4812. return passed_by_lvalue_reference_to_const;
  4813. }
  4814. template <std::size_t N>
  4815. static invoked evaluate_category(|std_bitset|_\<N + 1>&)
  4816. {
  4817. return passed_by_lvalue_reference;
  4818. }
  4819. template <std::size_t N>
  4820. static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
  4821. {
  4822. return passed_by_rvalue_reference_to_const;
  4823. }
  4824. template <std::size_t N>
  4825. static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
  4826. {
  4827. return passed_by_rvalue_reference;
  4828. }
  4829. };
  4830. Named parameters are required when invoking the function call operator;
  4831. however, none of their tags need to be in the same namespace.
  4832. .. parsed-literal::
  4833. |BOOST_PARAMETER_NAME|_\((_lrc, kw0) in(lrc))
  4834. |BOOST_PARAMETER_NAME|_\((_lr, kw1) in_out(lr))
  4835. |BOOST_PARAMETER_NAME|_\((_rrc, kw2) in(rrc))
  4836. |BOOST_PARAMETER_NAME|_\((_rr, kw3) consume(rr))
  4837. Use the macro as a substitute for a variadic function call operator
  4838. header. Enclose the return type ``bool`` in parentheses. The macro will
  4839. qualify the function with the ``const`` keyword.
  4840. .. parsed-literal::
  4841. struct D
  4842. {
  4843. D()
  4844. {
  4845. }
  4846. BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR((bool))
  4847. {
  4848. BOOST_TEST_EQ(
  4849. passed_by_lvalue_reference_to_const
  4850. , U::evaluate_category<0>(args[_lrc])
  4851. );
  4852. BOOST_TEST_EQ(
  4853. passed_by_lvalue_reference
  4854. , U::evaluate_category<1>(args[_lr])
  4855. );
  4856. BOOST_TEST_EQ(
  4857. passed_by_rvalue_reference_to_const
  4858. , U::evaluate_category<2>(
  4859. args[_rrc | rvalue_const_bitset<2>()]
  4860. )
  4861. );
  4862. BOOST_TEST_EQ(
  4863. passed_by_rvalue_reference
  4864. , U::evaluate_category<3>(
  4865. args[_rr | rvalue_bitset<3>()]
  4866. )
  4867. );
  4868. return true;
  4869. }
  4870. };
  4871. To invoke the function call operator, bind all its arguments to named
  4872. parameters.
  4873. .. parsed-literal::
  4874. D const d = D();
  4875. d(
  4876. _rr0 = rvalue_bitset<3>()
  4877. , _lrc0 = lvalue_const_bitset<0>()
  4878. , _lr0 = lvalue_bitset<1>()
  4879. , _rrc0 = rvalue_const_bitset<2>()
  4880. );
  4881. d(
  4882. _lr0 = lvalue_bitset<1>()
  4883. , _lrc0 = lvalue_const_bitset<0>()
  4884. );
  4885. The |preproc_eval_cat_no_spec_cpp|_ test program demonstrates proper usage of this
  4886. macro.
  4887. **Macro parameters:**
  4888. * ``result`` is the parenthesized return type of the function call operator.
  4889. **Argument specifiers syntax:**
  4890. None.
  4891. **Approximate expansion:**
  4892. .. parsed-literal::
  4893. // If **result** is a template instantiation of |boost_enable_if|_\,
  4894. // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\,
  4895. // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\,
  4896. // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or
  4897. // |std_enable_if|_\:
  4898. template <typename TaggedArg0, typename ...TaggedArgs>
  4899. using boost_param_no_spec_result_const\_ ## __LINE__ ## operator = **result**;
  4900. // If **result** is a simple return type:
  4901. template <typename TaggedArg0, typename ...TaggedArgs>
  4902. struct boost_param_no_spec_result_const\_ ## __LINE__ ## operator
  4903. {
  4904. typedef **result** type;
  4905. };
  4906. template <typename TaggedArg0, typename ...TaggedArgs>
  4907. inline typename |boost_lazy_enable_if|_\<
  4908. |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...>
  4909. , boost_param_no_spec_result_const\_ ## __LINE__ ## operator<
  4910. TaggedArg0
  4911. , TaggedArgs...
  4912. >
  4913. >::type
  4914. operator()(
  4915. TaggedArg0 const& arg0
  4916. , TaggedArgs const&... args
  4917. ) const
  4918. {
  4919. return this->boost_param_no_spec_impl_const ## __LINE__ ## operator(
  4920. static_cast<
  4921. typename
  4922. boost_param_no_spec_result_const\_ ## __LINE__ ## operator<
  4923. TaggedArg0
  4924. , TaggedArgs...
  4925. >::type(*)()
  4926. >(|std_nullptr|_\)
  4927. , |compose|_\(arg0, args...)
  4928. );
  4929. }
  4930. template <typename ResultType, typename Args>
  4931. ResultType
  4932. boost_param_no_spec_impl_const ## __LINE__ ## operator(
  4933. (ResultType(*)())
  4934. , Args const& args
  4935. ) const
  4936. Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are
  4937. available for use within the function body.
  4938. .. |BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR| replace:: ``BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR``
  4939. .. _BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR:
  4940. ``BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(cls, impl)``
  4941. --------------------------------------------------
  4942. :Defined in: |preprocessor_no_spec_header|_
  4943. Generates a constructor that can take in named arguments.
  4944. :Example usage:
  4945. When designing a front-end class template whose back-end is configurable via
  4946. parameterized inheritance, it can be useful to omit argument specifiers from
  4947. a named-parameter constructor so that the delegate constructors of the
  4948. back-end classes can enforce their own specifications.
  4949. .. parsed-literal::
  4950. template <typename B>
  4951. struct frontend : B
  4952. {
  4953. BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(frontend, (B))
  4954. };
  4955. Named parameters are required when invoking the constructor; however, none of
  4956. their tags need to be in the same namespace.
  4957. .. parsed-literal::
  4958. |BOOST_PARAMETER_NAME|_\(a0)
  4959. |BOOST_PARAMETER_NAME|_\(a1)
  4960. |BOOST_PARAMETER_NAME|_\(a2)
  4961. For this example, each of the back-end class templates requires its own
  4962. parameter to be present in the argument pack. In practice, such parameters
  4963. should be optional, with default values.
  4964. .. parsed-literal::
  4965. struct _enabler
  4966. {
  4967. };
  4968. template <typename T>
  4969. class backend0
  4970. {
  4971. T a0;
  4972. public:
  4973. template <typename ArgPack>
  4974. explicit backend0(
  4975. ArgPack const& args
  4976. , typename |boost_enable_if|_\<
  4977. |is_argument_pack|_\<ArgPack>
  4978. , _enabler
  4979. >::type = _enabler()
  4980. ) : a0(args[_a0])
  4981. {
  4982. }
  4983. T const& get_a0() const
  4984. {
  4985. return this->a0;
  4986. }
  4987. };
  4988. template <typename B, typename T>
  4989. class backend1 : public B
  4990. {
  4991. T a1;
  4992. public:
  4993. template <typename ArgPack>
  4994. explicit backend1(
  4995. ArgPack const& args
  4996. , typename |boost_enable_if|_\<
  4997. |is_argument_pack|_\<ArgPack>
  4998. , _enabler
  4999. >::type = _enabler()
  5000. ) : B(args), a1(args[_a1])
  5001. {
  5002. }
  5003. T const& get_a1() const
  5004. {
  5005. return this->a1;
  5006. }
  5007. };
  5008. template <typename B, typename T>
  5009. class backend2 : public B
  5010. {
  5011. T a2;
  5012. public:
  5013. template <typename ArgPack>
  5014. explicit backend2(
  5015. ArgPack const& args
  5016. , typename |boost_enable_if|_\<
  5017. |is_argument_pack|_\<ArgPack>
  5018. , _enabler
  5019. >::type = _enabler()
  5020. ) : B(args), a2(args[_a2])
  5021. {
  5022. }
  5023. T const& get_a2() const
  5024. {
  5025. return this->a2;
  5026. }
  5027. };
  5028. This example shows that while ``backend0`` must always be the root base class
  5029. template and that ``frontend`` must always be the most derived class template,
  5030. the other back-ends can be chained together in different orders.
  5031. .. parsed-literal::
  5032. char const* p = "foo";
  5033. frontend<
  5034. backend2<backend1<backend0<char const*>, char>, int>
  5035. > composed_obj0(_a2 = 4, _a1 = ' ', _a0 = p);
  5036. frontend<
  5037. backend1<backend2<backend0<char const*>, int>, char>
  5038. > composed_obj1(_a0 = p, _a1 = ' ', _a2 = 4);
  5039. BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
  5040. BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
  5041. BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
  5042. The |parameterized_inheritance_cpp|_ and |preproc_eval_cat_no_spec_cpp|_ test
  5043. programs demonstrate proper usage of this macro.
  5044. **Macro parameters:**
  5045. * ``cls`` is the name of the enclosing class.
  5046. * ``impl`` is the parenthesized implementation base class for ``cls``.
  5047. **Argument specifiers syntax:**
  5048. None.
  5049. **Approximate expansion:**
  5050. .. parsed-literal::
  5051. template <
  5052. typename TaggedArg0
  5053. , typename ...TaggedArgs
  5054. , typename = typename |boost_enable_if|_\<
  5055. |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...>
  5056. >::type
  5057. >
  5058. inline explicit **cls**\ (
  5059. TaggedArg0 const& arg0
  5060. , TaggedArgs const&... args
  5061. ) : **impl**\ (|compose|_\(arg0, args...))
  5062. {
  5063. }
  5064. .. |BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR| replace:: ``BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR``
  5065. .. _BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR:
  5066. ``BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(cls, impl)``
  5067. ----------------------------------------------------------
  5068. :Defined in: |preprocessor_no_spec_header|_
  5069. Generates a constructor that can take in named arguments.
  5070. :Example usage:
  5071. The return type of each of the following function templates falls under a
  5072. different value category.
  5073. .. parsed-literal::
  5074. template <std::size_t N>
  5075. |std_bitset|_\<N + 1> rvalue_bitset()
  5076. {
  5077. return |std_bitset|_\<N + 1>();
  5078. }
  5079. template <std::size_t N>
  5080. |std_bitset|_\<N + 1> const rvalue_const_bitset()
  5081. {
  5082. return |std_bitset|_\<N + 1>();
  5083. }
  5084. template <std::size_t N>
  5085. |std_bitset|_\<N + 1>& lvalue_bitset()
  5086. {
  5087. static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>();
  5088. return lset;
  5089. }
  5090. template <std::size_t N>
  5091. |std_bitset|_\<N + 1> const& lvalue_const_bitset()
  5092. {
  5093. static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>();
  5094. return clset;
  5095. }
  5096. The ``U::evaluate_category`` static member function template has a simple job:
  5097. to return the correct value category when passed in an object returned by one
  5098. of the functions defined above. Assume that
  5099. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined.
  5100. .. parsed-literal::
  5101. enum invoked
  5102. {
  5103. passed_by_lvalue_reference_to_const
  5104. , passed_by_lvalue_reference
  5105. , passed_by_rvalue_reference_to_const
  5106. , passed_by_rvalue_reference
  5107. };
  5108. struct U
  5109. {
  5110. template <std::size_t N>
  5111. static invoked evaluate_category(|std_bitset|_\<N + 1> const&)
  5112. {
  5113. return passed_by_lvalue_reference_to_const;
  5114. }
  5115. template <std::size_t N>
  5116. static invoked evaluate_category(|std_bitset|_\<N + 1>&)
  5117. {
  5118. return passed_by_lvalue_reference;
  5119. }
  5120. template <std::size_t N>
  5121. static invoked evaluate_category(|std_bitset|_\<N + 1> const&&)
  5122. {
  5123. return passed_by_rvalue_reference_to_const;
  5124. }
  5125. template <std::size_t N>
  5126. static invoked evaluate_category(|std_bitset|_\<N + 1>&&)
  5127. {
  5128. return passed_by_rvalue_reference;
  5129. }
  5130. };
  5131. Named parameters are required when invoking the constructor; however, none of
  5132. their tags need to be in the same namespace.
  5133. .. parsed-literal::
  5134. |BOOST_PARAMETER_NAME|_\((_lrc, kw0) in(lrc))
  5135. |BOOST_PARAMETER_NAME|_\((_lr, kw1) in_out(lr))
  5136. |BOOST_PARAMETER_NAME|_\((_rrc, kw2) in(rrc))
  5137. |BOOST_PARAMETER_NAME|_\((_rr, kw3) consume(rr))
  5138. Unlike |BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR|_, this macro doesn't require a
  5139. base class, only a delegate function to which the generated constructor can
  5140. pass its |ArgumentPack|_.
  5141. .. parsed-literal::
  5142. struct D
  5143. {
  5144. BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(D, D::_evaluate)
  5145. private:
  5146. template <typename Args>
  5147. static bool _evaluate(Args const& args)
  5148. {
  5149. BOOST_TEST_EQ(
  5150. passed_by_lvalue_reference_to_const
  5151. , U::evaluate_category<0>(args[_lrc])
  5152. );
  5153. BOOST_TEST_EQ(
  5154. passed_by_lvalue_reference
  5155. , U::evaluate_category<1>(args[_lr])
  5156. );
  5157. BOOST_TEST_EQ(
  5158. passed_by_rvalue_reference_to_const
  5159. , U::evaluate_category<2>(
  5160. args[_rrc | rvalue_const_bitset<2>()]
  5161. )
  5162. );
  5163. BOOST_TEST_EQ(
  5164. passed_by_rvalue_reference
  5165. , U::evaluate_category<3>(
  5166. args[_rr | rvalue_bitset<3>()]
  5167. )
  5168. );
  5169. return true;
  5170. }
  5171. };
  5172. To invoke the constructor, bind all its arguments to named parameters.
  5173. .. parsed-literal::
  5174. D dp0(
  5175. _rr0 = rvalue_bitset<3>()
  5176. , _lrc0 = lvalue_const_bitset<0>()
  5177. , _lr0 = lvalue_bitset<1>()
  5178. , _rrc0 = rvalue_const_bitset<2>()
  5179. );
  5180. D dp1(
  5181. _lr0 = lvalue_bitset<1>()
  5182. , _lrc0 = lvalue_const_bitset<0>()
  5183. );
  5184. The |preproc_eval_cat_no_spec_cpp|_ test program demonstrates proper usage of
  5185. this macro.
  5186. **Macro parameters:**
  5187. * ``cls`` is the name of the enclosing class.
  5188. * ``func`` is a function that takes in the |ArgumentPack|_ that the
  5189. generated constructor passes on.
  5190. **Argument specifiers syntax:**
  5191. None.
  5192. **Approximate expansion:**
  5193. .. parsed-literal::
  5194. template <
  5195. typename TaggedArg0
  5196. , typename ...TaggedArgs
  5197. , typename = typename |boost_enable_if|_\<
  5198. |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...>
  5199. >::type
  5200. >
  5201. inline explicit **cls**\ (
  5202. TaggedArg0 const& arg0
  5203. , TaggedArgs const&... args
  5204. )
  5205. {
  5206. **func**\ (|compose|_\(arg0, args...));
  5207. }
  5208. .. |BOOST_PARAMETER_NAME| replace:: ``BOOST_PARAMETER_NAME``
  5209. .. _BOOST_PARAMETER_NAME:
  5210. ``BOOST_PARAMETER_NAME(name)``
  5211. ------------------------------
  5212. :Defined in: |name_header|_
  5213. Declares a tag-type and keyword object.
  5214. **If** *name* is of the form:
  5215. .. parsed-literal::
  5216. (*object-name*, *namespace-name*) *qualifier*\ (*tag-name*)
  5217. **then**
  5218. :Requires: *qualifier* is either ``in``, ``out``, ``in_out``, ``consume``,
  5219. ``move_from``, or ``forward``.
  5220. :Expands to:
  5221. .. parsed-literal::
  5222. namespace *namespace-name* {
  5223. struct *tag-name*
  5224. {
  5225. static constexpr char const* keyword_name()
  5226. {
  5227. return ## *tag-name*;
  5228. }
  5229. typedef *unspecified* _;
  5230. typedef *unspecified* _1;
  5231. typedef boost::parameter::*qualifier* ## _reference qualifier;
  5232. // The following definitions are available only when
  5233. // |BOOST_PARAMETER_CAN_USE_MP11|_ is defined.
  5234. template <typename ArgumentPack>
  5235. using binding_fn = typename |binding|_\<
  5236. ArgumentPack
  5237. , *tag-name*
  5238. >::type;
  5239. template <typename ArgumentPack>
  5240. using fn = typename |value_type|_\<ArgumentPack, *tag-name*>::type;
  5241. };
  5242. }
  5243. |keyword|_\<*tag-namespace*::*tag-name*> const& *object-name*
  5244. = |keyword|_\<*tag-namespace*::*tag-name*>::instance;
  5245. **Else If** *name* is of the form:
  5246. .. parsed-literal::
  5247. (*tag-name*, *namespace-name*) *object-name*
  5248. **then**
  5249. Treats *name* as if it were of the form:
  5250. .. parsed-literal::
  5251. (forward(*tag-name*), *namespace-name*) *object-name*
  5252. **Else If** *name* is of the form:
  5253. .. parsed-literal::
  5254. *qualifier*\ (*tag-name*)
  5255. **then**
  5256. :Requires: *qualifier* is either ``in``, ``out``, ``in_out``, ``consume``,
  5257. ``move_from``, or ``forward``.
  5258. :Expands to:
  5259. .. parsed-literal::
  5260. namespace tag {
  5261. struct *tag-name*
  5262. {
  5263. static constexpr char const* keyword_name()
  5264. {
  5265. return ## *tag-name*;
  5266. }
  5267. typedef *unspecified* _;
  5268. typedef *unspecified* _1;
  5269. typedef boost::parameter::*qualifier* ## _reference qualifier;
  5270. // The following definitions are available only when
  5271. // |BOOST_PARAMETER_CAN_USE_MP11|_ is defined.
  5272. template <typename ArgumentPack>
  5273. using binding_fn = typename |binding|_\<
  5274. ArgumentPack
  5275. , *tag-name*
  5276. >::type;
  5277. template <typename ArgumentPack>
  5278. using fn = typename |value_type|_\<ArgumentPack, *tag-name*>::type;
  5279. };
  5280. }
  5281. |keyword|_\<tag::*tag-name*> const& _ ## *tag-name*
  5282. = |keyword|_\<tag::*tag-name*>::instance;
  5283. **Else**
  5284. Treats *name* as if it were of the form:
  5285. .. parsed-literal::
  5286. forward(*tag-name*)
  5287. .. |BOOST_PARAMETER_NESTED_KEYWORD| replace:: ``BOOST_PARAMETER_NESTED_KEYWORD``
  5288. .. _BOOST_PARAMETER_NESTED_KEYWORD:
  5289. ``BOOST_PARAMETER_NESTED_KEYWORD(tag_namespace, name, alias)``
  5290. --------------------------------------------------------------
  5291. :Defined in: |nested_keyword_header|_
  5292. Declares a tag-type, a keyword object, and an alias for that object nested in
  5293. the tag-type.
  5294. **If** *name* is of the form:
  5295. .. parsed-literal::
  5296. *qualifier*\ (*tag-name*)
  5297. **then**
  5298. :Requires: *qualifier* is either ``in``, ``out``, ``in_out``, ``consume``,
  5299. ``move_from``, or ``forward``.
  5300. :Expands to:
  5301. .. parsed-literal::
  5302. namespace tag {
  5303. struct *tag-name*
  5304. {
  5305. static constexpr char const* keyword_name()
  5306. {
  5307. return ## *tag-name* ## _;
  5308. }
  5309. typedef *unspecified* _;
  5310. typedef *unspecified* _1;
  5311. typedef boost::parameter::*qualifier* ## _reference qualifier;
  5312. static |keyword|_\<*tag-name*> const& *alias*;
  5313. // The following definitions are available only when
  5314. // |BOOST_PARAMETER_CAN_USE_MP11|_ is defined.
  5315. template <typename ArgumentPack>
  5316. using binding_fn = typename |binding|_\<
  5317. ArgumentPack
  5318. , *tag-name*
  5319. >::type;
  5320. template <typename ArgumentPack>
  5321. using fn = typename |value_type|_\<ArgumentPack, *tag-name*>::type;
  5322. };
  5323. |keyword|_\<*tag-name*> const& tag::*tag-name*::*alias*
  5324. = |keyword|_\<*tag-name*>::instance;
  5325. }
  5326. |keyword|_\<tag::*tag-name*> const& tag::*tag-name*::*name*
  5327. = |keyword|_\<tag::*tag-name*>::instance;
  5328. **Else**
  5329. Treats *name* as if it were of the form:
  5330. .. parsed-literal::
  5331. forward(*tag-name*)
  5332. .. |BOOST_PARAMETER_TEMPLATE_KEYWORD| replace:: ``BOOST_PARAMETER_TEMPLATE_KEYWORD``
  5333. .. _BOOST_PARAMETER_TEMPLATE_KEYWORD:
  5334. ``BOOST_PARAMETER_TEMPLATE_KEYWORD(name)``
  5335. ------------------------------------------
  5336. :Defined in: |template_keyword_header|_
  5337. :Included by: |name_header|_
  5338. :Expands to:
  5339. .. parsed-literal::
  5340. namespace tag {
  5341. struct *name*;
  5342. }
  5343. template <typename T>
  5344. struct *name* : |template_keyword|_\<tag:: *name*, T>
  5345. {
  5346. };
  5347. The |function_type_tpl_param_cpp|_ test program demonstrates proper usage of
  5348. this macro.
  5349. .. |BOOST_PARAMETER_FUN| replace:: ``BOOST_PARAMETER_FUN``
  5350. .. _BOOST_PARAMETER_FUN:
  5351. ``BOOST_PARAMETER_FUN(r, n, l, h, p)``
  5352. --------------------------------------
  5353. .. admonition:: Deprecated
  5354. This macro has been deprecated in favor of
  5355. ``BOOST_PARAMETER_FUNCTION``.
  5356. Generates a sequence of `forwarding function`_ templates named
  5357. ``n``, with arities ranging from ``l`` to ``h``, returning ``r``,
  5358. and using ``p`` to control overload resolution and assign tags to
  5359. positional arguments.
  5360. :Defined in: |macros_header|_
  5361. :Requires: ``l`` and ``h`` are nonnegative integer tokens
  5362. such that ``l`` < ``h``
  5363. :Expands to:
  5364. .. parsed-literal::
  5365. template <typename A1, typename A2, …, typename A ## **l**>
  5366. r
  5367. name(
  5368. A1 && a1, A2 && a2, …, A ## **l** && a ## **l**
  5369. , typename **p**::match<A1, A2, …, A ## **l**>::type p = **p**\ ()
  5370. )
  5371. {
  5372. return **name**\ _with_named_params(
  5373. **p**\ (
  5374. |std_forward|_\<A1>(a1)
  5375. , |std_forward|_\<A2>(a2)
  5376. , …
  5377. , |std_forward|_\<A ## **l**>(a ## **l**)
  5378. )
  5379. );
  5380. }
  5381. template <
  5382. typename A1
  5383. , typename A2
  5384. , …
  5385. , typename A ## **l**
  5386. , typename A ## |BOOST_PP_INC|_\ (**l**)
  5387. >
  5388. r
  5389. name(
  5390. A1 && a1, A2 && a2, …, A ## **l** && a ## **l**
  5391. , A ## |BOOST_PP_INC|_\ (**l**) const& a ## |BOOST_PP_INC|_\ (**l**)
  5392. , typename **p**::match<
  5393. A1, A2, …, A ## **l**, A ## |BOOST_PP_INC|_\ (**l**)
  5394. >::type p = **p**\ ()
  5395. )
  5396. {
  5397. return **name**\ _with_named_params(
  5398. **p**\ (
  5399. |std_forward|_\<A1>(a1)
  5400. , |std_forward|_\<A2>(a2)
  5401. , …
  5402. , |std_forward|_\<A ## **l**>(a ## **l**)
  5403. , |std_forward|_\<A ## |BOOST_PP_INC|_\ (**l**)>(
  5404. a ## |BOOST_PP_INC|_\ (**l**)
  5405. )
  5406. )
  5407. );
  5408. }
  5409. :vellipsis:`⋮`
  5410. template <typename A1, typename A2, …, typename A ## **h**>
  5411. r
  5412. name(
  5413. A1 && a1, A2 && a2, …, A ## **h** && x ## **h**
  5414. , typename **p**::match<A1, A2, …, A ## **h**>::type p = **p**\ ()
  5415. )
  5416. {
  5417. return **name**\ _with_named_params(
  5418. **p**\ (
  5419. |std_forward|_\<A1>(a1)
  5420. , |std_forward|_\<A2>(a2)
  5421. , …
  5422. , |std_forward|_\<A ## **h**>(a ## **h**)
  5423. )
  5424. );
  5425. }
  5426. The |macros_cpp|_ and |macros_eval_cat_cpp|_ test programs demonstrate proper
  5427. usage of this macro.
  5428. .. |BOOST_PARAMETER_KEYWORD| replace:: ``BOOST_PARAMETER_KEYWORD``
  5429. .. _BOOST_PARAMETER_KEYWORD:
  5430. ``BOOST_PARAMETER_KEYWORD(n, k)``
  5431. ---------------------------------
  5432. .. admonition:: Deprecated
  5433. This macro has been deprecated in favor of
  5434. ``BOOST_PARAMETER_NAME``.
  5435. Generates the declaration of a |keyword tag type| named ``k`` in
  5436. namespace ``n`` and a corresponding |keyword object| definition in
  5437. the enclosing namespace.
  5438. :Defined in: |keyword_header|_
  5439. :Expands to:
  5440. .. parsed-literal::
  5441. namespace **n** {
  5442. struct **k**
  5443. {
  5444. static constexpr char const* keyword_name()
  5445. {
  5446. return ## *k*;
  5447. }
  5448. typedef *unspecified* _;
  5449. typedef *unspecified* _1;
  5450. typedef boost::parameter::forward_reference qualifier;
  5451. // The following definitions are available only when
  5452. // |BOOST_PARAMETER_CAN_USE_MP11|_ is defined.
  5453. template <typename ArgumentPack>
  5454. using binding_fn = typename |binding|_\<
  5455. ArgumentPack
  5456. , *k*
  5457. >::type;
  5458. template <typename ArgumentPack>
  5459. using fn = typename |value_type|_\<ArgumentPack, *k*>::type;
  5460. };
  5461. }
  5462. namespace {
  5463. |keyword|_\<*n*::**k**> const& **k**
  5464. = |keyword|_\<*n*::**k**>::instance;
  5465. }
  5466. ``BOOST_PARAMETER_MATCH(p, a, x)``
  5467. ----------------------------------
  5468. Generates a defaulted parameter declaration for a `forwarding function`_.
  5469. :Defined in: |match_header|_
  5470. :Requires: ``a`` is a `Boost.Preprocessor sequence`__ of the form
  5471. .. parsed-literal::
  5472. (A0)(A1)…(A ## *n*)
  5473. __ ../../../preprocessor/doc/data.html
  5474. :Expands to:
  5475. .. parsed-literal::
  5476. typename **p**::match<**A0**\ , **A1**\ , …, **A** ## *n*>::type
  5477. **x** = **p**\ ()
  5478. Configuration Macros
  5479. ====================
  5480. .. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING| replace:: ``BOOST_PARAMETER_HAS_PERFECT_FORWARDING``
  5481. .. _BOOST_PARAMETER_HAS_PERFECT_FORWARDING:
  5482. ``BOOST_PARAMETER_HAS_PERFECT_FORWARDING``
  5483. ------------------------------------------
  5484. Determines whether or not the library supports perfect forwarding, or the
  5485. preservation of parameter value categories. Users can manually disable this
  5486. macro by ``#defining`` the |BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING|_
  5487. macro. Otherwise, the library will ``#define`` this macro if and only if it
  5488. is not already defined, and if the configuration macros
  5489. |BOOST_NO_FUNCTION_TEMPLATE_ORDERING|_, |BOOST_NO_SFINAE|_,
  5490. |BOOST_NO_CXX11_RVALUE_REFERENCES|_, |BOOST_NO_CXX11_VARIADIC_TEMPLATES|_, and
  5491. |BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS|_ are not already defined by
  5492. |Boost_Config|_.
  5493. :Defined in: |config_header|_
  5494. .. |BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING| replace:: ``BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING``
  5495. .. _BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING:
  5496. ``BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING``
  5497. ----------------------------------------------
  5498. It may be necessary to test user code in case perfect forwarding support is
  5499. unavailable. Users can ``#define`` this macro either in their project
  5500. settings or before including any library header files. Doing so will leave
  5501. both |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and
  5502. |BOOST_PARAMETER_CAN_USE_MP11|_ undefined.
  5503. .. |BOOST_PARAMETER_CAN_USE_MP11| replace:: ``BOOST_PARAMETER_CAN_USE_MP11``
  5504. .. _BOOST_PARAMETER_CAN_USE_MP11:
  5505. ``BOOST_PARAMETER_CAN_USE_MP11``
  5506. --------------------------------
  5507. Determines whether or not the library can use |Boost_MP11|_, a C++11
  5508. metaprogramming library. Users can manually disable this macro by
  5509. ``#defining`` the |BOOST_PARAMETER_DISABLE_MP11_USAGE|_ macro or the
  5510. |BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING|_ macro. Otherwise, the library
  5511. will ``#define`` this macro if and only if it is not already defined, if
  5512. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined, and if the configuration
  5513. macros |BOOST_NO_CXX11_CONSTEXPR|_, |BOOST_NO_CXX11_DECLTYPE_N3276|_,
  5514. |BOOST_NO_CXX11_AUTO_DECLARATIONS|_, |BOOST_NO_CXX11_TEMPLATE_ALIASES|_,
  5515. |BOOST_NO_CXX11_STATIC_ASSERT|_, |BOOST_NO_CXX11_HDR_TYPE_TRAITS|_,
  5516. |BOOST_NO_CXX11_HDR_INITIALIZER_LIST|_, and |BOOST_NO_CXX11_HDR_TUPLE|_
  5517. are not already defined by |Boost_Config|_.
  5518. .. Admonition:: Usage Note
  5519. |Boost_MP11|_ and |Boost_MPL|_ are **not** mutually exclusive. It's
  5520. perfectly acceptable to specify deduced parameters using both quoted
  5521. metafunctions and metafunction classes, for example. See
  5522. |evaluate_category_cpp|_.
  5523. :Defined in: |config_header|_
  5524. :Example usage:
  5525. Given the following definitions:
  5526. .. parsed-literal::
  5527. |BOOST_PARAMETER_NAME|_\(x)
  5528. template <typename A0>
  5529. typename |boost_enable_if|_\<|std_is_same|_\<int,A0>,int>::type
  5530. sfinae(A0 const& a0)
  5531. {
  5532. return 0;
  5533. }
  5534. |Boost_MP11|_ allows deduced parameters to be defined more succinctly:
  5535. .. parsed-literal::
  5536. template <typename T, typename Args>
  5537. using predicate = |std_is_convertible|_\<T,char const*>;
  5538. |BOOST_PARAMETER_FUNCTION|_\((int), sfinae, tag,
  5539. (deduced
  5540. (optional
  5541. (x
  5542. , \*(|mp11_quote|_\<predicate>)
  5543. , static_cast<char const*>(|std_nullptr|_\)
  5544. )
  5545. )
  5546. )
  5547. )
  5548. {
  5549. return 1;
  5550. }
  5551. Without |Boost_MP11|_, deduced parameter definitions tend to be more verbose:
  5552. .. parsed-literal::
  5553. struct predicate
  5554. {
  5555. template <typename T, typename Args>
  5556. struct apply
  5557. : |mpl_if|_\<
  5558. |boost_is_convertible|_\<T,char const*>
  5559. , |mpl_true|_\ // Still have to convert to a
  5560. , |mpl_false|_\ // `Boolean Integral Constant`_.
  5561. >
  5562. {
  5563. };
  5564. };
  5565. |BOOST_PARAMETER_FUNCTION|_\((int), sfinae, tag,
  5566. (deduced
  5567. (optional
  5568. (x
  5569. , \*(predicate)
  5570. , static_cast<char const*>(|std_nullptr|_\)
  5571. )
  5572. )
  5573. )
  5574. )
  5575. {
  5576. return 1;
  5577. }
  5578. Either way, the following assertions will succeed:
  5579. .. parsed-literal::
  5580. assert(1 == sfinae());
  5581. assert(1 == sfinae("foo"));
  5582. assert(0 == sfinae(1));
  5583. As another example, given the following declarations and definitions:
  5584. .. parsed-literal::
  5585. |BOOST_PARAMETER_NAME|_\(x)
  5586. |BOOST_PARAMETER_NAME|_\(y)
  5587. template <typename E, typename Args>
  5588. void check0(E const& e, Args const& args);
  5589. template <typename P, typename E, typename ...Args>
  5590. void check(E const& e, Args const&... args)
  5591. {
  5592. check0(e, P()(args...));
  5593. }
  5594. Argument packs qualify as |Boost_MP11|_-style lists containing
  5595. |keyword tag type|\ s:
  5596. .. parsed-literal::
  5597. template <typename Args>
  5598. struct some_functor
  5599. {
  5600. template <typename K>
  5601. void operator()(K&&) const
  5602. {
  5603. // K is one of tag\:\:x, tag\:\:y, etc.
  5604. }
  5605. };
  5606. template <typename E, typename Args>
  5607. void check0(E const& e, Args const& args)
  5608. {
  5609. boost::mp11::mp_for_each<E>(some_functor<Args>());
  5610. }
  5611. The first check determines whether or not the argument type of ``_y`` is the
  5612. same as the reference type of ``_x``, while the second check determines
  5613. whether or not the argument type of ``_y`` is convertible to the value type of
  5614. ``_x``. Here, it's possible to access the reference and value result types of
  5615. indexing an argument pack a little more directly:
  5616. .. parsed-literal::
  5617. // Use mp_bind on tag\:\:x\:\:binding_fn to access the reference type of _x.
  5618. check<
  5619. |parameters|_\<
  5620. tag\:\:x
  5621. , |optional|_\<
  5622. |deduced|_\<tag\:\:y>
  5623. , |mp11_bind|_\<
  5624. |std_is_same|_\ // |boost_is_same|_, standard version.
  5625. , |mp11_1|_\ // will be bound to the argument type of _y.
  5626. , |mp11_bind|_\<
  5627. tag\:\:x\:\:binding_fn
  5628. , |mp11_2|_\ // will be bound to the argument pack type.
  5629. >
  5630. >
  5631. >
  5632. >
  5633. >((_x = 0, _y = 1), 0, 1);
  5634. // Use mp_bind_q on tag\:\:x to access the value type of _x.
  5635. check<
  5636. |parameters|_\<
  5637. tag\:\:x
  5638. , |optional|_\<
  5639. |deduced|_\<tag\:\:y>
  5640. , |mp11_bind|_\<
  5641. |std_is_convertible|_\ // |boost_is_convertible|_, standard version.
  5642. , |mp11_1|_\ // will be bound to the argument type of _y.
  5643. , |mp11_bind_q|_\<
  5644. tag\:\:x
  5645. , |mp11_2|_\ // will be bound to the argument pack type.
  5646. >
  5647. >
  5648. >
  5649. >
  5650. >((_x = 0U, _y = 1U), 0U, 1U);
  5651. Argument packs still qualify as |Boost_MPL|_-style lists containing
  5652. |keyword tag type|\ s:
  5653. .. parsed-literal::
  5654. template <typename Args>
  5655. struct some_functor
  5656. {
  5657. template <typename K>
  5658. void operator()(K) const
  5659. {
  5660. // K is one of tag\:\:x, tag\:\:y, etc.
  5661. }
  5662. };
  5663. template <typename E, typename Args>
  5664. void check0(E const& e, Args const& args)
  5665. {
  5666. boost::mpl::for_each<E>(some_functor<Args>());
  5667. }
  5668. However, without |Boost_MP11|_, the corresponding checks become a little more
  5669. verbose:
  5670. .. parsed-literal::
  5671. check<
  5672. |parameters|_\<
  5673. tag\:\:x
  5674. , |optional|_\<
  5675. |deduced|_\<tag\:\:y>
  5676. , |mpl_if|_\<
  5677. |boost_is_same|_\<
  5678. |boost_add_lvalue_reference|_\<|mp11_1|_\>
  5679. , |binding|_\<|mp11_2|_\, tag\:\:x>
  5680. >
  5681. , |mpl_true|_\ // Still have to convert to a
  5682. , |mpl_false|_\ // `Boolean Integral Constant`_.
  5683. >
  5684. >
  5685. >
  5686. >((_x = 0, _y = 1), 0, 1);
  5687. // Use tag\:\:x\:\:_ or tag\:\:x\:\:_1 to access the value type of _x.
  5688. check<
  5689. |parameters|_\<
  5690. tag\:\:x
  5691. , |optional|_\<
  5692. |deduced|_\<tag\:\:y>
  5693. , |mpl_if|_\<
  5694. |boost_is_convertible|_\<|mp11_1|_\, tag\:\:x\:\:_1>
  5695. , |mpl_true|_\ // Still have to convert to a
  5696. , |mpl_false|_\ // `Boolean Integral Constant`_.
  5697. >
  5698. >
  5699. >
  5700. >((_x = 0U, _y = 1U), 0U, 1U);
  5701. The |singular_cpp|_, |compose_cpp|_, |optional_deduced_sfinae_cpp|_, and
  5702. |deduced_dep_pred_cpp|_ test programs demonstrate proper usage of this
  5703. macro.
  5704. .. |BOOST_PARAMETER_DISABLE_MP11_USAGE| replace:: ``BOOST_PARAMETER_DISABLE_MP11_USAGE``
  5705. .. _BOOST_PARAMETER_DISABLE_MP11_USAGE:
  5706. ``BOOST_PARAMETER_DISABLE_MP11_USAGE``
  5707. --------------------------------------
  5708. It may be necessary to disable usage of |Boost_MP11|_ for compilers that
  5709. cannot support it. Users can ``#define`` this macro either in their project
  5710. settings or before including any library header files. Doing so will leave
  5711. |BOOST_PARAMETER_CAN_USE_MP11|_ undefined.
  5712. .. |BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE| replace:: ``BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE``
  5713. .. _BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE:
  5714. ``BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE``
  5715. -----------------------------------------
  5716. If |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is ``#defined``, then determines
  5717. the `MPL Variadic Sequence`_ underlying the nested ``parameter_spec`` type of
  5718. |parameters|. If the user does not manually ``#define`` this macro, then the
  5719. library will ``#define`` it as |mp11_list|_ if
  5720. |BOOST_PARAMETER_CAN_USE_MP11|_ is defined, |fusion_list|_ if
  5721. |BOOST_FUSION_HAS_VARIADIC_LIST|_ is defined (by |Boost_Fusion|_),
  5722. |fusion_deque|_ if |BOOST_FUSION_HAS_VARIADIC_DEQUE|_ is defined
  5723. (by |Boost_Fusion|_), or |mpl_vector|_ otherwise.
  5724. :Example:
  5725. .. parsed-literal::
  5726. #define BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE |fusion_vector|_
  5727. :Defined in: |parameters_header|_
  5728. .. |BOOST_PARAMETER_MAX_ARITY| replace:: ``BOOST_PARAMETER_MAX_ARITY``
  5729. .. _BOOST_PARAMETER_MAX_ARITY:
  5730. ``BOOST_PARAMETER_MAX_ARITY``
  5731. -----------------------------
  5732. If |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is ``#defined``, then:
  5733. * If the `MPL Variadic Sequence`_ underlying the nested ``parameter_spec``
  5734. type of |parameters| does not have a size limit--which is the case with
  5735. |mp11_list|_, |fusion_list|_, and |fusion_deque|_, but not
  5736. |mpl_vector|_--then this macro can be safely ignored. User code that
  5737. manually defines |BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE|_ should also
  5738. manually define this macro to the size limit of the sequence if it has
  5739. one.
  5740. If |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is **not** ``#defined``, then:
  5741. * Mutable references must be wrapped by |boost_ref|_ or |std_ref|_ if passed
  5742. by position to Boost.Parameter-enabled functions with arity greater than
  5743. or equal to |BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY|_.
  5744. :Defined in: |config_header|_
  5745. :Default Value: |BOOST_MPL_LIMIT_VECTOR_SIZE|_ (defined by |Boost_MPL|_) if
  5746. perfect forwarding is supported, ``8`` otherwise.
  5747. :Minimum Value: ``2``
  5748. :Maximum Value: |BOOST_PARAMETER_COMPOSE_MAX_ARITY|_
  5749. .. |BOOST_PARAMETER_COMPOSE_MAX_ARITY| replace:: ``BOOST_PARAMETER_COMPOSE_MAX_ARITY``
  5750. .. _BOOST_PARAMETER_COMPOSE_MAX_ARITY:
  5751. ``BOOST_PARAMETER_COMPOSE_MAX_ARITY``
  5752. -------------------------------------
  5753. If |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is **not** ``#defined``, then
  5754. determines the maximum number of arguments supported by the |compose| function
  5755. and by the |BOOST_PARAMETER_NO_SPEC_FUNCTION|_,
  5756. |BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION|_,
  5757. |BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION|_,
  5758. |BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR|_,
  5759. |BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR|_,
  5760. |BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR|_, and
  5761. |BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR|_ code generation macros.
  5762. :Defined in: |config_header|_
  5763. :Default Value: ``20`` for a few older compilers, ``64`` otherwise
  5764. :Minimum Value: ``2``
  5765. .. |BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY| replace:: ``BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY``
  5766. .. _BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY:
  5767. ``BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY``
  5768. --------------------------------------------------------
  5769. If this library does **not** support perfect forwarding, determines the number
  5770. of arguments less than which |parameters| generates an exponential number of
  5771. function call operator overloads, and greater than or equal to which
  5772. |parameters| does not. Will only be ``#defined`` by the library if it is
  5773. not already ``#defined`` and |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is
  5774. **not** ``#defined``.
  5775. :Defined in: |config_header|_
  5776. :Default Value: ``0``
  5777. :Minimum Value: ``0``
  5778. ...Outside Of This Library
  5779. --------------------------
  5780. #. If |Boost_Config|_ defines the macro
  5781. |BOOST_NO_FUNCTION_TEMPLATE_ORDERING|_, then the macros
  5782. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and
  5783. |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined; otherwise, the
  5784. code generation macros would not work correctly.
  5785. #. If |Boost_Config|_ defines the macro |BOOST_NO_SFINAE|_, then the macros
  5786. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and
  5787. |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined; otherwise, keyword
  5788. types generated by |BOOST_PARAMETER_NAME|_ and
  5789. |BOOST_PARAMETER_NESTED_KEYWORD|_ would not work correctly.
  5790. #. If |Boost_Config|_ defines the macro
  5791. |BOOST_NO_CXX11_RVALUE_REFERENCES|_, then the macros
  5792. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and
  5793. |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
  5794. #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_VARIADIC_TEMPLATES|_,
  5795. then the macros |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and
  5796. |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
  5797. #. If |Boost_Config|_ defines the macro
  5798. |BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS|_, then the macros
  5799. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and
  5800. |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
  5801. #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_CONSTEXPR|_, then the
  5802. macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
  5803. #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_DECLTYPE_N3276|_,
  5804. then the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
  5805. #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_AUTO_DECLARATIONS|_,
  5806. then the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
  5807. #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_TEMPLATE_ALIASES|_,
  5808. then the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
  5809. #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_STATIC_ASSERT|_, then
  5810. the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
  5811. #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_HDR_TYPE_TRAITS|_,
  5812. then the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
  5813. #. If |Boost_Config|_ defines the macro
  5814. |BOOST_NO_CXX11_HDR_INITIALIZER_LIST|_, then the macro
  5815. |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
  5816. #. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_HDR_TUPLE|_, then the
  5817. macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined.
  5818. #. If |Boost_Fusion|_ defines the macro |BOOST_FUSION_HAS_VARIADIC_LIST|_,
  5819. if this library defines the macro
  5820. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_, and if
  5821. |BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE|_ is left undefined, then the
  5822. `MPL Variadic Sequence`_ underlying the nested ``parameter_spec`` type of
  5823. |parameters| will be |fusion_list|_.
  5824. #. If |Boost_Fusion|_ defines the macro |BOOST_FUSION_HAS_VARIADIC_DEQUE|_,
  5825. if this library defines the macro
  5826. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_, and if
  5827. |BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE|_ is left undefined, then the
  5828. `MPL Variadic Sequence`_ underlying the nested ``parameter_spec`` type of
  5829. |parameters| will be |fusion_deque|_.
  5830. #. The value that |Boost_MPL|_ defines the macro
  5831. |BOOST_MPL_LIMIT_VECTOR_SIZE|_ as will be the value that this library
  5832. defines the macro |BOOST_PARAMETER_MAX_ARITY|_ as if this library defines
  5833. the macro |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_.
  5834. Tutorial
  5835. ========
  5836. Follow `this link`__ to the Boost.Parameter tutorial documentation.
  5837. __ index.html#tutorial
  5838. //////////////////////////////////////////////////////////////////////////////
  5839. .. [#thread] References to tag objects may be initialized multiple
  5840. times. This scenario can only occur in the presence of
  5841. threading. Because the C++ standard doesn't consider threading,
  5842. it doesn't explicitly allow or forbid multiple initialization of
  5843. references. That said, it's hard to imagine an implementation
  5844. where it could make a difference.
  5845. .. [#no_result_of] Where |BOOST_NO_RESULT_OF|_ is ``#defined``,
  5846. |boost_result_of|_\ ``<F()>::type`` is replaced by ``F::result_type``.
  5847. .. |std_nullptr| replace:: std::nullptr
  5848. .. _std_nullptr: http://en.cppreference.com/w/cpp/language/nullptr
  5849. .. |std_forward| replace:: std::forward
  5850. .. _std_forward: http://en.cppreference.com/w/cpp/utility/forward
  5851. .. |std_enable_if| replace:: std::enable_if
  5852. .. _std_enable_if: http://en.cppreference.com/w/cpp/types/enable_if
  5853. .. |std_is_convertible| replace:: std::is_convertible
  5854. .. _std_is_convertible: http://en.cppreference.com/w/cpp/types/is_convertible
  5855. .. |std_is_same| replace:: std::is_same
  5856. .. _std_is_same: http://en.cppreference.com/w/cpp/types/is_same
  5857. .. |std_ref| replace:: ``std::ref``
  5858. .. _std_ref: http://en.cppreference.com/w/cpp/utility/functional/ref
  5859. .. |std_map| replace:: std::map
  5860. .. _std_map: http://en.cppreference.com/w/cpp/container/map
  5861. .. |std_string| replace:: std::string
  5862. .. _std_string: http://en.cppreference.com/w/cpp/string/basic_string
  5863. .. |std_bitset| replace:: std::bitset
  5864. .. _std_bitset: http://en.cppreference.com/w/cpp/utility/bitset
  5865. .. |Boost_Config| replace:: Boost.Config
  5866. .. _Boost_Config: ../../../config/doc/html/index.html
  5867. .. |BOOST_NO_FUNCTION_TEMPLATE_ORDERING| replace:: ``BOOST_NO_FUNCTION_TEMPLATE_ORDERING``
  5868. .. _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
  5869. .. |BOOST_NO_SFINAE| replace:: ``BOOST_NO_SFINAE``
  5870. .. _BOOST_NO_SFINAE: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__03_defects
  5871. .. |BOOST_NO_CXX11_AUTO_DECLARATIONS| replace:: ``BOOST_NO_CXX11_AUTO_DECLARATIONS``
  5872. .. _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
  5873. .. |BOOST_NO_CXX11_CONSTEXPR| replace:: ``BOOST_NO_CXX11_CONSTEXPR``
  5874. .. _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
  5875. .. |BOOST_NO_CXX11_DECLTYPE_N3276| replace:: ``BOOST_NO_CXX11_DECLTYPE_N3276``
  5876. .. _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
  5877. .. |BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS| replace:: ``BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS``
  5878. .. _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
  5879. .. |BOOST_NO_CXX11_HDR_INITIALIZER_LIST| replace:: ``BOOST_NO_CXX11_HDR_INITIALIZER_LIST``
  5880. .. _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
  5881. .. |BOOST_NO_CXX11_HDR_TUPLE| replace:: ``BOOST_NO_CXX11_HDR_TUPLE``
  5882. .. _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
  5883. .. |BOOST_NO_CXX11_HDR_TYPE_TRAITS| replace:: ``BOOST_NO_CXX11_HDR_TYPE_TRAITS``
  5884. .. _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
  5885. .. |BOOST_NO_CXX11_RVALUE_REFERENCES| replace:: ``BOOST_NO_CXX11_RVALUE_REFERENCES``
  5886. .. _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
  5887. .. |BOOST_NO_CXX11_STATIC_ASSERT| replace:: ``BOOST_NO_CXX11_STATIC_ASSERT``
  5888. .. _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
  5889. .. |BOOST_NO_CXX11_TEMPLATE_ALIASES| replace:: ``BOOST_NO_CXX11_TEMPLATE_ALIASES``
  5890. .. _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
  5891. .. |BOOST_NO_CXX11_VARIADIC_TEMPLATES| replace:: ``BOOST_NO_CXX11_VARIADIC_TEMPLATES``
  5892. .. _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
  5893. .. |Boost_Preprocessor| replace:: Boost.Preprocessor
  5894. .. _Boost_Preprocessor: ../../../preprocessor/doc/index.html
  5895. .. _`sequence`: ../../../preprocessor/doc/data/sequences.html
  5896. .. |BOOST_PP_INC| replace:: BOOST_PP_INC
  5897. .. _BOOST_PP_INC: ../../../preprocessor/doc/ref/inc.html
  5898. .. |boost_enable_if| replace:: boost::enable_if
  5899. .. _boost_enable_if: ../../../core/doc/html/core/enable_if.html
  5900. .. |boost_enable_if_c| replace:: boost::enable_if_c
  5901. .. _boost_enable_if_c: ../../../core/doc/html/core/enable_if.html
  5902. .. |boost_lazy_enable_if| replace:: boost::lazy_enable_if
  5903. .. _boost_lazy_enable_if: ../../../core/doc/html/core/enable_if.html
  5904. .. |boost_lazy_enable_if_c| replace:: boost::lazy_enable_if_c
  5905. .. _boost_lazy_enable_if_c: ../../../core/doc/html/core/enable_if.html
  5906. .. |boost_disable_if| replace:: boost::disable_if
  5907. .. _boost_disable_if: ../../../core/doc/html/core/enable_if.html
  5908. .. |boost_disable_if_c| replace:: boost::disable_if_c
  5909. .. _boost_disable_if_c: ../../../core/doc/html/core/enable_if.html
  5910. .. |boost_lazy_disable_if| replace:: boost::lazy_disable_if
  5911. .. _boost_lazy_disable_if: ../../../core/doc/html/core/enable_if.html
  5912. .. |boost_lazy_disable_if_c| replace:: boost::lazy_disable_if_c
  5913. .. _boost_lazy_disable_if_c: ../../../core/doc/html/core/enable_if.html
  5914. .. |boost_ref| replace:: ``boost::ref``
  5915. .. _boost_ref: ../../../core/doc/html/core/ref.html
  5916. .. |BOOST_NO_RESULT_OF| replace:: ``BOOST_NO_RESULT_OF``
  5917. .. _BOOST_NO_RESULT_OF: ../../../utility/utility.htm#BOOST_NO_RESULT_OF
  5918. .. |boost_result_of| replace:: ``boost::result_of``
  5919. .. _boost_result_of: ../../../utility/utility.htm#result_of
  5920. .. |boost_is_const| replace:: boost::is_const
  5921. .. _boost_is_const: ../../../type_traits/doc/html/boost_typetraits/is_const.html
  5922. .. |boost_is_convertible| replace:: boost::is_convertible
  5923. .. _boost_is_convertible: ../../../type_traits/doc/html/boost_typetraits/is_convertible.html
  5924. .. |boost_is_same| replace:: boost::is_same
  5925. .. _boost_is_same: ../../../type_traits/doc/html/boost_typetraits/is_same.html
  5926. .. |boost_is_scalar| replace:: boost::is_scalar
  5927. .. _boost_is_scalar: ../../../type_traits/doc/html/boost_typetraits/is_scalar.html
  5928. .. |boost_add_lvalue_reference| replace:: boost::add_lvalue_reference
  5929. .. _boost_add_lvalue_reference: ../../../type_traits/doc/html/boost_typetraits/add_lvalue_reference.html
  5930. .. |boost_remove_reference| replace:: boost::remove_reference
  5931. .. _boost_remove_reference: ../../../type_traits/doc/html/boost_typetraits/remove_reference.html
  5932. .. |Boost_MPL| replace:: Boost.MPL
  5933. .. _Boost_MPL: ../../../mpl/doc/index.html
  5934. .. _`Metafunction`: ../../../mpl/doc/refmanual/metafunction.html
  5935. .. _`Boolean Integral Constant`: ../../../mpl/doc/refmanual/integral-constant.html
  5936. .. _`MPL Binary Metafunction Class`: ../../../mpl/doc/refmanual/metafunction-class.html
  5937. .. _`MPL Forward Sequence`: ../../../mpl/doc/refmanual/forward-sequence.html
  5938. .. _`MPL Associative Sequence`: ../../../mpl/doc/refmanual/associative-sequence.html
  5939. .. _`MPL Variadic Sequence`: ../../../mpl/doc/refmanual/variadic-sequence.html
  5940. .. |BOOST_MPL_LIMIT_VECTOR_SIZE| replace:: ``BOOST_MPL_LIMIT_VECTOR_SIZE``
  5941. .. _BOOST_MPL_LIMIT_VECTOR_SIZE: ../../../mpl/doc/refmanual/limit-vector-size.html
  5942. .. |mpl_eval_if| replace:: boost::mpl::eval_if
  5943. .. _mpl_eval_if: ../../../mpl/doc/refmanual/eval-if.html
  5944. .. |mpl_true| replace:: mpl::true\_
  5945. .. _mpl_true: ../../../mpl/doc/refmanual/bool.html
  5946. .. |mpl_false| replace:: mpl::false\_
  5947. .. _mpl_false: ../../../mpl/doc/refmanual/bool.html
  5948. .. |mpl_if| replace:: mpl::if\_
  5949. .. _mpl_if: ../../../mpl/doc/refmanual/if.html
  5950. .. |mpl_vector| replace:: ``boost::mpl::vector``
  5951. .. _mpl_vector: ../../../mpl/doc/refmanual/vector.html
  5952. .. |Boost_MP11| replace:: Boost.MP11
  5953. .. _Boost_MP11: ../../../mp11/doc/html/mp11.html
  5954. .. |mp11_quote| replace:: boost::mp11::mp_quote
  5955. .. _mp11_quote: ../../../mp11/doc/html/mp11.html#mp_quotef
  5956. .. |mp11_1| replace:: boost::mp11::_1
  5957. .. _mp11_1: ../../../mp11/doc/html/mp11.html#1_9
  5958. .. |mp11_2| replace:: boost::mp11::_2
  5959. .. _mp11_2: ../../../mp11/doc/html/mp11.html#1_9
  5960. .. |mp11_bind| replace:: boost::mp11::mp_bind
  5961. .. _mp11_bind: ../../../mp11/doc/html/mp11.html#mp_bindf_t
  5962. .. |mp11_bind_q| replace:: boost::mp11::mp_bind_q
  5963. .. _mp11_bind_q: ../../../mp11/doc/html/mp11.html#mp_bind_qq_t
  5964. .. |mp11_list| replace:: ``boost::mp11::mp_list``
  5965. .. _mp11_list: ../../../mp11/doc/html/mp11.html#mp_listt
  5966. .. |Boost_Fusion| replace:: Boost.Fusion
  5967. .. _Boost_Fusion: ../../../fusion/doc/html/index.html
  5968. .. |BOOST_FUSION_HAS_VARIADIC_DEQUE| replace:: ``BOOST_FUSION_HAS_VARIADIC_DEQUE``
  5969. .. _BOOST_FUSION_HAS_VARIADIC_DEQUE: ../../../../boost/fusion/container/deque/deque_fwd.hpp
  5970. .. |BOOST_FUSION_HAS_VARIADIC_LIST| replace:: ``BOOST_FUSION_HAS_VARIADIC_LIST``
  5971. .. _BOOST_FUSION_HAS_VARIADIC_LIST: ../../../../boost/fusion/container/list/list_fwd.hpp
  5972. .. |fusion_vector| replace:: ``boost::fusion::vector``
  5973. .. _fusion_vector: ../../../fusion/doc/html/fusion/container/vector.html
  5974. .. |fusion_deque| replace:: ``boost::fusion::deque``
  5975. .. _fusion_deque: ../../../fusion/doc/html/fusion/container/deque.html
  5976. .. |fusion_list| replace:: ``boost::fusion::list``
  5977. .. _fusion_list: ../../../fusion/doc/html/fusion/container/list.html
  5978. .. |config_header| replace:: boost/parameter/config.hpp
  5979. .. _config_header: ../../../../boost/parameter/config.hpp
  5980. .. |binding_header| replace:: boost/parameter/binding.hpp
  5981. .. _binding_header: ../../../../boost/parameter/binding.hpp
  5982. .. |value_type_header| replace:: boost/parameter/value_type.hpp
  5983. .. _value_type_header: ../../../../boost/parameter/value_type.hpp
  5984. .. |are_tagged_arguments_header| replace:: boost/parameter/are_tagged_arguments.hpp
  5985. .. _are_tagged_arguments_header: ../../../../boost/parameter/are_tagged_arguments.hpp
  5986. .. |is_argument_pack_header| replace:: boost/parameter/is_argument_pack.hpp
  5987. .. _is_argument_pack_header: ../../../../boost/parameter/is_argument_pack.hpp
  5988. .. |template_keyword_header| replace:: boost/parameter/template_keyword.hpp
  5989. .. _template_keyword_header: ../../../../boost/parameter/template_keyword.hpp
  5990. .. |keyword_header| replace:: boost/parameter/keyword.hpp
  5991. .. _keyword_header: ../../../../boost/parameter/keyword.hpp
  5992. .. |name_header| replace:: boost/parameter/name.hpp
  5993. .. _name_header: ../../../../boost/parameter/name.hpp
  5994. .. |nested_keyword_header| replace:: boost/parameter/nested_keyword.hpp
  5995. .. _nested_keyword_header: ../../../../boost/parameter/nested_keyword.hpp
  5996. .. |compose_header| replace:: boost/parameter/compose.hpp
  5997. .. _compose_header: ../../../../boost/parameter/compose.hpp
  5998. .. |preprocessor_no_spec_header| replace:: boost/parameter/preprocessor_no_spec.hpp
  5999. .. _preprocessor_no_spec_header: ../../../../boost/parameter/preprocessor_no_spec.hpp
  6000. .. |required_header| replace:: boost/parameter/required.hpp
  6001. .. _required_header: ../../../../boost/parameter/required.hpp
  6002. .. |optional_header| replace:: boost/parameter/optional.hpp
  6003. .. _optional_header: ../../../../boost/parameter/optional.hpp
  6004. .. |deduced_header| replace:: boost/parameter/deduced.hpp
  6005. .. _deduced_header: ../../../../boost/parameter/deduced.hpp
  6006. .. |parameters_header| replace:: boost/parameter/parameters.hpp
  6007. .. _parameters_header: ../../../../boost/parameter/parameters.hpp
  6008. .. |match_header| replace:: boost/parameter/match.hpp
  6009. .. _match_header: ../../../../boost/parameter/match.hpp
  6010. .. |macros_header| replace:: boost/parameter/macros.hpp
  6011. .. _macros_header: ../../../../boost/parameter/macros.hpp
  6012. .. |preprocessor_header| replace:: boost/parameter/preprocessor.hpp
  6013. .. _preprocessor_header: ../../../../boost/parameter/preprocessor.hpp
  6014. .. |function_type_tpl_param_cpp| replace:: function_type_tpl_param.cpp
  6015. .. _function_type_tpl_param_cpp: ../../test/function_type_tpl_param.cpp
  6016. .. |ntp_cpp| replace:: test/ntp.cpp
  6017. .. _ntp_cpp: ../../test/ntp.cpp
  6018. .. |singular_cpp| replace:: singular.cpp
  6019. .. _singular_cpp: ../../test/singular.cpp
  6020. .. |compose_cpp| replace:: compose.cpp
  6021. .. _compose_cpp: ../../test/compose.cpp
  6022. .. |evaluate_category_cpp| replace:: evaluate_category.cpp
  6023. .. _evaluate_category_cpp: ../../test/evaluate_category.cpp
  6024. .. |parameterized_inheritance_cpp| replace:: parameterized_inheritance.cpp
  6025. .. _parameterized_inheritance_cpp: ../../test/parameterized_inheritance.cpp
  6026. .. |preproc_eval_cat_no_spec_cpp| replace:: preprocessor_eval_cat_no_spec.cpp
  6027. .. _preproc_eval_cat_no_spec_cpp: ../../test/preprocessor_eval_cat_no_spec.cpp
  6028. .. |preprocessor_eval_cat_cpp| replace:: preprocessor_eval_category.cpp
  6029. .. _preprocessor_eval_cat_cpp: ../../test/preprocessor_eval_category.cpp
  6030. .. |preprocessor_eval_cat_8_cpp| replace:: preprocessor_eval_cat_8.cpp
  6031. .. _preprocessor_eval_cat_8_cpp: ../../test/preprocessor_eval_cat_8.cpp
  6032. .. |optional_deduced_sfinae_cpp| replace:: optional_deduced_sfinae.cpp
  6033. .. _optional_deduced_sfinae_cpp: ../../test/optional_deduced_sfinae.cpp
  6034. .. |mpl_cpp| replace:: mpl.cpp
  6035. .. _mpl_cpp: ../../test/mpl.cpp
  6036. .. |preprocessor_cpp| replace:: preprocessor.cpp
  6037. .. _preprocessor_cpp: ../../test/preprocessor.cpp
  6038. .. |preprocessor_deduced_cpp| replace:: preprocessor_deduced.cpp
  6039. .. _preprocessor_deduced_cpp: ../../test/preprocessor_deduced.cpp
  6040. .. |deduced_dep_pred_cpp| replace:: deduced_dependent_predicate.cpp
  6041. .. _deduced_dep_pred_cpp: ../../test/deduced_dependent_predicate.cpp
  6042. .. |macros_eval_cat_cpp| replace:: macros_eval_category.cpp
  6043. .. _macros_eval_cat_cpp: ../../test/macros_eval_category.cpp
  6044. .. |macros_cpp| replace:: macros.cpp
  6045. .. _macros_cpp: ../../test/macros.cpp