reference.html 403 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta name="generator" content="Docutils 0.12: http://docutils.sourceforge.net/" />
  7. <title>The Boost Parameter Library Reference Documentation</title>
  8. <meta name="authors" content="David Abrahams Daniel Wallin" />
  9. <meta name="organization" content="BoostPro Computing" />
  10. <meta name="date" content="2005-07-17" />
  11. <meta name="copyright" content="Copyright David Abrahams, Daniel Wallin 2005-2009. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)" />
  12. <link rel="stylesheet" href="rst.css" type="text/css" />
  13. </head>
  14. <body>
  15. <div class="document" id="the-boost-parameter-library-reference-documentation">
  16. <h1 class="title">The Boost Parameter Library Reference Documentation</h1>
  17. <table class="docinfo" frame="void" rules="none">
  18. <col class="docinfo-name" />
  19. <col class="docinfo-content" />
  20. <tbody valign="top">
  21. <tr><th class="docinfo-name">Authors:</th>
  22. <td>David Abrahams
  23. <br />Daniel Wallin</td></tr>
  24. <tr><th class="docinfo-name">Contact:</th>
  25. <td><a class="first reference external" href="mailto:dave&#64;boost-consulting.com">dave&#64;boost-consulting.com</a>, <a class="last reference external" href="mailto:daniel&#64;boostpro.com">daniel&#64;boostpro.com</a></td></tr>
  26. <tr><th class="docinfo-name">Organization:</th>
  27. <td><a class="first last reference external" href="http://www.boostpro.com">BoostPro Computing</a></td></tr>
  28. <tr><th class="docinfo-name">Date:</th>
  29. <td>2005-07-17</td></tr>
  30. <tr><th class="docinfo-name">Copyright:</th>
  31. <td>Copyright David Abrahams, Daniel Wallin
  32. 2005-2009. Distributed under the Boost Software License,
  33. Version 1.0. (See accompanying file LICENSE_1_0.txt
  34. or copy at <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</td></tr>
  35. </tbody>
  36. </table>
  37. <p><a class="reference external" href="../../../../index.htm"><img alt="Boost" src="../../../../boost.png" /></a></p>
  38. <hr class="docutils" />
  39. <div class="contents topic" id="contents">
  40. <p class="topic-title first">Contents</p>
  41. <ul class="auto-toc simple">
  42. <li><a class="reference internal" href="#preliminaries" id="id31">1&nbsp;&nbsp;&nbsp;Preliminaries</a><ul class="auto-toc">
  43. <li><a class="reference internal" href="#namespaces" id="id32">1.1&nbsp;&nbsp;&nbsp;Namespaces</a></li>
  44. <li><a class="reference internal" href="#exceptions" id="id33">1.2&nbsp;&nbsp;&nbsp;Exceptions</a></li>
  45. <li><a class="reference internal" href="#thread-safety" id="id34">1.3&nbsp;&nbsp;&nbsp;Thread Safety</a></li>
  46. <li><a class="reference internal" href="#typography" id="id35">1.4&nbsp;&nbsp;&nbsp;Typography</a></li>
  47. </ul>
  48. </li>
  49. <li><a class="reference internal" href="#terminology" id="id36">2&nbsp;&nbsp;&nbsp;Terminology</a></li>
  50. <li><a class="reference internal" href="#concepts" id="id37">3&nbsp;&nbsp;&nbsp;Concepts</a><ul class="auto-toc">
  51. <li><a class="reference internal" href="#argumentpack" id="id38">3.1&nbsp;&nbsp;&nbsp;<span class="concept">ArgumentPack</span></a></li>
  52. <li><a class="reference internal" href="#id3" id="id39">3.2&nbsp;&nbsp;&nbsp;<span class="concept">ParameterSpec</span></a></li>
  53. </ul>
  54. </li>
  55. <li><a class="reference internal" href="#class-templates" id="id40">4&nbsp;&nbsp;&nbsp;Class Templates</a><ul class="auto-toc">
  56. <li><a class="reference internal" href="#id5" id="id41">4.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">keyword</tt></a></li>
  57. <li><a class="reference internal" href="#id7" id="id42">4.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal">template_keyword</tt></a></li>
  58. <li><a class="reference internal" href="#id8" id="id43">4.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal">parameters</tt></a></li>
  59. <li><a class="reference internal" href="#optional-required" id="id44">4.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal">optional</tt>, <tt class="docutils literal">required</tt></a></li>
  60. <li><a class="reference internal" href="#id9" id="id45">4.5&nbsp;&nbsp;&nbsp;<tt class="docutils literal">deduced</tt></a></li>
  61. </ul>
  62. </li>
  63. <li><a class="reference internal" href="#metafunctions" id="id46">5&nbsp;&nbsp;&nbsp;Metafunctions</a><ul class="auto-toc">
  64. <li><a class="reference internal" href="#id10" id="id47">5.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">binding</tt></a></li>
  65. <li><a class="reference internal" href="#id11" id="id48">5.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal">lazy_binding</tt></a></li>
  66. <li><a class="reference internal" href="#id13" id="id49">5.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal">value_type</tt></a></li>
  67. <li><a class="reference internal" href="#id14" id="id50">5.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal">lazy_value_type</tt></a></li>
  68. <li><a class="reference internal" href="#id16" id="id51">5.5&nbsp;&nbsp;&nbsp;<tt class="docutils literal">are_tagged_arguments</tt></a></li>
  69. <li><a class="reference internal" href="#id17" id="id52">5.6&nbsp;&nbsp;&nbsp;<tt class="docutils literal">is_argument_pack</tt></a></li>
  70. <li><a class="reference internal" href="#id18" id="id53">5.7&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">result_of::compose</span></tt></a></li>
  71. </ul>
  72. </li>
  73. <li><a class="reference internal" href="#function-templates" id="id54">6&nbsp;&nbsp;&nbsp;Function Templates</a><ul class="auto-toc">
  74. <li><a class="reference internal" href="#id19" id="id55">6.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">compose</tt></a></li>
  75. </ul>
  76. </li>
  77. <li><a class="reference internal" href="#code-generation-macros" id="id56">7&nbsp;&nbsp;&nbsp;Code Generation Macros</a><ul class="auto-toc">
  78. <li><a class="reference internal" href="#boost-parameter-function-result-name-tag-namespace-arguments" id="id57">7.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_FUNCTION(result, name, tag_namespace, arguments)</tt></a></li>
  79. <li><a class="reference internal" href="#boost-parameter-member-function-result-name-tag-namespace-arguments" id="id58">7.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_MEMBER_FUNCTION(result, name, tag_namespace, arguments)</tt></a></li>
  80. <li><a class="reference internal" href="#boost-parameter-const-member-function-result-name-tag-ns-arguments" id="id59">7.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_CONST_MEMBER_FUNCTION(result, name, tag_ns, arguments)</tt></a></li>
  81. <li><a class="reference internal" href="#boost-parameter-function-call-operator-result-tag-namespace-arguments" id="id60">7.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_FUNCTION_CALL_OPERATOR(result, tag_namespace, arguments)</tt></a></li>
  82. <li><a class="reference internal" href="#boost-parameter-const-function-call-operator-result-tag-ns-arguments" id="id61">7.5&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, arguments)</tt></a></li>
  83. <li><a class="reference internal" href="#boost-parameter-constructor-cls-impl-tag-namespace-arguments" id="id62">7.6&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_CONSTRUCTOR(cls, impl, tag_namespace, arguments)</tt></a></li>
  84. <li><a class="reference internal" href="#boost-parameter-basic-function-result-name-tag-namespace-arguments" id="id63">7.7&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_BASIC_FUNCTION(result, name, tag_namespace, arguments)</tt></a></li>
  85. <li><a class="reference internal" href="#boost-parameter-basic-member-function-result-name-tag-ns-arguments" id="id64">7.8&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_BASIC_MEMBER_FUNCTION(result, name, tag_ns, arguments)</tt></a></li>
  86. <li><a class="reference internal" href="#boost-parameter-basic-const-member-function-result-name-tag-ns-args" id="id65">7.9&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION(result, name, tag_ns, args)</tt></a></li>
  87. <li><a class="reference internal" href="#boost-parameter-basic-function-call-operator-result-tag-ns-arguments" id="id66">7.10&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR(result, tag_ns, arguments)</tt></a></li>
  88. <li><a class="reference internal" href="#boost-parameter-basic-const-function-call-operator-result-tag-ns-args" id="id67">7.11&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, args)</tt></a></li>
  89. <li><a class="reference internal" href="#boost-parameter-no-spec-function-result-name" id="id68">7.12&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_FUNCTION(result, name)</tt></a></li>
  90. <li><a class="reference internal" href="#boost-parameter-no-spec-member-function-result-name" id="id69">7.13&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION(result, name)</tt></a></li>
  91. <li><a class="reference internal" href="#boost-parameter-no-spec-const-member-function-result-name" id="id70">7.14&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION(result, name)</tt></a></li>
  92. <li><a class="reference internal" href="#boost-parameter-no-spec-function-call-operator-result" id="id71">7.15&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR(result)</tt></a></li>
  93. <li><a class="reference internal" href="#boost-parameter-no-spec-const-function-call-operator-result" id="id72">7.16&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR(result)</tt></a></li>
  94. <li><a class="reference internal" href="#boost-parameter-no-spec-constructor-cls-impl" id="id73">7.17&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(cls, impl)</tt></a></li>
  95. <li><a class="reference internal" href="#boost-parameter-no-spec-no-base-constructor-cls-impl" id="id74">7.18&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(cls, impl)</tt></a></li>
  96. <li><a class="reference internal" href="#boost-parameter-name-name" id="id75">7.19&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NAME(name)</tt></a></li>
  97. <li><a class="reference internal" href="#boost-parameter-nested-keyword-tag-namespace-name-alias" id="id76">7.20&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NESTED_KEYWORD(tag_namespace, name, alias)</tt></a></li>
  98. <li><a class="reference internal" href="#boost-parameter-template-keyword-name" id="id77">7.21&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_TEMPLATE_KEYWORD(name)</tt></a></li>
  99. <li><a class="reference internal" href="#boost-parameter-fun-r-n-l-h-p" id="id78">7.22&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_FUN(r, n, l, h, p)</tt></a></li>
  100. <li><a class="reference internal" href="#boost-parameter-keyword-n-k" id="id79">7.23&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_KEYWORD(n, k)</tt></a></li>
  101. <li><a class="reference internal" href="#boost-parameter-match-p-a-x" id="id80">7.24&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_MATCH(p, a, x)</tt></a></li>
  102. </ul>
  103. </li>
  104. <li><a class="reference internal" href="#configuration-macros" id="id81">8&nbsp;&nbsp;&nbsp;Configuration Macros</a><ul class="auto-toc">
  105. <li><a class="reference internal" href="#id21" id="id82">8.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a></li>
  106. <li><a class="reference internal" href="#id22" id="id83">8.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING</tt></a></li>
  107. <li><a class="reference internal" href="#id23" id="id84">8.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a></li>
  108. <li><a class="reference internal" href="#id24" id="id85">8.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_DISABLE_MP11_USAGE</tt></a></li>
  109. <li><a class="reference internal" href="#id25" id="id86">8.5&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE</tt></a></li>
  110. <li><a class="reference internal" href="#id26" id="id87">8.6&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_MAX_ARITY</tt></a></li>
  111. <li><a class="reference internal" href="#id27" id="id88">8.7&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_COMPOSE_MAX_ARITY</tt></a></li>
  112. <li><a class="reference internal" href="#id28" id="id89">8.8&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY</tt></a></li>
  113. <li><a class="reference internal" href="#outside-of-this-library" id="id90">8.9&nbsp;&nbsp;&nbsp;...Outside Of This Library</a></li>
  114. </ul>
  115. </li>
  116. <li><a class="reference internal" href="#tutorial" id="id91">9&nbsp;&nbsp;&nbsp;Tutorial</a></li>
  117. </ul>
  118. </div>
  119. <hr class="docutils" />
  120. <div class="section" id="preliminaries">
  121. <h1><a class="toc-backref" href="#id31">1&nbsp;&nbsp;&nbsp;Preliminaries</a></h1>
  122. <p>This section covers some basic information you'll need to know in order to
  123. understand this reference.</p>
  124. <div class="section" id="namespaces">
  125. <h2><a class="toc-backref" href="#id32">1.1&nbsp;&nbsp;&nbsp;Namespaces</a></h2>
  126. <p>In this document, all unqualified identifiers should be assumed to be defined
  127. in namespace <tt class="docutils literal"><span class="pre">boost::parameter</span></tt> unless otherwise specified.</p>
  128. </div>
  129. <div class="section" id="exceptions">
  130. <h2><a class="toc-backref" href="#id33">1.2&nbsp;&nbsp;&nbsp;Exceptions</a></h2>
  131. <p>No operation described in this document throws an exception unless otherwise
  132. specified.</p>
  133. </div>
  134. <div class="section" id="thread-safety">
  135. <h2><a class="toc-backref" href="#id34">1.3&nbsp;&nbsp;&nbsp;Thread Safety</a></h2>
  136. <p>All components of this library can be used safely from multiple threads
  137. without synchronization.<a class="footnote-reference" href="#thread" id="id2"><sup>1</sup></a></p>
  138. </div>
  139. <div class="section" id="typography">
  140. <h2><a class="toc-backref" href="#id35">1.4&nbsp;&nbsp;&nbsp;Typography</a></h2>
  141. <p>Names written in <span class="concept">sans serif type</span> represent <a class="reference internal" href="#concepts">concepts</a>.</p>
  142. <p>In code blocks, <em>italic type</em> represents unspecified text that satisfies the
  143. requirements given in the detailed description that follows the code block.</p>
  144. <p>In a specification of the tokens generated by a macro, <strong>bold type</strong> is used
  145. to highlight the position of the expanded macro argument in the result.</p>
  146. <p>The special character β represents the value of <a class="reference internal" href="#boost-parameter-max-arity"><tt class="docutils literal">BOOST_PARAMETER_MAX_ARITY</tt></a>.</p>
  147. </div>
  148. </div>
  149. <hr class="docutils" />
  150. <div class="section" id="terminology">
  151. <h1><a class="toc-backref" href="#id36">2&nbsp;&nbsp;&nbsp;Terminology</a></h1>
  152. <dl class="docutils" id="kw">
  153. <dt>keyword</dt>
  154. <dd>The name of a function parameter.</dd>
  155. </dl>
  156. <span class="target" id="keyword-tag-type"></span><dl class="docutils">
  157. <dt>keyword tag type</dt>
  158. <dd>A type used to uniquely identify a function parameter. Typically its name
  159. will be the same as that of the parameter.</dd>
  160. </dl>
  161. <span class="target" id="positional"></span><dl class="docutils">
  162. <dt>positional argument</dt>
  163. <dd>An argument passed with no explicit keyword. Its parameter is determined
  164. in the usual C++ way: by position with respect to a parameter list.</dd>
  165. </dl>
  166. <span class="target" id="tag-type"></span><dl class="docutils">
  167. <dt>tag type</dt>
  168. <dd>Shorthand for “<a class="reference internal" href="#keyword-tag-type">keyword tag type</a>.”</dd>
  169. </dl>
  170. <span class="target" id="keyword-object"></span><dl class="docutils">
  171. <dt>keyword object</dt>
  172. <dd>An instance of <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><tt class="docutils literal">&lt;T&gt;</tt> for some <a class="reference internal" href="#tag-type">tag type</a> <tt class="docutils literal">T</tt>.</dd>
  173. </dl>
  174. <span class="target" id="tagged-reference"></span><dl class="docutils">
  175. <dt>tagged reference</dt>
  176. <dd><p class="first">An object whose type is associated with a <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> (the object's
  177. <em>keyword</em>), and that holds a reference (to the object's <em>value</em>).</p>
  178. <p class="last">As a shorthand, a “tagged reference to <tt class="docutils literal">x</tt>” means a tagged reference
  179. whose <em>value</em> is <tt class="docutils literal">x</tt>.</p>
  180. </dd>
  181. </dl>
  182. <span class="target" id="tagged-default"></span><dl class="docutils">
  183. <dt>tagged default</dt>
  184. <dd>A <a class="reference internal" href="#tagged-reference">tagged reference</a> whose <em>value</em> represents the value of a
  185. default argument.</dd>
  186. </dl>
  187. <span class="target" id="tagged-lazy-default"></span><dl class="docutils">
  188. <dt>tagged lazy default</dt>
  189. <dd>A <a class="reference internal" href="#tagged-reference">tagged reference</a> whose <em>value</em>, when invoked with no arguments,
  190. computes a default argument value.</dd>
  191. </dl>
  192. <span class="target" id="intended-argument-type"></span><dl class="docutils">
  193. <dt>intended argument type</dt>
  194. <dd>The <em>intended argument type</em> of a single-element <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> is the
  195. type of its element's <em>value</em>. The intended argument type of any other
  196. type <tt class="docutils literal">X</tt> is <tt class="docutils literal">X</tt> itself.</dd>
  197. </dl>
  198. <div class="note">
  199. <p class="first admonition-title">Note</p>
  200. <p class="last">In this reference, we will use concept names (and other names) to describe
  201. both types and objects, depending on context. So for example, “an
  202. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>” can refer to a type that models <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>
  203. <em>or</em> an object of such a type.</p>
  204. </div>
  205. </div>
  206. <hr class="docutils" />
  207. <div class="section" id="concepts">
  208. <h1><a class="toc-backref" href="#id37">3&nbsp;&nbsp;&nbsp;Concepts</a></h1>
  209. <p>This section describes the generic type concepts used by the Parameter
  210. library.</p>
  211. <div class="section" id="argumentpack">
  212. <h2><a class="toc-backref" href="#id38">3.1&nbsp;&nbsp;&nbsp;<span class="concept">ArgumentPack</span></a></h2>
  213. <p>An <span class="concept">ArgumentPack</span> is a collection of <a class="reference internal" href="#tagged-reference">tagged reference</a>s to the actual
  214. arguments passed to a function. Every <span class="concept">ArgumentPack</span> is also a valid <a class="reference external" href="../../../mpl/doc/refmanual/forward-sequence.html">MPL
  215. Forward Sequence</a> and <a class="reference external" href="../../../mpl/doc/refmanual/associative-sequence.html">MPL Associative Sequence</a> consisting of the <a class="reference internal" href="#keyword-tag-type">keyword tag type</a>s in its <a class="reference internal" href="#tagged-reference">tagged reference</a>s. If <tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt>
  216. is defined, then every <span class="concept">ArgumentPack</span> is also a valid <a class="reference external" href="../../../mp11/doc/html/mp11.html">Boost.MP11</a> map whose
  217. keys are <a class="reference internal" href="#keyword-tag-type">keyword tag type</a>s. The <a class="reference external" href="../../test/singular.cpp">singular.cpp</a>, <a class="reference external" href="../../test/compose.cpp">compose.cpp</a>, and
  218. <a class="reference external" href="../../test/mpl.cpp">mpl.cpp</a> test programs demonstrate this functionality.</p>
  219. <div class="section" id="requirements">
  220. <h3>Requirements</h3>
  221. <p>In the table below,</p>
  222. <ul class="simple">
  223. <li><tt class="docutils literal">A</tt> is a model of <span class="concept">ArgumentPack</span></li>
  224. <li><tt class="docutils literal">x</tt> is an instance of <tt class="docutils literal">A</tt></li>
  225. <li><tt class="docutils literal">u</tt> is a <a class="reference internal" href="#keyword-object">keyword object</a> of type <tt class="docutils literal">K</tt></li>
  226. <li><tt class="docutils literal">v</tt> is a <a class="reference internal" href="#tagged-default">tagged default</a> with <a class="reference internal" href="#tag-type">tag type</a> <tt class="docutils literal">L</tt> and <em>value</em> of type <tt class="docutils literal">D</tt></li>
  227. <li><tt class="docutils literal">w</tt> is a <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a> with <a class="reference internal" href="#tag-type">tag type</a> <tt class="docutils literal">M</tt> and <em>value</em> of type <tt class="docutils literal">E const</tt></li>
  228. <li><tt class="docutils literal">z</tt> is an <span class="concept">ArgumentPack</span> containing a single element (as created by <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><tt class="docutils literal"><span class="pre">&lt;…&gt;::operator=</span></tt>)</li>
  229. </ul>
  230. <p>Any exceptions thrown from the invocation of <tt class="docutils literal">w</tt>'s <em>value</em>
  231. will be propagated to the caller.</p>
  232. <table border="1" class="docutils">
  233. <caption><span class="concept">ArgumentPack</span> requirements</caption>
  234. <colgroup>
  235. <col width="14%" />
  236. <col width="40%" />
  237. <col width="19%" />
  238. <col width="27%" />
  239. </colgroup>
  240. <thead valign="bottom">
  241. <tr><th class="head">Expression</th>
  242. <th class="head">Type</th>
  243. <th class="head">Requirements</th>
  244. <th class="head">Semantics/Notes</th>
  245. </tr>
  246. </thead>
  247. <tbody valign="top">
  248. <tr><td><tt class="docutils literal">x[u]</tt></td>
  249. <td><tt class="docutils literal">binding&lt;A, <span class="pre">K&gt;::type</span></tt></td>
  250. <td><tt class="docutils literal">x</tt> contains
  251. an element <em>b</em>
  252. whose <a class="reference internal" href="#kw">keyword</a> is
  253. <tt class="docutils literal">K</tt></td>
  254. <td>Returns <em>b</em>'s
  255. <em>value</em> (by
  256. reference).</td>
  257. </tr>
  258. <tr><td><tt class="docutils literal">x[u]</tt></td>
  259. <td><tt class="docutils literal">binding&lt;A, L, <span class="pre">D&gt;::type</span></tt></td>
  260. <td><em>none</em></td>
  261. <td>If <tt class="docutils literal">x</tt> contains an
  262. element <em>b</em> whose
  263. <a class="reference internal" href="#kw">keyword</a> is the same as
  264. <tt class="docutils literal">u</tt>'s, returns
  265. <em>b</em>'s <em>value</em> (by
  266. reference).
  267. Otherwise, returns
  268. <tt class="docutils literal">u</tt>'s <em>value</em>.</td>
  269. </tr>
  270. <tr><td><tt class="docutils literal">x[w]</tt></td>
  271. <td><tt class="docutils literal">lazy_binding&lt;A, M, <span class="pre">E&gt;::type</span></tt></td>
  272. <td><em>none</em></td>
  273. <td>If <tt class="docutils literal">x</tt> contains an
  274. element <em>b</em> whose
  275. <a class="reference internal" href="#kw">keyword</a> is the same as
  276. <tt class="docutils literal">w</tt>'s, returns
  277. <em>b</em>'s <em>value</em> (by
  278. reference).
  279. Otherwise, invokes
  280. <tt class="docutils literal">w</tt>'s <em>value</em>
  281. and returns the
  282. result.</td>
  283. </tr>
  284. <tr><td><tt class="docutils literal">x, z</tt></td>
  285. <td>Model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a></td>
  286. <td><em>none</em></td>
  287. <td>Returns an
  288. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>
  289. containing all the
  290. elements of both
  291. <tt class="docutils literal">x</tt> and <tt class="docutils literal">z</tt>.</td>
  292. </tr>
  293. </tbody>
  294. </table>
  295. </div>
  296. </div>
  297. <div class="section" id="id3">
  298. <span id="parameterspec"></span><h2><a class="toc-backref" href="#id39">3.2&nbsp;&nbsp;&nbsp;<span class="concept">ParameterSpec</span></a></h2>
  299. <p>A <span class="concept">ParameterSpec</span> describes the type requirements for arguments corresponding
  300. to a given <a class="reference internal" href="#kw">keyword</a> and indicates whether the argument is optional or
  301. required. The table below details the allowed forms and describes their
  302. condition for satisfaction by an actual argument type. In each row,</p>
  303. <ul class="simple" id="conditions">
  304. <li><tt class="docutils literal">K</tt> is the <span class="concept">ParameterSpec</span>'s <a class="reference internal" href="#keyword-tag-type">keyword tag type</a></li>
  305. <li><tt class="docutils literal">A</tt> is an <a class="reference internal" href="#intended-argument-type">intended argument type</a> associated with <tt class="docutils literal">K</tt>, if any</li>
  306. <li><tt class="docutils literal">P</tt> is a model of <span class="concept">ArgumentPack</span> that contains <tt class="docutils literal">A</tt></li>
  307. <li><tt class="docutils literal">F</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary Metafunction Class</a></li>
  308. </ul>
  309. <table border="1" class="docutils">
  310. <caption><span class="concept">ParameterSpec</span> allowed forms and conditions of satisfaction</caption>
  311. <colgroup>
  312. <col width="32%" />
  313. <col width="14%" />
  314. <col width="54%" />
  315. </colgroup>
  316. <thead valign="bottom">
  317. <tr><th class="head">Type</th>
  318. <th class="head"><tt class="docutils literal">A</tt>
  319. required</th>
  320. <th class="head">Condition <tt class="docutils literal">A</tt> must satisfy</th>
  321. </tr>
  322. </thead>
  323. <tbody valign="top">
  324. <tr><td><tt class="docutils literal">K</tt></td>
  325. <td>no</td>
  326. <td><em>n/a</em></td>
  327. </tr>
  328. <tr><td><a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a><tt class="docutils literal">&lt;K,F&gt;</tt></td>
  329. <td>no</td>
  330. <td><tt class="docutils literal"><span class="pre">mpl::apply2&lt;F,A,P&gt;::type::value</span></tt> is
  331. <tt class="docutils literal">true</tt>.</td>
  332. </tr>
  333. <tr><td><a class="reference internal" href="#required"><tt class="docutils literal">required</tt></a><tt class="docutils literal">&lt;K,F&gt;</tt></td>
  334. <td>yes</td>
  335. <td><tt class="docutils literal"><span class="pre">mpl::apply2&lt;F,A,P&gt;::type::value</span></tt> is
  336. <tt class="docutils literal">true</tt>.</td>
  337. </tr>
  338. </tbody>
  339. </table>
  340. <p>The information in a <span class="concept">ParameterSpec</span> is used to <a class="reference external" href="index.html#controlling-overload-resolution">limit</a> the arguments that
  341. will be matched by <a class="reference external" href="index.html#forwarding-functions">forwarding functions</a>.</p>
  342. </div>
  343. </div>
  344. <hr class="docutils" />
  345. <div class="section" id="class-templates">
  346. <h1><a class="toc-backref" href="#id40">4&nbsp;&nbsp;&nbsp;Class Templates</a></h1>
  347. <div class="section" id="id5">
  348. <span id="keyword"></span><h2><a class="toc-backref" href="#id41">4.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">keyword</tt></a></h2>
  349. <p>The type of every <a class="reference internal" href="#keyword-object">keyword object</a> is a specialization of <tt class="docutils literal">keyword</tt>.</p>
  350. <table class="docutils field-list" frame="void" rules="none">
  351. <col class="field-name" />
  352. <col class="field-body" />
  353. <tbody valign="top">
  354. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/keyword.hpp">boost/parameter/keyword.hpp</a></td>
  355. </tr>
  356. </tbody>
  357. </table>
  358. <pre class="literal-block">
  359. template &lt;typename Tag&gt;
  360. struct keyword
  361. {
  362. typedef Tag tag;
  363. template &lt;typename T&gt;
  364. constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  365. typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  366. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_scalar.html">boost::is_scalar</a>&lt;T&gt;
  367. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for scalar types.
  368. , <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  369. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  370. typename Tag::qualifier
  371. , boost::parameter::in_reference
  372. &gt;
  373. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for &quot;in&quot; references.
  374. , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a>&lt;
  375. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  376. typename Tag::qualifier
  377. , boost::parameter::forward_reference
  378. &gt;
  379. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for &quot;forward&quot; references.
  380. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for all other reference categories.
  381. &gt;
  382. &gt;
  383. &gt;::type
  384. , <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>
  385. &gt;::type
  386. <a class="reference internal" href="#assignment-operator"><tt class="docutils literal">operator=</tt></a>(T const&amp; value) const;
  387. template &lt;typename T&gt;
  388. constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  389. typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  390. typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  391. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  392. typename Tag::qualifier
  393. , boost::parameter::out_reference
  394. &gt;
  395. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // The reference category is &quot;out&quot;.
  396. , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a>&lt;
  397. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  398. typename Tag::qualifier
  399. , boost::parameter::forward_reference
  400. &gt;
  401. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // The reference category is &quot;forward&quot;.
  402. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // The reference category is neither &quot;out&quot; nor &quot;forward&quot;.
  403. &gt;
  404. &gt;::type
  405. , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a>&lt;
  406. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_const.html">boost::is_const</a>&lt;T&gt;
  407. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for reference-to-const types.
  408. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for referece-to-mutable types.
  409. &gt;
  410. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for references neither &quot;out&quot; nor &quot;forward&quot;.
  411. &gt;::type
  412. , <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>
  413. &gt;::type
  414. <a class="reference internal" href="#assignment-operator"><tt class="docutils literal">operator=</tt></a>(T&amp; value) const;
  415. template &lt;typename T&gt;
  416. constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  417. typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  418. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_scalar.html">boost::is_scalar</a>&lt;T&gt;
  419. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for scalar types.
  420. , <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  421. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  422. typename Tag::qualifier
  423. , boost::parameter::in_reference
  424. &gt;
  425. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for &quot;in&quot; references.
  426. , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a>&lt;
  427. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  428. typename Tag::qualifier
  429. , boost::parameter::forward_reference
  430. &gt;
  431. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for &quot;forward&quot; references.
  432. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for all other reference categories.
  433. &gt;
  434. &gt;
  435. &gt;::type
  436. , <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>
  437. &gt;::type
  438. <a class="reference internal" href="#assignment-operator"><tt class="docutils literal">operator=</tt></a>(T const&amp;&amp; value) const;
  439. template &lt;typename T&gt;
  440. constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  441. typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  442. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_scalar.html">boost::is_scalar</a>&lt;T&gt;
  443. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for scalar types.
  444. , <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  445. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  446. typename Tag::qualifier
  447. , boost::parameter::consume_reference
  448. &gt;
  449. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for &quot;consume&quot; references.
  450. , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a>&lt;
  451. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  452. typename Tag::qualifier
  453. , boost::parameter::forward_reference
  454. &gt;
  455. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for &quot;forward&quot; references.
  456. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for all other reference categories.
  457. &gt;
  458. &gt;
  459. &gt;::type
  460. , <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>
  461. &gt;::type
  462. <a class="reference internal" href="#assignment-operator"><tt class="docutils literal">operator=</tt></a>(T&amp;&amp; value) const;
  463. template &lt;typename T&gt;
  464. constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  465. typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  466. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_scalar.html">boost::is_scalar</a>&lt;T&gt;
  467. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for scalar types.
  468. , <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  469. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  470. typename Tag::qualifier
  471. , boost::parameter::in_reference
  472. &gt;
  473. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for &quot;in&quot; references.
  474. , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a>&lt;
  475. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  476. typename Tag::qualifier
  477. , boost::parameter::forward_reference
  478. &gt;
  479. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for &quot;forward&quot; references.
  480. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for all other reference categories.
  481. &gt;
  482. &gt;
  483. &gt;::type
  484. , <em>tagged default</em>
  485. &gt;::type
  486. <a class="reference internal" href="#bitwise-or-operator"><tt class="docutils literal">operator|</tt></a>(T const&amp; x) const;
  487. template &lt;typename T&gt;
  488. constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  489. typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  490. typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  491. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  492. typename Tag::qualifier
  493. , boost::parameter::out_reference
  494. &gt;
  495. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // The reference category is &quot;out&quot;.
  496. , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a>&lt;
  497. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  498. typename Tag::qualifier
  499. , boost::parameter::forward_reference
  500. &gt;
  501. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // The reference category is &quot;forward&quot;.
  502. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // The reference category is neither &quot;out&quot; nor &quot;forward&quot;.
  503. &gt;
  504. &gt;::type
  505. , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a>&lt;
  506. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_const.html">boost::is_const</a>&lt;T&gt;
  507. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for reference-to-const types.
  508. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for referece-to-mutable types.
  509. &gt;
  510. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for references neither &quot;out&quot; nor &quot;forward&quot;.
  511. &gt;::type
  512. , <em>tagged default</em>
  513. &gt;::type
  514. <a class="reference internal" href="#bitwise-or-operator"><tt class="docutils literal">operator|</tt></a>(T&amp; x) const;
  515. template &lt;typename T&gt;
  516. constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  517. typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  518. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_scalar.html">boost::is_scalar</a>&lt;T&gt;
  519. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for scalar types.
  520. , <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  521. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  522. typename Tag::qualifier
  523. , boost::parameter::in_reference
  524. &gt;
  525. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for &quot;in&quot; references.
  526. , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a>&lt;
  527. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  528. typename Tag::qualifier
  529. , boost::parameter::forward_reference
  530. &gt;
  531. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for &quot;forward&quot; references.
  532. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for all other reference categories.
  533. &gt;
  534. &gt;
  535. &gt;::type
  536. , <em>tagged default</em>
  537. &gt;::type
  538. <a class="reference internal" href="#bitwise-or-operator"><tt class="docutils literal">operator|</tt></a>(T const&amp;&amp; x) const;
  539. template &lt;typename T&gt;
  540. constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  541. typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  542. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_scalar.html">boost::is_scalar</a>&lt;T&gt;
  543. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for scalar types.
  544. , <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a>&lt;
  545. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  546. typename Tag::qualifier
  547. , boost::parameter::consume_reference
  548. &gt;
  549. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for &quot;consume&quot; references.
  550. , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a>&lt;
  551. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  552. typename Tag::qualifier
  553. , boost::parameter::forward_reference
  554. &gt;
  555. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for &quot;forward&quot; references.
  556. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for all other reference categories.
  557. &gt;
  558. &gt;
  559. &gt;::type
  560. , <em>tagged default</em>
  561. &gt;::type constexpr
  562. <a class="reference internal" href="#bitwise-or-operator"><tt class="docutils literal">operator|</tt></a>(T&amp;&amp; value) const;
  563. template &lt;typename F&gt;
  564. constexpr <em>tagged lazy default</em> <a class="reference internal" href="#logical-or-operator"><tt class="docutils literal">operator||</tt></a>(F const&amp;) const;
  565. template &lt;typename F&gt;
  566. constexpr <em>tagged lazy default</em> <a class="reference internal" href="#logical-or-operator"><tt class="docutils literal">operator||</tt></a>(F&amp;) const;
  567. static keyword&lt;Tag&gt; const&amp; instance;
  568. static keyword&lt;Tag&gt;&amp; <a class="reference internal" href="#get">get</a>();
  569. };
  570. </pre>
  571. <p id="assignment-operator"><tt class="docutils literal">operator=</tt></p>
  572. <table class="docutils field-list" frame="void" rules="none">
  573. <col class="field-name" />
  574. <col class="field-body" />
  575. <tbody valign="top">
  576. <tr class="field"><th class="field-name">Synopsis:</th><td class="field-body"></td>
  577. </tr>
  578. </tbody>
  579. </table>
  580. <pre class="literal-block">
  581. template &lt;typename T&gt;
  582. constexpr <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T const&amp; value) const;
  583. template &lt;typename T&gt;
  584. constexpr <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T&amp; value) const;
  585. template &lt;typename T&gt;
  586. constexpr <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T const&amp;&amp; value) const;
  587. template &lt;typename T&gt;
  588. constexpr <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T&amp;&amp; value) const;
  589. </pre>
  590. <table class="docutils field-list" frame="void" rules="none">
  591. <col class="field-name" />
  592. <col class="field-body" />
  593. <tbody valign="top">
  594. <tr class="field"><th class="field-name">Requires:</th><td class="field-body">one of the following:</td>
  595. </tr>
  596. </tbody>
  597. </table>
  598. <ul class="simple">
  599. <li>The nested <tt class="docutils literal">qualifier</tt> type of <tt class="docutils literal">Tag</tt> must be <tt class="docutils literal">forward_reference</tt>.</li>
  600. <li>To use the <tt class="docutils literal">const</tt> lvalue reference overload, <tt class="docutils literal">T</tt> must be scalar, or
  601. the nested <tt class="docutils literal">qualifier</tt> type of <tt class="docutils literal">Tag</tt> must be <tt class="docutils literal">in_reference</tt>.</li>
  602. <li>To use the mutable lvalue reference overload, the nested <tt class="docutils literal">qualifier</tt>
  603. type of <tt class="docutils literal">Tag</tt> must be <tt class="docutils literal">out_reference</tt> or <tt class="docutils literal">in_out_reference</tt>, and
  604. <tt class="docutils literal">T</tt> must not be <tt class="docutils literal">const</tt>-qualified.</li>
  605. <li>To use the <tt class="docutils literal">const</tt> rvalue reference overload for non-scalar <tt class="docutils literal">T</tt>, the
  606. nested <tt class="docutils literal">qualifier</tt> type of <tt class="docutils literal">Tag</tt> must be <tt class="docutils literal">in_reference</tt>.</li>
  607. <li>To use the mutable rvalue reference overload for non-scalar <tt class="docutils literal">T</tt>, the
  608. nested <tt class="docutils literal">qualifier</tt> type of <tt class="docutils literal">Tag</tt> must be <tt class="docutils literal">consume_reference</tt> or
  609. <tt class="docutils literal">move_from_reference</tt>.</li>
  610. </ul>
  611. <table class="docutils field-list" frame="void" rules="none">
  612. <col class="field-name" />
  613. <col class="field-body" />
  614. <tbody valign="top">
  615. <tr class="field"><th class="field-name">Returns:</th><td class="field-body">an <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> containing a single <a class="reference internal" href="#tagged-reference">tagged reference</a> to
  616. <tt class="docutils literal">value</tt> with <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal">Tag</tt></td>
  617. </tr>
  618. </tbody>
  619. </table>
  620. <p id="bitwise-or-operator"><tt class="docutils literal">operator|</tt></p>
  621. <table class="docutils field-list" frame="void" rules="none">
  622. <col class="field-name" />
  623. <col class="field-body" />
  624. <tbody valign="top">
  625. <tr class="field"><th class="field-name">Synopsis:</th><td class="field-body"></td>
  626. </tr>
  627. </tbody>
  628. </table>
  629. <pre class="literal-block">
  630. template &lt;typename T&gt;
  631. constexpr <em>tagged default</em> operator|(T const&amp; x) const;
  632. template &lt;typename T&gt;
  633. constexpr <em>tagged default</em> operator|(T&amp; x) const;
  634. template &lt;typename T&gt;
  635. constexpr <em>tagged default</em> operator|(T const&amp;&amp; x) const;
  636. template &lt;typename T&gt;
  637. constexpr <em>tagged default</em> operator|(T&amp;&amp; x) const;
  638. </pre>
  639. <table class="docutils field-list" frame="void" rules="none">
  640. <col class="field-name" />
  641. <col class="field-body" />
  642. <tbody valign="top">
  643. <tr class="field"><th class="field-name">Requires:</th><td class="field-body">one of the following:</td>
  644. </tr>
  645. </tbody>
  646. </table>
  647. <ul class="simple">
  648. <li>The nested <tt class="docutils literal">qualifier</tt> type of <tt class="docutils literal">Tag</tt> must be <tt class="docutils literal">forward_reference</tt>.</li>
  649. <li>To use the <tt class="docutils literal">const</tt> lvalue reference overload, <tt class="docutils literal">T</tt> must be scalar, or
  650. the nested <tt class="docutils literal">qualifier</tt> type of <tt class="docutils literal">Tag</tt> must be <tt class="docutils literal">in_reference</tt>.</li>
  651. <li>To use the mutable lvalue reference overload, the nested <tt class="docutils literal">qualifier</tt>
  652. type of <tt class="docutils literal">Tag</tt> must be <tt class="docutils literal">out_reference</tt> or <tt class="docutils literal">in_out_reference</tt>, and
  653. <tt class="docutils literal">T</tt> must not be <tt class="docutils literal">const</tt>-qualified.</li>
  654. <li>To use the <tt class="docutils literal">const</tt> rvalue reference overload for non-scalar <tt class="docutils literal">T</tt>, the
  655. nested <tt class="docutils literal">qualifier</tt> type of <tt class="docutils literal">Tag</tt> must be <tt class="docutils literal">in_reference</tt>.</li>
  656. <li>To use the mutable rvalue reference overload for non-scalar <tt class="docutils literal">T</tt>, the
  657. nested <tt class="docutils literal">qualifier</tt> type of <tt class="docutils literal">Tag</tt> must be <tt class="docutils literal">consume_reference</tt> or
  658. <tt class="docutils literal">move_from_reference</tt>.</li>
  659. </ul>
  660. <table class="docutils field-list" frame="void" rules="none">
  661. <col class="field-name" />
  662. <col class="field-body" />
  663. <tbody valign="top">
  664. <tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <a class="reference internal" href="#tagged-default">tagged default</a> with <em>value</em> <tt class="docutils literal">x</tt> and <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal">Tag</tt>.</td>
  665. </tr>
  666. </tbody>
  667. </table>
  668. <p id="logical-or-operator"><tt class="docutils literal">operator||</tt></p>
  669. <table class="docutils field-list" frame="void" rules="none">
  670. <col class="field-name" />
  671. <col class="field-body" />
  672. <tbody valign="top">
  673. <tr class="field"><th class="field-name">Synopsis:</th><td class="field-body"></td>
  674. </tr>
  675. </tbody>
  676. </table>
  677. <pre class="literal-block">
  678. template &lt;typename F&gt;
  679. constexpr <em>tagged lazy default</em> operator||(F const&amp; g) const;
  680. template &lt;typename F&gt;
  681. constexpr <em>tagged lazy default</em> operator||(F&amp; g) const;
  682. </pre>
  683. <table class="docutils field-list" frame="void" rules="none">
  684. <col class="field-name" />
  685. <col class="field-body" />
  686. <tbody valign="top">
  687. <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">g()</tt> must be valid, with type
  688. <a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal"><span class="pre">boost::result_of</span></tt></a><tt class="docutils literal"><span class="pre">&lt;F()&gt;::type</span></tt>.<a class="footnote-reference" href="#no-result-of" id="id6"><sup>2</sup></a></td>
  689. </tr>
  690. <tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a> with <em>value</em> <tt class="docutils literal">g</tt> and <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal">Tag</tt>.</td>
  691. </tr>
  692. </tbody>
  693. </table>
  694. <p id="instance"><tt class="docutils literal">instance</tt></p>
  695. <table class="docutils field-list" frame="void" rules="none">
  696. <col class="field-name" />
  697. <col class="field-body" />
  698. <tbody valign="top">
  699. <tr class="field"><th class="field-name">Synopsis:</th><td class="field-body"></td>
  700. </tr>
  701. </tbody>
  702. </table>
  703. <pre class="literal-block">
  704. static keyword&lt;Tag&gt; const&amp; instance;
  705. </pre>
  706. <table class="docutils field-list" frame="void" rules="none">
  707. <col class="field-name" />
  708. <col class="field-body" />
  709. <tbody valign="top">
  710. <tr class="field"><th class="field-name">Returns:</th><td class="field-body">a “singleton instance”: the same object will be returned on each
  711. invocation of <tt class="docutils literal">instance</tt>.</td>
  712. </tr>
  713. <tr class="field"><th class="field-name">Thread Safety:</th><td class="field-body"><tt class="docutils literal">instance</tt> can be accessed from multiple threads simultaneously.</td>
  714. </tr>
  715. </tbody>
  716. </table>
  717. <p id="get"><tt class="docutils literal">get</tt></p>
  718. <table class="docutils field-list" frame="void" rules="none">
  719. <col class="field-name" />
  720. <col class="field-body" />
  721. <tbody valign="top">
  722. <tr class="field"><th class="field-name">Synopsis:</th><td class="field-body"></td>
  723. </tr>
  724. </tbody>
  725. </table>
  726. <pre class="literal-block">
  727. static keyword&lt;Tag&gt;&amp; get();
  728. </pre>
  729. <div class="admonition-deprecated admonition">
  730. <p class="first admonition-title">Deprecated</p>
  731. <p class="last">This function has been deprecated in favor of <tt class="docutils literal">instance</tt>.</p>
  732. </div>
  733. <table class="docutils field-list" frame="void" rules="none">
  734. <col class="field-name" />
  735. <col class="field-body" />
  736. <tbody valign="top">
  737. <tr class="field"><th class="field-name">Returns:</th><td class="field-body">a “singleton instance”: the same object will be returned on each
  738. invocation of <tt class="docutils literal">get()</tt>.</td>
  739. </tr>
  740. <tr class="field"><th class="field-name">Thread Safety:</th><td class="field-body"><tt class="docutils literal">get()</tt> can be called from multiple threads simultaneously.</td>
  741. </tr>
  742. </tbody>
  743. </table>
  744. </div>
  745. <div class="section" id="id7">
  746. <span id="template-keyword"></span><h2><a class="toc-backref" href="#id42">4.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal">template_keyword</tt></a></h2>
  747. <p>This class template encapsulates a named template parameter. Every type
  748. generated by the <a class="reference internal" href="#boost-parameter-template-keyword"><tt class="docutils literal">BOOST_PARAMETER_TEMPLATE_KEYWORD</tt></a> macro is a specialization
  749. of <tt class="docutils literal">template_keyword</tt>.</p>
  750. <table class="docutils field-list" frame="void" rules="none">
  751. <col class="field-name" />
  752. <col class="field-body" />
  753. <tbody valign="top">
  754. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/template_keyword.hpp">boost/parameter/template_keyword.hpp</a></td>
  755. </tr>
  756. </tbody>
  757. </table>
  758. <pre class="literal-block">
  759. template &lt;typename Tag, typename T&gt;
  760. struct template_keyword
  761. {
  762. typedef Tag key_type;
  763. typedef T value_type;
  764. typedef <em>implementation defined</em> reference;
  765. };
  766. </pre>
  767. <p>The <a class="reference external" href="../../test/ntp.cpp">test/ntp.cpp</a> test program demonstrates proper usage of this class template.</p>
  768. </div>
  769. <div class="section" id="id8">
  770. <span id="parameters"></span><h2><a class="toc-backref" href="#id43">4.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal">parameters</tt></a></h2>
  771. <p>Provides an interface for assembling the actual arguments to a <cite>forwarding
  772. function</cite> into an <span class="concept">ArgumentPack</span>, in which any <a class="reference internal" href="#positional">positional</a> arguments will be
  773. tagged according to the corresponding template argument to <tt class="docutils literal">parameters</tt>.</p>
  774. <table class="docutils field-list" frame="void" rules="none">
  775. <col class="field-name" />
  776. <col class="field-body" />
  777. <tbody valign="top">
  778. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/parameters.hpp">boost/parameter/parameters.hpp</a></td>
  779. </tr>
  780. </tbody>
  781. </table>
  782. <pre class="literal-block">
  783. template &lt;typename ...PSpec&gt;
  784. struct parameters
  785. {
  786. template &lt;typename ...Args&gt;
  787. struct <a class="reference internal" href="#match"><tt class="docutils literal">match</tt></a>
  788. {
  789. typedef … type;
  790. };
  791. template &lt;typename ...Args&gt;
  792. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference internal" href="#function-call-operator"><tt class="docutils literal">operator()</tt></a>(Args&amp;&amp;... args) const;
  793. };
  794. </pre>
  795. <table class="docutils field-list" frame="void" rules="none">
  796. <col class="field-name" />
  797. <col class="field-body" />
  798. <tbody valign="top">
  799. <tr class="field"><th class="field-name">Requires:</th><td class="field-body">Each element in the <tt class="docutils literal">PSpec</tt> parameter pack must be a model of
  800. <a class="reference internal" href="#parameterspec"><span class="concept">ParameterSpec</span></a>.</td>
  801. </tr>
  802. </tbody>
  803. </table>
  804. <div class="note">
  805. <p class="first admonition-title">Note</p>
  806. <p>In this section, <tt class="docutils literal">R</tt> ## <em>i</em> and <tt class="docutils literal">K</tt> ## <em>i</em> are defined as
  807. follows, for any argument type <tt class="docutils literal">A</tt> ## <em>i</em>:</p>
  808. <div class="last line-block">
  809. <div class="line">let <tt class="docutils literal">D0</tt> the set [d0, …, d ## <em>j</em>] of all <strong>deduced</strong></div>
  810. <div class="line"><em>parameter specs</em> in the <tt class="docutils literal">PSpec</tt> parameter pack</div>
  811. <div class="line"><tt class="docutils literal">R</tt> ## <em>i</em> is the <a class="reference internal" href="#intended-argument-type">intended argument type</a> of <tt class="docutils literal">A</tt> ## <em>i</em></div>
  812. <div class="line"><br /></div>
  813. <div class="line">if <tt class="docutils literal">A</tt> ## <em>i</em> is a result type of <tt class="docutils literal"><span class="pre">keyword&lt;T&gt;::</span></tt> <a class="reference internal" href="#assignment-operator"><tt class="docutils literal">operator=</tt></a></div>
  814. <div class="line">then</div>
  815. <div class="line-block">
  816. <div class="line"><tt class="docutils literal">K</tt> ## <em>i</em> is <tt class="docutils literal">T</tt></div>
  817. </div>
  818. <div class="line">else</div>
  819. <div class="line-block">
  820. <div class="line">if some <tt class="docutils literal">A</tt> ## <em>j</em> where <em>j</em> ≤ <em>i</em> is a result type of</div>
  821. <div class="line"><tt class="docutils literal"><span class="pre">keyword&lt;T&gt;::</span></tt> <a class="reference internal" href="#assignment-operator"><tt class="docutils literal">operator=</tt></a></div>
  822. <div class="line"><em>or</em> some <tt class="docutils literal">P</tt> ## <em>j</em> in <em>j</em> ≤ <em>i</em> is <strong>deduced</strong></div>
  823. <div class="line">then</div>
  824. <div class="line-block">
  825. <div class="line">if some <em>parameter spec</em> <tt class="docutils literal">d</tt> ## <em>j</em> in <tt class="docutils literal">D</tt> ## <em>i</em></div>
  826. <div class="line">matches <tt class="docutils literal">A</tt> ## <em>i</em></div>
  827. <div class="line">then</div>
  828. <div class="line-block">
  829. <div class="line"><tt class="docutils literal">K</tt> ## <em>i</em> is the <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> of <tt class="docutils literal">d</tt> ## <em>j</em>.</div>
  830. <div class="line"><tt class="docutils literal">D</tt><sub>i+1</sub> is <tt class="docutils literal">D</tt> ## <em>i</em> - [ <tt class="docutils literal">d</tt> ## <em>j</em>]</div>
  831. </div>
  832. </div>
  833. <div class="line">else</div>
  834. <div class="line-block">
  835. <div class="line"><tt class="docutils literal">K</tt> ## <em>i</em> is the <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> of <tt class="docutils literal">P</tt> ## <em>i</em>.</div>
  836. </div>
  837. </div>
  838. </div>
  839. </div>
  840. <dl class="docutils" id="match">
  841. <dt><tt class="docutils literal">match</tt></dt>
  842. <dd>A <a class="reference external" href="../../../mpl/doc/refmanual/metafunction.html">Metafunction</a> used to remove a <a class="reference external" href="index.html#forwarding-functions">forwarding function</a> from overload
  843. resolution.</dd>
  844. </dl>
  845. <table class="docutils field-list" frame="void" rules="none">
  846. <col class="field-name" />
  847. <col class="field-body" />
  848. <tbody valign="top">
  849. <tr class="field"><th class="field-name">Returns:</th><td class="field-body">if all elements in <tt class="docutils literal"><span class="pre">Params...</span></tt> are <em>satisfied</em> (see below), then
  850. <tt class="docutils literal"><span class="pre">parameters&lt;Params...&gt;</span></tt>. Otherwise, <tt class="docutils literal"><span class="pre">match&lt;Args...&gt;::type</span></tt> is not
  851. defined.</td>
  852. </tr>
  853. </tbody>
  854. </table>
  855. <p>Each element <tt class="docutils literal">P</tt> in <tt class="docutils literal"><span class="pre">Params...</span></tt> is <strong>satisfied</strong> if either:</p>
  856. <ul>
  857. <li><p class="first"><tt class="docutils literal">P</tt> is the <em>unspecified</em> default</p>
  858. </li>
  859. <li><p class="first"><strong>or</strong>, <tt class="docutils literal">P</tt> is a <em>keyword tag type</em></p>
  860. </li>
  861. <li><dl class="first docutils">
  862. <dt><strong>or</strong>, <tt class="docutils literal">P</tt> is <a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a> <tt class="docutils literal">&lt;X,F&gt;</tt> and either</dt>
  863. <dd><ul class="first last">
  864. <li><p class="first"><tt class="docutils literal">X</tt> is not <tt class="docutils literal">K</tt> ## <em>i</em> for any <em>i</em>,</p>
  865. </li>
  866. <li><dl class="first docutils">
  867. <dt><strong>or</strong> <tt class="docutils literal">X</tt> is some <tt class="docutils literal">K</tt> ## <em>i</em> and <tt class="docutils literal"><span class="pre">mpl::apply&lt;F,R</span></tt> ## <em>i</em></dt>
  868. <dd><p class="first last"><tt class="docutils literal"><span class="pre">&gt;::type::value</span></tt> is <tt class="docutils literal">true</tt></p>
  869. </dd>
  870. </dl>
  871. </li>
  872. </ul>
  873. </dd>
  874. </dl>
  875. </li>
  876. <li><dl class="first docutils">
  877. <dt><strong>or</strong>, <tt class="docutils literal">P</tt> is <a class="reference internal" href="#required"><tt class="docutils literal">required</tt></a> <tt class="docutils literal">&lt;X,F&gt;</tt>, and</dt>
  878. <dd><ul class="first last simple">
  879. <li><tt class="docutils literal">X</tt> is some <tt class="docutils literal">K</tt> ## <em>i</em>, <strong>and</strong></li>
  880. <li><tt class="docutils literal"><span class="pre">mpl::apply&lt;F,R</span></tt> ## <em>i</em> <tt class="docutils literal"><span class="pre">&gt;::type::value</span></tt> is <tt class="docutils literal">true</tt></li>
  881. </ul>
  882. </dd>
  883. </dl>
  884. </li>
  885. </ul>
  886. <p id="function-call-operator"><tt class="docutils literal">operator()</tt></p>
  887. <table class="docutils field-list" frame="void" rules="none">
  888. <col class="field-name" />
  889. <col class="field-body" />
  890. <tbody valign="top">
  891. <tr class="field"><th class="field-name">Synopsis:</th><td class="field-body"></td>
  892. </tr>
  893. </tbody>
  894. </table>
  895. <pre class="literal-block">
  896. template &lt;typename ...Args&gt;
  897. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator()(Args&amp;&amp;... args) const;
  898. </pre>
  899. <table class="docutils field-list" frame="void" rules="none">
  900. <col class="field-name" />
  901. <col class="field-body" />
  902. <tbody valign="top">
  903. <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">An <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> containing, for each <tt class="docutils literal">a</tt> ## <em>i</em>,</p>
  904. <ul class="last">
  905. <li><p class="first">if <tt class="docutils literal">a</tt> ## <em>i</em> is a single-element <span class="concept">ArgumentPack</span>, its element</p>
  906. </li>
  907. <li><dl class="first docutils">
  908. <dt>Otherwise, a <a class="reference internal" href="#tagged-reference">tagged reference</a> with <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal">K</tt> ## <em>i</em> and <em>value</em></dt>
  909. <dd><p class="first last"><tt class="docutils literal">a</tt> ## <em>i</em></p>
  910. </dd>
  911. </dl>
  912. </li>
  913. </ul>
  914. </td>
  915. </tr>
  916. </tbody>
  917. </table>
  918. </div>
  919. <div class="section" id="optional-required">
  920. <span id="required"></span><span id="optional"></span><h2><a class="toc-backref" href="#id44">4.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal">optional</tt>, <tt class="docutils literal">required</tt></a></h2>
  921. <p>These templates describe the requirements on a function parameter.</p>
  922. <p><tt class="docutils literal">optional</tt> is defined in: <a class="reference external" href="../../../../boost/parameter/optional.hpp">boost/parameter/optional.hpp</a></p>
  923. <p><tt class="docutils literal">required</tt> is defined in: <a class="reference external" href="../../../../boost/parameter/required.hpp">boost/parameter/required.hpp</a></p>
  924. <p>Both headers are included by: <a class="reference external" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></p>
  925. <table class="docutils field-list" frame="void" rules="none">
  926. <col class="field-name" />
  927. <col class="field-body" />
  928. <tbody valign="top">
  929. <tr class="field"><th class="field-name" colspan="2">Specializations model:</th></tr>
  930. <tr class="field"><td>&nbsp;</td><td class="field-body"><a class="reference internal" href="#parameterspec"><span class="concept">ParameterSpec</span></a></td>
  931. </tr>
  932. </tbody>
  933. </table>
  934. <pre class="literal-block">
  935. template &lt;typename Tag, typename Predicate = <em>unspecified</em>&gt;
  936. struct optional;
  937. template &lt;typename Tag, typename Predicate = <em>unspecified</em>&gt;
  938. struct required;
  939. </pre>
  940. <p>The default value of <tt class="docutils literal">Predicate</tt> is an unspecified <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary Metafunction
  941. Class</a> that returns <tt class="docutils literal"><span class="pre">mpl::true_</span></tt> for any argument. If
  942. <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> is defined, then the default value of
  943. <tt class="docutils literal">Predicate</tt> is also a <a class="reference external" href="../../../mp11/doc/html/mp11.html">Boost.MP11</a>-style quoted metafunction that returns
  944. <tt class="docutils literal"><span class="pre">mp11::mp_true</span></tt> for any argument.</p>
  945. </div>
  946. <div class="section" id="id9">
  947. <span id="deduced"></span><h2><a class="toc-backref" href="#id45">4.5&nbsp;&nbsp;&nbsp;<tt class="docutils literal">deduced</tt></a></h2>
  948. <p>This template is used to wrap the <em>keyword tag</em> argument to
  949. <tt class="docutils literal">optional</tt> or <tt class="docutils literal">required</tt>.</p>
  950. <table class="docutils field-list" frame="void" rules="none">
  951. <col class="field-name" />
  952. <col class="field-body" />
  953. <tbody valign="top">
  954. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/deduced.hpp">boost/parameter/deduced.hpp</a></td>
  955. </tr>
  956. <tr class="field"><th class="field-name">Included by:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td>
  957. </tr>
  958. </tbody>
  959. </table>
  960. <pre class="literal-block">
  961. template &lt;typename Tag&gt;
  962. struct deduced;
  963. </pre>
  964. <table class="docutils field-list" frame="void" rules="none">
  965. <col class="field-name" />
  966. <col class="field-body" />
  967. <tbody valign="top">
  968. <tr class="field"><th class="field-name">Requires:</th><td class="field-body">nothing</td>
  969. </tr>
  970. </tbody>
  971. </table>
  972. </div>
  973. </div>
  974. <hr class="docutils" />
  975. <div class="section" id="metafunctions">
  976. <h1><a class="toc-backref" href="#id46">5&nbsp;&nbsp;&nbsp;Metafunctions</a></h1>
  977. <p>A <a class="reference external" href="../../../mpl/doc/refmanual/metafunction.html">Metafunction</a> is conceptually a function that operates on, and returns,
  978. C++ types.</p>
  979. <div class="section" id="id10">
  980. <span id="binding"></span><h2><a class="toc-backref" href="#id47">5.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">binding</tt></a></h2>
  981. <p>Returns the result type of indexing an argument pack with a
  982. <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> or with a <a class="reference internal" href="#tagged-default">tagged default</a>.</p>
  983. <table class="docutils field-list" frame="void" rules="none">
  984. <col class="field-name" />
  985. <col class="field-body" />
  986. <tbody valign="top">
  987. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/binding.hpp">boost/parameter/binding.hpp</a></td>
  988. </tr>
  989. </tbody>
  990. </table>
  991. <pre class="literal-block">
  992. template &lt;typename A, typename K, typename D = void_&gt;
  993. struct binding
  994. {
  995. typedef … type;
  996. };
  997. </pre>
  998. <table class="docutils field-list" frame="void" rules="none">
  999. <col class="field-name" />
  1000. <col class="field-body" />
  1001. <tbody valign="top">
  1002. <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">A</tt> must be a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</td>
  1003. </tr>
  1004. <tr class="field"><th class="field-name">Returns:</th><td class="field-body">the reference type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal">A</tt> having
  1005. <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal">K</tt>, if any. If no such <a class="reference internal" href="#tagged-reference">tagged reference</a> exists,
  1006. returns <tt class="docutils literal">D</tt>.</td>
  1007. </tr>
  1008. </tbody>
  1009. </table>
  1010. </div>
  1011. <div class="section" id="id11">
  1012. <span id="lazy-binding"></span><h2><a class="toc-backref" href="#id48">5.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal">lazy_binding</tt></a></h2>
  1013. <p>Returns the result type of indexing an argument pack with a
  1014. <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a>.</p>
  1015. <table class="docutils field-list" frame="void" rules="none">
  1016. <col class="field-name" />
  1017. <col class="field-body" />
  1018. <tbody valign="top">
  1019. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/binding.hpp">boost/parameter/binding.hpp</a></td>
  1020. </tr>
  1021. </tbody>
  1022. </table>
  1023. <pre class="literal-block">
  1024. template &lt;typename A, typename K, typename F&gt;
  1025. struct lazy_binding
  1026. {
  1027. typedef … type;
  1028. };
  1029. </pre>
  1030. <table class="docutils field-list" frame="void" rules="none">
  1031. <col class="field-name" />
  1032. <col class="field-body" />
  1033. <tbody valign="top">
  1034. <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">A</tt> must be a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</td>
  1035. </tr>
  1036. <tr class="field"><th class="field-name">Returns:</th><td class="field-body">the reference type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal">A</tt> having
  1037. <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal">K</tt>, if any. If no such <a class="reference internal" href="#tagged-reference">tagged reference</a> exists,
  1038. returns <a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal"><span class="pre">boost::result_of</span></tt></a><tt class="docutils literal"><span class="pre">&lt;F()&gt;::type</span></tt>.<a class="footnote-reference" href="#no-result-of" id="id12"><sup>2</sup></a></td>
  1039. </tr>
  1040. </tbody>
  1041. </table>
  1042. </div>
  1043. <div class="section" id="id13">
  1044. <span id="value-type"></span><h2><a class="toc-backref" href="#id49">5.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal">value_type</tt></a></h2>
  1045. <p>Returns the result type of indexing an argument pack with a
  1046. <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> or with a <a class="reference internal" href="#tagged-default">tagged default</a>.</p>
  1047. <table class="docutils field-list" frame="void" rules="none">
  1048. <col class="field-name" />
  1049. <col class="field-body" />
  1050. <tbody valign="top">
  1051. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/value_type.hpp">boost/parameter/value_type.hpp</a></td>
  1052. </tr>
  1053. </tbody>
  1054. </table>
  1055. <pre class="literal-block">
  1056. template &lt;typename A, typename K, typename D = void_&gt;
  1057. struct value_type
  1058. {
  1059. typedef … type;
  1060. };
  1061. </pre>
  1062. <table class="docutils field-list" frame="void" rules="none">
  1063. <col class="field-name" />
  1064. <col class="field-body" />
  1065. <tbody valign="top">
  1066. <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal">A</tt> must be a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</p>
  1067. </td>
  1068. </tr>
  1069. <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the (possibly const-qualified) type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in
  1070. <tt class="docutils literal">A</tt> having <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal">K</tt>, if any. If no such
  1071. <a class="reference internal" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal">D</tt>. Equivalent to:</p>
  1072. <pre class="literal-block">
  1073. typename <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/remove_reference.html">boost::remove_reference</a>&lt;
  1074. typename <a class="reference internal" href="#binding"><tt class="docutils literal">binding</tt></a>&lt;A, K, D&gt;::type
  1075. &gt;::type
  1076. </pre>
  1077. <p class="last">… when <tt class="docutils literal">D</tt> is not a reference type.</p>
  1078. </td>
  1079. </tr>
  1080. </tbody>
  1081. </table>
  1082. </div>
  1083. <div class="section" id="id14">
  1084. <span id="lazy-value-type"></span><h2><a class="toc-backref" href="#id50">5.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal">lazy_value_type</tt></a></h2>
  1085. <p>Returns the result type of indexing an argument pack with a
  1086. <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a>.</p>
  1087. <table class="docutils field-list" frame="void" rules="none">
  1088. <col class="field-name" />
  1089. <col class="field-body" />
  1090. <tbody valign="top">
  1091. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/value_type.hpp">boost/parameter/value_type.hpp</a></td>
  1092. </tr>
  1093. </tbody>
  1094. </table>
  1095. <pre class="literal-block">
  1096. template &lt;typename A, typename K, typename F&gt;
  1097. struct lazy_value_type
  1098. {
  1099. typedef … type;
  1100. };
  1101. </pre>
  1102. <table class="docutils field-list" frame="void" rules="none">
  1103. <col class="field-name" />
  1104. <col class="field-body" />
  1105. <tbody valign="top">
  1106. <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">A</tt> must be a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</td>
  1107. </tr>
  1108. <tr class="field"><th class="field-name">Returns:</th><td class="field-body">the (possibly const-qualified) type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in
  1109. <tt class="docutils literal">A</tt> having <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal">K</tt>, if any. If no such
  1110. <a class="reference internal" href="#tagged-reference">tagged reference</a> exists, returns
  1111. <a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal"><span class="pre">boost::result_of</span></tt></a><tt class="docutils literal"><span class="pre">&lt;F()&gt;::type</span></tt>.<a class="footnote-reference" href="#no-result-of" id="id15"><sup>2</sup></a></td>
  1112. </tr>
  1113. </tbody>
  1114. </table>
  1115. </div>
  1116. <div class="section" id="id16">
  1117. <span id="are-tagged-arguments"></span><h2><a class="toc-backref" href="#id51">5.5&nbsp;&nbsp;&nbsp;<tt class="docutils literal">are_tagged_arguments</tt></a></h2>
  1118. <table class="docutils field-list" frame="void" rules="none">
  1119. <col class="field-name" />
  1120. <col class="field-body" />
  1121. <tbody valign="top">
  1122. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/are_tagged_arguments.hpp">boost/parameter/are_tagged_arguments.hpp</a></td>
  1123. </tr>
  1124. </tbody>
  1125. </table>
  1126. <pre class="literal-block">
  1127. template &lt;typename T0, typename ...Pack&gt;
  1128. struct are_tagged_arguments
  1129. // : <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> if T0 and all elements in Pack are
  1130. // tagged reference types, <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> otherwise.
  1131. {
  1132. };
  1133. </pre>
  1134. <table class="docutils field-list" frame="void" rules="none">
  1135. <col class="field-name" />
  1136. <col class="field-body" />
  1137. <tbody valign="top">
  1138. <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="docutils literal"><span class="pre">mpl::true_</span></tt> if <tt class="docutils literal">T0</tt> and all elements in parameter pack <tt class="docutils literal">Pack</tt> are
  1139. <a class="reference internal" href="#tagged-reference">tagged reference</a> types, <tt class="docutils literal"><span class="pre">mpl::false_</span></tt> otherwise.</td>
  1140. </tr>
  1141. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  1142. </tr>
  1143. </tbody>
  1144. </table>
  1145. <p>When implementing a Boost.Parameter-enabled constructor for a container that
  1146. conforms to the C++ standard, one needs to remember that the standard requires
  1147. the presence of other constructors that are typically defined as templates,
  1148. such as range constructors. To avoid overload ambiguities between the two
  1149. constructors, use this metafunction in conjunction with <tt class="docutils literal">disable_if</tt> to
  1150. define the range constructor.</p>
  1151. <pre class="literal-block">
  1152. template &lt;typename B&gt;
  1153. class frontend : public B
  1154. {
  1155. struct _enabler
  1156. {
  1157. };
  1158. public:
  1159. <a class="reference internal" href="#boost-parameter-no-spec-constructor"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR</tt></a>(frontend, (B))
  1160. template &lt;typename Iterator&gt;
  1161. frontend(
  1162. Iterator itr
  1163. , Iterator itr_end
  1164. , typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>&lt;
  1165. are_tagged_arguments&lt;Iterator&gt;
  1166. , _enabler
  1167. &gt;::type = _enabler()
  1168. ) : B(itr, itr_end)
  1169. {
  1170. }
  1171. };
  1172. </pre>
  1173. </div>
  1174. <div class="section" id="id17">
  1175. <span id="is-argument-pack"></span><h2><a class="toc-backref" href="#id52">5.6&nbsp;&nbsp;&nbsp;<tt class="docutils literal">is_argument_pack</tt></a></h2>
  1176. <table class="docutils field-list" frame="void" rules="none">
  1177. <col class="field-name" />
  1178. <col class="field-body" />
  1179. <tbody valign="top">
  1180. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/is_argument_pack.hpp">boost/parameter/is_argument_pack.hpp</a></td>
  1181. </tr>
  1182. </tbody>
  1183. </table>
  1184. <pre class="literal-block">
  1185. template &lt;typename T&gt;
  1186. struct is_argument_pack
  1187. // : <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> if T is a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>,
  1188. // <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> otherwise.
  1189. {
  1190. };
  1191. </pre>
  1192. <table class="docutils field-list" frame="void" rules="none">
  1193. <col class="field-name" />
  1194. <col class="field-body" />
  1195. <tbody valign="top">
  1196. <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><tt class="docutils literal"><span class="pre">mpl::true_</span></tt> if <tt class="docutils literal">T</tt> is a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, <tt class="docutils literal"><span class="pre">mpl::false_</span></tt>
  1197. otherwise.</td>
  1198. </tr>
  1199. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  1200. </tr>
  1201. </tbody>
  1202. </table>
  1203. <p>To avoid overload ambiguities between a constructor that takes in an
  1204. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> and a templated conversion constructor, use this
  1205. metafunction in conjunction with <tt class="docutils literal">enable_if</tt>.</p>
  1206. <pre class="literal-block">
  1207. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a0)
  1208. template &lt;typename T&gt;
  1209. class backend0
  1210. {
  1211. struct _enabler
  1212. {
  1213. };
  1214. T a0;
  1215. public:
  1216. template &lt;typename ArgPack&gt;
  1217. explicit backend0(
  1218. ArgPack const&amp; args
  1219. , typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  1220. is_argument_pack&lt;ArgPack&gt;
  1221. , _enabler
  1222. &gt;::type = _enabler()
  1223. ) : a0(args[_a0])
  1224. {
  1225. }
  1226. template &lt;typename U&gt;
  1227. backend0(
  1228. backend0&lt;U&gt; const&amp; copy
  1229. , typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  1230. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_convertible.html">boost::is_convertible</a>&lt;U,T&gt;
  1231. , _enabler
  1232. &gt;::type = _enabler()
  1233. ) : a0(copy.get_a0())
  1234. {
  1235. }
  1236. T const&amp; get_a0() const
  1237. {
  1238. return this-&gt;a0;
  1239. }
  1240. };
  1241. </pre>
  1242. </div>
  1243. <div class="section" id="id18">
  1244. <span id="result-of-compose"></span><h2><a class="toc-backref" href="#id53">5.7&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">result_of::compose</span></tt></a></h2>
  1245. <p>Returns the result type of the <a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a> function.</p>
  1246. <table class="docutils field-list" frame="void" rules="none">
  1247. <col class="field-name" />
  1248. <col class="field-body" />
  1249. <tbody valign="top">
  1250. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/compose.hpp">boost/parameter/compose.hpp</a></td>
  1251. </tr>
  1252. </tbody>
  1253. </table>
  1254. <pre class="literal-block">
  1255. template &lt;typename ...TaggedArgs&gt;
  1256. struct compose
  1257. : <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  1258. <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a>&lt;T0,Pack...&gt;
  1259. , <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>
  1260. &gt;
  1261. {
  1262. };
  1263. template &lt;&gt;
  1264. struct compose&lt;&gt;
  1265. {
  1266. typedef <em>empty</em> <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> type;
  1267. };
  1268. </pre>
  1269. <table class="docutils field-list" frame="void" rules="none">
  1270. <col class="field-name" />
  1271. <col class="field-body" />
  1272. <tbody valign="top">
  1273. <tr class="field"><th class="field-name">Requires:</th><td class="field-body">All elements in <tt class="docutils literal">TaggedArgs</tt> must be <a class="reference internal" href="#tagged-reference">tagged reference</a> types, if
  1274. specified.</td>
  1275. </tr>
  1276. <tr class="field"><th class="field-name">Returns:</th><td class="field-body">the result type of the <a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a> function.</td>
  1277. </tr>
  1278. </tbody>
  1279. </table>
  1280. </div>
  1281. </div>
  1282. <hr class="docutils" />
  1283. <div class="section" id="function-templates">
  1284. <h1><a class="toc-backref" href="#id54">6&nbsp;&nbsp;&nbsp;Function Templates</a></h1>
  1285. <div class="section" id="id19">
  1286. <span id="compose"></span><h2><a class="toc-backref" href="#id55">6.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">compose</tt></a></h2>
  1287. <table class="docutils field-list" frame="void" rules="none">
  1288. <col class="field-name" />
  1289. <col class="field-body" />
  1290. <tbody valign="top">
  1291. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/compose.hpp">boost/parameter/compose.hpp</a></td>
  1292. </tr>
  1293. </tbody>
  1294. </table>
  1295. <pre class="literal-block">
  1296. template &lt;typename ...Pack&gt;
  1297. constexpr typename <a class="reference internal" href="#result-of-compose"><tt class="docutils literal"><span class="pre">result_of::compose</span></tt></a>&lt;Pack...&gt;::type
  1298. compose(Pack const&amp;... args);
  1299. </pre>
  1300. <p>This function facilitates easier variadic argument composition. It is used by
  1301. the <a class="reference internal" href="#boost-parameter-no-spec-function"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_FUNCTION</tt></a>,
  1302. <a class="reference internal" href="#boost-parameter-no-spec-member-function"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION</tt></a>,
  1303. <a class="reference internal" href="#boost-parameter-no-spec-const-member-function"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION</tt></a>,
  1304. <a class="reference internal" href="#boost-parameter-no-spec-function-call-operator"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR</tt></a>,
  1305. <a class="reference internal" href="#boost-parameter-no-spec-const-function-call-operator"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR</tt></a>,
  1306. <a class="reference internal" href="#boost-parameter-no-spec-constructor"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR</tt></a>, and
  1307. <a class="reference internal" href="#boost-parameter-no-spec-no-base-constructor"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR</tt></a> code generation macros. You
  1308. can use it to write your own code generation macros if the ones provided by
  1309. this library do not suffice.</p>
  1310. <p>Unlike the <a class="reference internal" href="#tagged-reference">tagged reference</a> comma operator, the <tt class="docutils literal">compose()</tt> function is
  1311. variadic, as mentioned before. However, the <a class="reference internal" href="#tagged-reference">tagged reference</a> comma operator
  1312. can be invoked indefinitely and therefore does not limit the size of the
  1313. resulting <span class="concept">ArgumentPack</span>, while the <tt class="docutils literal">compose()</tt> function cannot take in more
  1314. than <a class="reference internal" href="#boost-parameter-compose-max-arity"><tt class="docutils literal">BOOST_PARAMETER_COMPOSE_MAX_ARITY</tt></a> arguments for compilers that do not
  1315. support perfect forwarding.</p>
  1316. <table class="docutils field-list" frame="void" rules="none">
  1317. <col class="field-name" />
  1318. <col class="field-body" />
  1319. <tbody valign="top">
  1320. <tr class="field"><th class="field-name">Requires:</th><td class="field-body">All elements in <tt class="docutils literal">args</tt> must be <a class="reference internal" href="#tagged-reference">tagged reference</a> objects, if
  1321. specified.</td>
  1322. </tr>
  1323. <tr class="field"><th class="field-name">Returns:</th><td class="field-body">an <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> containing all elements in <tt class="docutils literal">args</tt>, if
  1324. specified; an empty <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> otherwise.</td>
  1325. </tr>
  1326. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  1327. </tr>
  1328. </tbody>
  1329. </table>
  1330. <pre class="literal-block">
  1331. BOOST_PARAMETER_NAME(index)
  1332. BOOST_PARAMETER_NAME(name)
  1333. template &lt;typename ArgumentPack&gt;
  1334. int print_name_and_index(ArgumentPack const&amp; args)
  1335. {
  1336. std::cout &lt;&lt; &quot;index = &quot; &lt;&lt; args[_index];
  1337. std::cout &lt;&lt; &quot;name = &quot; &lt;&lt; args[_name];
  1338. std::cout &lt;&lt; &quot;; &quot; &lt;&lt; std::endl;
  1339. return 0;
  1340. }
  1341. int y = print_name_and_index(compose(_index = 3, _name = &quot;jones&quot;));
  1342. </pre>
  1343. <p>The <a class="reference external" href="../../test/compose.cpp">compose.cpp</a> test program shows more examples using this function.</p>
  1344. </div>
  1345. </div>
  1346. <hr class="docutils" />
  1347. <div class="section" id="code-generation-macros">
  1348. <h1><a class="toc-backref" href="#id56">7&nbsp;&nbsp;&nbsp;Code Generation Macros</a></h1>
  1349. <p>Macros in this section can be used to ease the writing of code
  1350. using the Parameter library by eliminating repetitive boilerplate.</p>
  1351. <div class="section" id="boost-parameter-function-result-name-tag-namespace-arguments">
  1352. <span id="boost-parameter-function"></span><h2><a class="toc-backref" href="#id57">7.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_FUNCTION(result, name, tag_namespace, arguments)</tt></a></h2>
  1353. <table class="docutils field-list" frame="void" rules="none">
  1354. <col class="field-name" />
  1355. <col class="field-body" />
  1356. <tbody valign="top">
  1357. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td>
  1358. </tr>
  1359. </tbody>
  1360. </table>
  1361. <p>Generates a function that can take in positional arguments, composed
  1362. arguments, named arguments, and deduced arguments.</p>
  1363. <table class="docutils field-list" frame="void" rules="none">
  1364. <col class="field-name" />
  1365. <col class="field-body" />
  1366. <tbody valign="top">
  1367. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  1368. </tr>
  1369. </tbody>
  1370. </table>
  1371. <p>The return type of each of the following function templates falls under a
  1372. different value category.</p>
  1373. <pre class="literal-block">
  1374. template &lt;std::size_t N&gt;
  1375. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; rvalue_bitset()
  1376. {
  1377. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  1378. }
  1379. template &lt;std::size_t N&gt;
  1380. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const rvalue_const_bitset()
  1381. {
  1382. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  1383. }
  1384. template &lt;std::size_t N&gt;
  1385. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp; lvalue_bitset()
  1386. {
  1387. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  1388. return lset;
  1389. }
  1390. template &lt;std::size_t N&gt;
  1391. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp; lvalue_const_bitset()
  1392. {
  1393. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  1394. return clset;
  1395. }
  1396. </pre>
  1397. <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
  1398. to return the correct value category when passed in an object returned by one
  1399. of the functions defined above. Assume that
  1400. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
  1401. <pre class="literal-block">
  1402. enum invoked
  1403. {
  1404. passed_by_lvalue_reference_to_const
  1405. , passed_by_lvalue_reference
  1406. , passed_by_rvalue_reference_to_const
  1407. , passed_by_rvalue_reference
  1408. };
  1409. struct U
  1410. {
  1411. template &lt;std::size_t N&gt;
  1412. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;)
  1413. {
  1414. return passed_by_lvalue_reference_to_const;
  1415. }
  1416. template &lt;std::size_t N&gt;
  1417. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;)
  1418. {
  1419. return passed_by_lvalue_reference;
  1420. }
  1421. template &lt;std::size_t N&gt;
  1422. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;&amp;)
  1423. {
  1424. return passed_by_rvalue_reference_to_const;
  1425. }
  1426. template &lt;std::size_t N&gt;
  1427. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;&amp;)
  1428. {
  1429. return passed_by_rvalue_reference;
  1430. }
  1431. };
  1432. </pre>
  1433. <p>Define the named parameters that will comprise the argument specification that
  1434. this macro will use. Ensure that all their tag types are in the same
  1435. namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
  1436. underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
  1437. same argument to which the corresponding named parameter (without underscores)
  1438. is bound, as will be shown later.</p>
  1439. <pre class="literal-block">
  1440. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
  1441. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
  1442. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
  1443. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
  1444. </pre>
  1445. <p>Use the macro as a substitute for a normal function header. Enclose the
  1446. return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter, also enclose the
  1447. expected value type in parentheses. Since the value types are mutually
  1448. exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
  1449. clause. Otherwise, just as with a normal function, the order in which you
  1450. specify the parameters determines their position. Also, just as with a normal
  1451. function, optional parameters have default values, whereas required parameters
  1452. do not. Within the function body, either simply use the parameter name or
  1453. pass the matching identifier with the leading underscore to the bracket
  1454. operator of <tt class="docutils literal">args</tt> to extract the corresponding argument. Note that the
  1455. second method doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to preserve value categories.</p>
  1456. <pre class="literal-block">
  1457. BOOST_PARAMETER_FUNCTION((bool), evaluate, kw,
  1458. (deduced
  1459. (required
  1460. (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;1&gt;))
  1461. (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;2&gt;))
  1462. )
  1463. (optional
  1464. (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;3&gt;), rvalue_const_bitset&lt;2&gt;())
  1465. (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;4&gt;), rvalue_bitset&lt;3&gt;())
  1466. )
  1467. )
  1468. )
  1469. {
  1470. BOOST_TEST_EQ(
  1471. passed_by_lvalue_reference_to_const
  1472. , U::evaluate_category&lt;0&gt;(lrc)
  1473. );
  1474. BOOST_TEST_EQ(
  1475. passed_by_lvalue_reference
  1476. , U::evaluate_category&lt;1&gt;(lr)
  1477. );
  1478. BOOST_TEST_EQ(
  1479. passed_by_rvalue_reference_to_const
  1480. , U::evaluate_category&lt;2&gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;rrc0_type&gt;(rrc0))
  1481. );
  1482. BOOST_TEST_EQ(
  1483. passed_by_rvalue_reference
  1484. , U::evaluate_category&lt;3&gt;(args[_rr0])
  1485. );
  1486. return true;
  1487. }
  1488. </pre>
  1489. <p>The following function calls are legal.</p>
  1490. <pre class="literal-block">
  1491. evaluate( // positional arguments
  1492. lvalue_const_bitset&lt;0&gt;()
  1493. , lvalue_bitset&lt;1&gt;()
  1494. , rvalue_const_bitset&lt;2&gt;()
  1495. , rvalue_bitset&lt;3&gt;()
  1496. );
  1497. evaluate( // positional arguments
  1498. lvalue_const_bitset&lt;0&gt;()
  1499. , lvalue_bitset&lt;1&gt;()
  1500. );
  1501. evaluate(( // composed arguments
  1502. _rr0 = rvalue_bitset&lt;3&gt;()
  1503. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  1504. , _lr0 = lvalue_bitset&lt;1&gt;()
  1505. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  1506. ));
  1507. evaluate( // named arguments
  1508. _rr0 = rvalue_bitset&lt;3&gt;()
  1509. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  1510. , _lr0 = lvalue_bitset&lt;1&gt;()
  1511. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  1512. );
  1513. evaluate( // named arguments
  1514. _lr0 = lvalue_bitset&lt;1&gt;()
  1515. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  1516. );
  1517. </pre>
  1518. <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
  1519. function calls are also legal.</p>
  1520. <pre class="literal-block">
  1521. evaluate( // deduced arguments
  1522. rvalue_bitset&lt;3&gt;()
  1523. , lvalue_const_bitset&lt;0&gt;()
  1524. , lvalue_bitset&lt;1&gt;()
  1525. , rvalue_const_bitset&lt;2&gt;()
  1526. );
  1527. evaluate( // deduced arguments
  1528. lvalue_bitset&lt;1&gt;()
  1529. , lvalue_const_bitset&lt;0&gt;()
  1530. );
  1531. </pre>
  1532. <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a>, <a class="reference external" href="../../test/preprocessor_deduced.cpp">preprocessor_deduced.cpp</a>, and
  1533. <a class="reference external" href="../../test/preprocessor_eval_category.cpp">preprocessor_eval_category.cpp</a> test programs demonstrate proper usage of this
  1534. macro.</p>
  1535. <p><strong>Macro parameters:</strong></p>
  1536. <ul class="simple">
  1537. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
  1538. <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
  1539. generated forwarding functions.</li>
  1540. <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
  1541. function resides.</li>
  1542. <li><tt class="docutils literal">arguments</tt> is a <a class="reference external" href="../../../preprocessor/doc/index.html">Boost.Preprocessor</a> <a class="reference external" href="../../../preprocessor/doc/data/sequences.html">sequence</a> of
  1543. <em>argument-specifiers</em>, as defined below.</li>
  1544. </ul>
  1545. <p><strong>Argument specifiers syntax:</strong></p>
  1546. <pre class="literal-block">
  1547. argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
  1548. specifier-group0 ::= <em>specifier-group1</em> |
  1549. (
  1550. '<strong>(</strong>' '<strong>deduced</strong>'
  1551. <em>specifier-group1</em> {<em>specifier-group1</em>}
  1552. '<strong>)</strong>'
  1553. )
  1554. specifier-group1 ::=
  1555. (
  1556. '<strong>(</strong>' '<strong>optional</strong>'
  1557. <em>optional-specifier</em> {<em>optional-specifier</em>}
  1558. '<strong>)</strong>'
  1559. ) | (
  1560. '<strong>(</strong>' '<strong>required</strong>'
  1561. <em>required-specifier</em> {<em>required-specifier</em>}
  1562. '<strong>)</strong>'
  1563. )
  1564. optional-specifier ::=
  1565. '<strong>(</strong>'
  1566. <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> '<strong>,</strong>' <em>default-value</em>
  1567. ')'
  1568. required-specifier ::=
  1569. '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
  1570. restriction ::=
  1571. ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
  1572. ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
  1573. '<strong>*</strong>'
  1574. </pre>
  1575. <ul class="simple">
  1576. <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
  1577. <li><tt class="docutils literal"><span class="pre">default-value</span></tt> is any valid C++ expression; if necessary, user code can
  1578. compute it in terms of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>, where <tt class="docutils literal"><span class="pre">previous-name</span></tt>
  1579. is the <tt class="docutils literal"><span class="pre">argument-name</span></tt> in a previous <tt class="docutils literal"><span class="pre">specifier-group0</span></tt> or
  1580. <tt class="docutils literal"><span class="pre">specifier-group1</span></tt>. <em>This expression will be invoked exactly once.</em></li>
  1581. <li><tt class="docutils literal">mfc</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary Metafunction Class</a> whose first argument will
  1582. be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
  1583. will be the entire <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is a <a class="reference external" href="../../../mpl/doc/refmanual/integral-constant.html">Boolean
  1584. Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
  1585. of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
  1586. <li><tt class="docutils literal"><span class="pre">type-name</span></tt> is either the name of a <strong>target type</strong> or an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary
  1587. Metafunction Class</a> whose first argument will be the type of the
  1588. corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
  1589. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>. If
  1590. <tt class="docutils literal">restriction</tt> uses this form, then the type of the generated name
  1591. <tt class="docutils literal"><span class="pre">argument-name</span> ## _type</tt> will be computed in terms of the <strong>target
  1592. type</strong>, and the generated reference <tt class="docutils literal"><span class="pre">argument-name</span></tt> (but not its
  1593. corresponding entry in <tt class="docutils literal">args</tt>) will be cast to that type.</li>
  1594. </ul>
  1595. <p><strong>Approximate expansion:</strong></p>
  1596. <p>Where:</p>
  1597. <ul class="simple">
  1598. <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  1599. <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  1600. </ul>
  1601. <pre class="literal-block">
  1602. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  1603. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  1604. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  1605. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  1606. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  1607. template &lt;typename Args&gt;
  1608. using boost_param_result_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
  1609. // If <strong>result</strong> is a simple return type:
  1610. template &lt;typename Args&gt;
  1611. struct boost_param_result_ ## __LINE__ ## <strong>name</strong>
  1612. {
  1613. typedef <strong>result</strong> type;
  1614. };
  1615. struct boost_param_params_ ## __LINE__ ## <strong>name</strong>
  1616. : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  1617. <em>list of parameter specifications, based on arguments</em>
  1618. &gt;
  1619. {
  1620. };
  1621. typedef boost_param_params_ ## __LINE__ ## <strong>name</strong>
  1622. boost_param_parameters_ ## __LINE__ ## <strong>name</strong>;
  1623. template &lt;typename Args&gt;
  1624. typename boost_param_result_ ## __LINE__ ## <strong>name</strong>&lt;Args&gt;::type
  1625. boost_param_impl ## __LINE__ ## <strong>name</strong>(Args const&amp;);
  1626. template &lt;typename A0, …, typename A ## <strong>n</strong>&gt;
  1627. <strong>result</strong> <strong>name</strong>(
  1628. A0&amp;&amp; a0, …, A ## <strong>n</strong>&amp;&amp; a ## <strong>n</strong>
  1629. , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
  1630. ::match&lt;A0, …, A ## <strong>n</strong>&gt;::type
  1631. = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
  1632. )
  1633. {
  1634. return boost_param_impl ## __LINE__ ## <strong>name</strong>(
  1635. boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
  1636. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  1637. , …
  1638. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>n</strong>&gt;(a ## <strong>n</strong>)
  1639. )
  1640. );
  1641. }
  1642. <span class="vellipsis">⋮</span>
  1643. template &lt;typename A0, …, typename A ## <strong>m</strong>&gt;
  1644. <strong>result</strong> <strong>name</strong>(
  1645. A0&amp;&amp; a0, …, A ## <strong>m</strong>&amp;&amp; a ## <strong>m</strong>
  1646. , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
  1647. ::match&lt;A0, …, A ## <strong>m</strong>&gt;::type
  1648. = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
  1649. )
  1650. {
  1651. return boost_param_impl ## __LINE__ ## <strong>name</strong>(
  1652. boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
  1653. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  1654. , …
  1655. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>m</strong>&gt;(a ## <strong>m</strong>)
  1656. )
  1657. );
  1658. }
  1659. template &lt;
  1660. typename ResultType
  1661. , typename Args
  1662. , typename <em>argument name</em> ## <strong>0</strong> ## _type
  1663. , …
  1664. , typename <em>argument name</em> ## <strong>n</strong> ## _type
  1665. &gt;
  1666. ResultType
  1667. boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
  1668. (ResultType(*)())
  1669. , Args const&amp; args
  1670. , <em>argument name</em> ## <strong>0</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>0</strong>
  1671. , …
  1672. , <em>argument name</em> ## <strong>n</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>m</strong>
  1673. );
  1674. <span class="vellipsis">⋮</span>
  1675. template &lt;
  1676. typename ResultType
  1677. , typename Args
  1678. , typename <em>argument name</em> ## <strong>0</strong> ## _type
  1679. , …
  1680. , typename <em>argument name</em> ## <strong>m</strong> ## _type
  1681. &gt;
  1682. ResultType
  1683. boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
  1684. (ResultType(*)())
  1685. , Args const&amp; args
  1686. , <em>argument name</em> ## <strong>0</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>0</strong>
  1687. , …
  1688. , <em>argument name</em> ## <strong>m</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>m</strong>
  1689. );
  1690. template &lt;typename Args&gt;
  1691. typename boost_param_result_ ## __LINE__ ## <strong>name</strong>&lt;Args&gt;::type
  1692. boost_param_impl ## __LINE__ ## <strong>name</strong>(Args const&amp; args)
  1693. {
  1694. return boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
  1695. static_cast&lt;
  1696. typename boost_param_result_ ## __LINE__ ## <strong>name</strong>&lt;
  1697. Args
  1698. &gt;::type(*)()
  1699. &gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  1700. , args
  1701. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  1702. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  1703. Args
  1704. , <em>keyword tag type of required parameter</em> ## <strong>0</strong>
  1705. &gt;::type
  1706. &gt;(args[ <em>keyword object of required parameter</em> ## <strong>0</strong>])
  1707. , …
  1708. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  1709. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  1710. Args
  1711. , <em>keyword tag type of required parameter</em> ## <strong>n</strong>
  1712. &gt;::type
  1713. &gt;(args[ <em>keyword object of required parameter</em> ## <strong>n</strong>])
  1714. );
  1715. }
  1716. template &lt;
  1717. typename ResultType
  1718. , typename Args
  1719. , typename <em>argument name</em> ## <strong>0</strong> ## _type
  1720. , …
  1721. , typename <em>argument name</em> ## <strong>n</strong> ## _type
  1722. &gt;
  1723. ResultType
  1724. boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
  1725. (ResultType(*)())
  1726. , Args const&amp; args
  1727. , <em>argument name</em> ## <strong>0</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>0</strong>
  1728. , …
  1729. , <em>argument name</em> ## <strong>n</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>n</strong>
  1730. )
  1731. {
  1732. return boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
  1733. static_cast&lt;ResultType(*)()&gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  1734. , (args, <em>keyword object of optional parameter</em> ## <strong>n + 1</strong> =
  1735. <em>default value of optional parameter</em> ## <strong>n + 1</strong>
  1736. )
  1737. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;<em>argument name</em> ## <strong>0</strong> ## _type&gt;(
  1738. <em>argument name</em> ## <strong>0</strong>
  1739. )
  1740. , …
  1741. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;<em>argument name</em> ## <strong>n</strong> ## _type&gt;(
  1742. <em>argument name</em> ## <strong>n</strong>
  1743. )
  1744. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  1745. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  1746. Args
  1747. , <em>keyword tag type of optional parameter</em> ## <strong>n + 1</strong>
  1748. &gt;::type
  1749. &gt;(<em>default value of optional parameter</em> ## <strong>n + 1</strong>)
  1750. );
  1751. }
  1752. <span class="vellipsis">⋮</span>
  1753. template &lt;
  1754. typename ResultType
  1755. , typename Args
  1756. , typename <em>argument name</em> ## <strong>0</strong> ## _type
  1757. , …
  1758. , typename <em>argument name</em> ## <strong>m</strong> ## _type
  1759. &gt;
  1760. ResultType
  1761. boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
  1762. (ResultType(*)())
  1763. , Args const&amp; args
  1764. , <em>argument name</em> ## <strong>0</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>0</strong>
  1765. , …
  1766. , <em>argument name</em> ## <strong>m</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>m</strong>
  1767. )
  1768. </pre>
  1769. </div>
  1770. <div class="section" id="boost-parameter-member-function-result-name-tag-namespace-arguments">
  1771. <span id="boost-parameter-member-function"></span><h2><a class="toc-backref" href="#id58">7.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_MEMBER_FUNCTION(result, name, tag_namespace, arguments)</tt></a></h2>
  1772. <table class="docutils field-list" frame="void" rules="none">
  1773. <col class="field-name" />
  1774. <col class="field-body" />
  1775. <tbody valign="top">
  1776. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td>
  1777. </tr>
  1778. </tbody>
  1779. </table>
  1780. <p>Generates a member function that can take in positional arguments, composed
  1781. arguments, named arguments, and deduced arguments.</p>
  1782. <table class="docutils field-list" frame="void" rules="none">
  1783. <col class="field-name" />
  1784. <col class="field-body" />
  1785. <tbody valign="top">
  1786. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  1787. </tr>
  1788. </tbody>
  1789. </table>
  1790. <p>The return type of each of the following function templates falls under a
  1791. different value category.</p>
  1792. <pre class="literal-block">
  1793. template &lt;std::size_t N&gt;
  1794. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; rvalue_bitset()
  1795. {
  1796. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  1797. }
  1798. template &lt;std::size_t N&gt;
  1799. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const rvalue_const_bitset()
  1800. {
  1801. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  1802. }
  1803. template &lt;std::size_t N&gt;
  1804. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp; lvalue_bitset()
  1805. {
  1806. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  1807. return lset;
  1808. }
  1809. template &lt;std::size_t N&gt;
  1810. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp; lvalue_const_bitset()
  1811. {
  1812. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  1813. return clset;
  1814. }
  1815. </pre>
  1816. <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
  1817. to return the correct value category when passed in an object returned by one
  1818. of the functions defined above. Assume that
  1819. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
  1820. <pre class="literal-block">
  1821. enum invoked
  1822. {
  1823. passed_by_lvalue_reference_to_const
  1824. , passed_by_lvalue_reference
  1825. , passed_by_rvalue_reference_to_const
  1826. , passed_by_rvalue_reference
  1827. };
  1828. struct U
  1829. {
  1830. template &lt;std::size_t N&gt;
  1831. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;)
  1832. {
  1833. return passed_by_lvalue_reference_to_const;
  1834. }
  1835. template &lt;std::size_t N&gt;
  1836. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;)
  1837. {
  1838. return passed_by_lvalue_reference;
  1839. }
  1840. template &lt;std::size_t N&gt;
  1841. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;&amp;)
  1842. {
  1843. return passed_by_rvalue_reference_to_const;
  1844. }
  1845. template &lt;std::size_t N&gt;
  1846. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;&amp;)
  1847. {
  1848. return passed_by_rvalue_reference;
  1849. }
  1850. };
  1851. </pre>
  1852. <p>Define the named parameters that will comprise the argument specification that
  1853. this macro will use. Ensure that all their tag types are in the same
  1854. namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
  1855. underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
  1856. same argument to which the corresponding named parameter (without underscores)
  1857. is bound, as will be shown later.</p>
  1858. <pre class="literal-block">
  1859. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
  1860. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
  1861. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
  1862. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
  1863. </pre>
  1864. <p>Use the macro as a substitute for a normal <tt class="docutils literal">static</tt> member function
  1865. header. Enclose the return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter,
  1866. also enclose the expected value type in parentheses. Since the value types
  1867. are mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
  1868. clause. Otherwise, just as with a normal function, the order in which you
  1869. specify the parameters determines their position. Also, just as with a normal
  1870. function, optional parameters have default values, whereas required parameters
  1871. do not. Within the function body, either simply use the parameter name or
  1872. pass the matching identifier with the leading underscore to the bracket
  1873. operator of <tt class="docutils literal">args</tt> to extract the corresponding argument. Note that the
  1874. second method doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to preserve value categories.</p>
  1875. <pre class="literal-block">
  1876. struct B
  1877. {
  1878. BOOST_PARAMETER_MEMBER_FUNCTION((bool), static evaluate, kw,
  1879. (deduced
  1880. (required
  1881. (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;1&gt;))
  1882. (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;2&gt;))
  1883. )
  1884. (optional
  1885. (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;3&gt;), rvalue_const_bitset&lt;2&gt;())
  1886. (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;4&gt;), rvalue_bitset&lt;3&gt;())
  1887. )
  1888. )
  1889. )
  1890. {
  1891. BOOST_TEST_EQ(
  1892. passed_by_lvalue_reference_to_const
  1893. , U::evaluate_category&lt;0&gt;(lrc)
  1894. );
  1895. BOOST_TEST_EQ(
  1896. passed_by_lvalue_reference
  1897. , U::evaluate_category&lt;1&gt;(lr)
  1898. );
  1899. BOOST_TEST_EQ(
  1900. passed_by_rvalue_reference_to_const
  1901. , U::evaluate_category&lt;2&gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;rrc0_type&gt;(rrc0))
  1902. );
  1903. BOOST_TEST_EQ(
  1904. passed_by_rvalue_reference
  1905. , U::evaluate_category&lt;3&gt;(args[_rr0])
  1906. );
  1907. return true;
  1908. }
  1909. };
  1910. </pre>
  1911. <p>The following function calls are legal.</p>
  1912. <pre class="literal-block">
  1913. B::evaluate( // positional arguments
  1914. lvalue_const_bitset&lt;0&gt;()
  1915. , lvalue_bitset&lt;1&gt;()
  1916. , rvalue_const_bitset&lt;2&gt;()
  1917. , rvalue_bitset&lt;3&gt;()
  1918. );
  1919. B::evaluate( // positional arguments
  1920. lvalue_const_bitset&lt;0&gt;()
  1921. , lvalue_bitset&lt;1&gt;()
  1922. );
  1923. B::evaluate(( // composed arguments
  1924. _rr0 = rvalue_bitset&lt;3&gt;()
  1925. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  1926. , _lr0 = lvalue_bitset&lt;1&gt;()
  1927. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  1928. ));
  1929. B::evaluate( // named arguments
  1930. _rr0 = rvalue_bitset&lt;3&gt;()
  1931. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  1932. , _lr0 = lvalue_bitset&lt;1&gt;()
  1933. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  1934. );
  1935. B::evaluate( // named arguments
  1936. _lr0 = lvalue_bitset&lt;1&gt;()
  1937. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  1938. );
  1939. </pre>
  1940. <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
  1941. function calls are also legal.</p>
  1942. <pre class="literal-block">
  1943. B::evaluate( // deduced arguments
  1944. rvalue_bitset&lt;3&gt;()
  1945. , lvalue_const_bitset&lt;0&gt;()
  1946. , lvalue_bitset&lt;1&gt;()
  1947. , rvalue_const_bitset&lt;2&gt;()
  1948. );
  1949. B::evaluate( // deduced arguments
  1950. lvalue_bitset&lt;1&gt;()
  1951. , lvalue_const_bitset&lt;0&gt;()
  1952. );
  1953. </pre>
  1954. <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> and <a class="reference external" href="../../test/preprocessor_eval_category.cpp">preprocessor_eval_category.cpp</a> test programs
  1955. demonstrate proper usage of this macro.</p>
  1956. <p><strong>Macro parameters:</strong></p>
  1957. <ul class="simple">
  1958. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
  1959. <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
  1960. generated forwarding functions. <tt class="docutils literal">name</tt> may be qualified by the
  1961. <tt class="docutils literal">static</tt> keyword to declare the member function and its helpers as not
  1962. associated with any object of the enclosing type.</li>
  1963. <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
  1964. function resides.</li>
  1965. <li><tt class="docutils literal">arguments</tt> is a <a class="reference external" href="../../../preprocessor/doc/index.html">Boost.Preprocessor</a> <a class="reference external" href="../../../preprocessor/doc/data/sequences.html">sequence</a> of
  1966. <em>argument-specifiers</em>, as defined below.</li>
  1967. </ul>
  1968. <p><strong>Argument specifiers syntax:</strong></p>
  1969. <pre class="literal-block">
  1970. argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
  1971. specifier-group0 ::= <em>specifier-group1</em> |
  1972. (
  1973. '<strong>(</strong>' '<strong>deduced</strong>'
  1974. <em>specifier-group1</em> {<em>specifier-group1</em>}
  1975. '<strong>)</strong>'
  1976. )
  1977. specifier-group1 ::=
  1978. (
  1979. '<strong>(</strong>' '<strong>optional</strong>'
  1980. <em>optional-specifier</em> {<em>optional-specifier</em>}
  1981. '<strong>)</strong>'
  1982. ) | (
  1983. '<strong>(</strong>' '<strong>required</strong>'
  1984. <em>required-specifier</em> {<em>required-specifier</em>}
  1985. '<strong>)</strong>'
  1986. )
  1987. optional-specifier ::=
  1988. '<strong>(</strong>'
  1989. <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> '<strong>,</strong>' <em>default-value</em>
  1990. ')'
  1991. required-specifier ::=
  1992. '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
  1993. restriction ::=
  1994. ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
  1995. ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
  1996. '<strong>*</strong>'
  1997. </pre>
  1998. <ul class="simple">
  1999. <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
  2000. <li><tt class="docutils literal"><span class="pre">default-value</span></tt> is any valid C++ expression; if necessary, user code can
  2001. compute it in terms of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>, where <tt class="docutils literal"><span class="pre">previous-name</span></tt>
  2002. is the <tt class="docutils literal"><span class="pre">argument-name</span></tt> in a previous <tt class="docutils literal"><span class="pre">specifier-group0</span></tt> or
  2003. <tt class="docutils literal"><span class="pre">specifier-group1</span></tt>. <em>This expression will be invoked exactly once.</em></li>
  2004. <li><tt class="docutils literal">mfc</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary Metafunction Class</a> whose first argument will
  2005. be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
  2006. will be the entire <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is a <a class="reference external" href="../../../mpl/doc/refmanual/integral-constant.html">Boolean
  2007. Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
  2008. of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
  2009. <li><tt class="docutils literal"><span class="pre">type-name</span></tt> is either the name of a <strong>target type</strong> or an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary
  2010. Metafunction Class</a> whose first argument will be the type of the
  2011. corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
  2012. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>. If
  2013. <tt class="docutils literal">restriction</tt> uses this form, then the type of the generated name
  2014. <tt class="docutils literal"><span class="pre">argument-name</span> ## _type</tt> will be computed in terms of the <strong>target
  2015. type</strong>, and the generated reference <tt class="docutils literal"><span class="pre">argument-name</span></tt> (but not its
  2016. corresponding entry in <tt class="docutils literal">args</tt>) will be cast to that type.</li>
  2017. </ul>
  2018. <p><strong>Approximate expansion:</strong></p>
  2019. <p>Where:</p>
  2020. <ul class="simple">
  2021. <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  2022. <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  2023. </ul>
  2024. <pre class="literal-block">
  2025. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  2026. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  2027. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  2028. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  2029. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  2030. template &lt;typename Args&gt;
  2031. using boost_param_result_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
  2032. // If <strong>result</strong> is a simple return type:
  2033. template &lt;typename Args&gt;
  2034. struct boost_param_result_ ## __LINE__ ## <strong>name</strong>
  2035. {
  2036. typedef <strong>result</strong> type;
  2037. };
  2038. struct boost_param_params_ ## __LINE__ ## <strong>name</strong>
  2039. : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  2040. <em>list of parameter specifications, based on arguments</em>
  2041. &gt;
  2042. {
  2043. };
  2044. typedef boost_param_params_ ## __LINE__ ## <strong>name</strong>
  2045. boost_param_parameters_ ## __LINE__ ## <strong>name</strong>;
  2046. template &lt;typename A0, …, typename A ## <strong>n</strong>&gt;
  2047. <strong>result</strong> <strong>name</strong>(
  2048. A0&amp;&amp; a0, …, A ## <strong>n</strong>&amp;&amp; a ## <strong>n</strong>
  2049. , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
  2050. ::match&lt;A0, …, A ## <strong>n</strong>&gt;::type
  2051. = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
  2052. )
  2053. {
  2054. return this-&gt;boost_param_impl ## __LINE__ ## <strong>name</strong>(
  2055. boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
  2056. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  2057. , …
  2058. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>n</strong>&gt;(a ## <strong>n</strong>)
  2059. )
  2060. );
  2061. }
  2062. <span class="vellipsis">⋮</span>
  2063. template &lt;typename A0, …, typename A ## <strong>m</strong>&gt;
  2064. <strong>result</strong> <strong>name</strong>(
  2065. A0&amp;&amp; a0, …, A ## <strong>m</strong>&amp;&amp; a ## <strong>m</strong>
  2066. , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
  2067. ::match&lt;A0, …, A ## <strong>m</strong>&gt;::type
  2068. = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
  2069. )
  2070. {
  2071. return this-&gt;boost_param_impl ## __LINE__ ## <strong>name</strong>(
  2072. boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
  2073. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  2074. , …
  2075. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>m</strong>&gt;(a ## <strong>m</strong>)
  2076. )
  2077. );
  2078. }
  2079. template &lt;typename Args&gt;
  2080. typename boost_param_result_ ## __LINE__ ## <strong>name</strong>&lt;Args&gt;::type
  2081. boost_param_impl ## __LINE__ ## <strong>name</strong>(Args const&amp; args)
  2082. {
  2083. return this-&gt;boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
  2084. static_cast&lt;
  2085. typename boost_param_result_ ## __LINE__ ## <strong>name</strong>&lt;
  2086. Args
  2087. &gt;::type(*)()
  2088. &gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  2089. , args
  2090. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  2091. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  2092. Args
  2093. , <em>keyword tag type of required parameter</em> ## <strong>0</strong>
  2094. &gt;::type
  2095. &gt;(args[ <em>keyword object of required parameter</em> ## <strong>0</strong>])
  2096. , …
  2097. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  2098. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  2099. Args
  2100. , <em>keyword tag type of required parameter</em> ## <strong>n</strong>
  2101. &gt;::type
  2102. &gt;(args[ <em>keyword object of required parameter</em> ## <strong>n</strong>])
  2103. );
  2104. }
  2105. template &lt;
  2106. typename ResultType
  2107. , typename Args
  2108. , typename <em>argument name</em> ## <strong>0</strong> ## _type
  2109. , …
  2110. , typename <em>argument name</em> ## <strong>n</strong> ## _type
  2111. &gt;
  2112. ResultType
  2113. boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
  2114. (ResultType(*)())
  2115. , Args const&amp; args
  2116. , <em>argument name</em> ## <strong>0</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>0</strong>
  2117. , …
  2118. , <em>argument name</em> ## <strong>n</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>n</strong>
  2119. )
  2120. {
  2121. return this-&gt;boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
  2122. static_cast&lt;ResultType(*)()&gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  2123. , (args, <em>keyword object of optional parameter</em> ## <strong>n + 1</strong> =
  2124. <em>default value of optional parameter</em> ## <strong>n + 1</strong>
  2125. )
  2126. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;<em>argument name</em> ## <strong>0</strong> ## _type&gt;(
  2127. <em>argument name</em> ## <strong>0</strong>
  2128. )
  2129. , …
  2130. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;<em>argument name</em> ## <strong>n</strong> ## _type&gt;(
  2131. <em>argument name</em> ## <strong>n</strong>
  2132. )
  2133. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  2134. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  2135. Args
  2136. , <em>keyword tag type of optional parameter</em> ## <strong>n + 1</strong>
  2137. &gt;::type
  2138. &gt;(<em>default value of optional parameter</em> ## <strong>n + 1</strong>)
  2139. );
  2140. }
  2141. <span class="vellipsis">⋮</span>
  2142. template &lt;
  2143. typename ResultType
  2144. , typename Args
  2145. , typename <em>argument name</em> ## <strong>0</strong> ## _type
  2146. , …
  2147. , typename <em>argument name</em> ## <strong>m</strong> ## _type
  2148. &gt;
  2149. ResultType
  2150. boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
  2151. (ResultType(*)())
  2152. , Args const&amp; args
  2153. , <em>argument name</em> ## <strong>0</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>0</strong>
  2154. , …
  2155. , <em>argument name</em> ## <strong>m</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>m</strong>
  2156. )
  2157. </pre>
  2158. </div>
  2159. <div class="section" id="boost-parameter-const-member-function-result-name-tag-ns-arguments">
  2160. <span id="boost-parameter-const-member-function"></span><h2><a class="toc-backref" href="#id59">7.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_CONST_MEMBER_FUNCTION(result, name, tag_ns, arguments)</tt></a></h2>
  2161. <table class="docutils field-list" frame="void" rules="none">
  2162. <col class="field-name" />
  2163. <col class="field-body" />
  2164. <tbody valign="top">
  2165. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td>
  2166. </tr>
  2167. </tbody>
  2168. </table>
  2169. <p>Generates a member function that can take in positional arguments, composed
  2170. arguments, named arguments, and deduced arguments.</p>
  2171. <table class="docutils field-list" frame="void" rules="none">
  2172. <col class="field-name" />
  2173. <col class="field-body" />
  2174. <tbody valign="top">
  2175. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  2176. </tr>
  2177. </tbody>
  2178. </table>
  2179. <p>The return type of each of the following function templates falls under a
  2180. different value category.</p>
  2181. <pre class="literal-block">
  2182. template &lt;std::size_t N&gt;
  2183. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; rvalue_bitset()
  2184. {
  2185. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  2186. }
  2187. template &lt;std::size_t N&gt;
  2188. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const rvalue_const_bitset()
  2189. {
  2190. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  2191. }
  2192. template &lt;std::size_t N&gt;
  2193. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp; lvalue_bitset()
  2194. {
  2195. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  2196. return lset;
  2197. }
  2198. template &lt;std::size_t N&gt;
  2199. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp; lvalue_const_bitset()
  2200. {
  2201. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  2202. return clset;
  2203. }
  2204. </pre>
  2205. <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
  2206. to return the correct value category when passed in an object returned by one
  2207. of the functions defined above. Assume that
  2208. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
  2209. <pre class="literal-block">
  2210. enum invoked
  2211. {
  2212. passed_by_lvalue_reference_to_const
  2213. , passed_by_lvalue_reference
  2214. , passed_by_rvalue_reference_to_const
  2215. , passed_by_rvalue_reference
  2216. };
  2217. struct U
  2218. {
  2219. template &lt;std::size_t N&gt;
  2220. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;)
  2221. {
  2222. return passed_by_lvalue_reference_to_const;
  2223. }
  2224. template &lt;std::size_t N&gt;
  2225. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;)
  2226. {
  2227. return passed_by_lvalue_reference;
  2228. }
  2229. template &lt;std::size_t N&gt;
  2230. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;&amp;)
  2231. {
  2232. return passed_by_rvalue_reference_to_const;
  2233. }
  2234. template &lt;std::size_t N&gt;
  2235. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;&amp;)
  2236. {
  2237. return passed_by_rvalue_reference;
  2238. }
  2239. };
  2240. </pre>
  2241. <p>Define the named parameters that will comprise the argument specification that
  2242. this macro will use. Ensure that all their tag types are in the same
  2243. namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
  2244. underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
  2245. same argument to which the corresponding named parameter (without underscores)
  2246. is bound, as will be shown later.</p>
  2247. <pre class="literal-block">
  2248. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
  2249. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
  2250. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
  2251. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
  2252. </pre>
  2253. <p>Use the macro as a substitute for a normal <tt class="docutils literal">const</tt> member function
  2254. header. Enclose the return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter,
  2255. also enclose the expected value type in parentheses. Since the value types
  2256. are mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
  2257. clause. Otherwise, just as with a normal function, the order in which you
  2258. specify the parameters determines their position. Also, just as with a normal
  2259. function, optional parameters have default values, whereas required parameters
  2260. do not. Within the function body, either simply use the parameter name or
  2261. pass the matching identifier with the leading underscore to the bracket
  2262. operator of <tt class="docutils literal">args</tt> to extract the corresponding argument. Note that the
  2263. second method doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to preserve value categories.</p>
  2264. <pre class="literal-block">
  2265. struct B
  2266. {
  2267. B()
  2268. {
  2269. }
  2270. BOOST_PARAMETER_CONST_MEMBER_FUNCTION((bool), evaluate, kw,
  2271. (deduced
  2272. (required
  2273. (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;1&gt;))
  2274. (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;2&gt;))
  2275. )
  2276. (optional
  2277. (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;3&gt;), rvalue_const_bitset&lt;2&gt;())
  2278. (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;4&gt;), rvalue_bitset&lt;3&gt;())
  2279. )
  2280. )
  2281. )
  2282. {
  2283. BOOST_TEST_EQ(
  2284. passed_by_lvalue_reference_to_const
  2285. , U::evaluate_category&lt;0&gt;(lrc)
  2286. );
  2287. BOOST_TEST_EQ(
  2288. passed_by_lvalue_reference
  2289. , U::evaluate_category&lt;1&gt;(lr)
  2290. );
  2291. BOOST_TEST_EQ(
  2292. passed_by_rvalue_reference_to_const
  2293. , U::evaluate_category&lt;2&gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;rrc0_type&gt;(rrc0))
  2294. );
  2295. BOOST_TEST_EQ(
  2296. passed_by_rvalue_reference
  2297. , U::evaluate_category&lt;3&gt;(args[_rr0])
  2298. );
  2299. return true;
  2300. }
  2301. };
  2302. </pre>
  2303. <p>The following function calls are legal.</p>
  2304. <pre class="literal-block">
  2305. B const b = B();
  2306. b.evaluate( // positional arguments
  2307. lvalue_const_bitset&lt;0&gt;()
  2308. , lvalue_bitset&lt;1&gt;()
  2309. , rvalue_const_bitset&lt;2&gt;()
  2310. , rvalue_bitset&lt;3&gt;()
  2311. );
  2312. b.evaluate( // positional arguments
  2313. lvalue_const_bitset&lt;0&gt;()
  2314. , lvalue_bitset&lt;1&gt;()
  2315. );
  2316. b.evaluate(( // composed arguments
  2317. _rr0 = rvalue_bitset&lt;3&gt;()
  2318. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  2319. , _lr0 = lvalue_bitset&lt;1&gt;()
  2320. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  2321. ));
  2322. b.evaluate( // named arguments
  2323. _rr0 = rvalue_bitset&lt;3&gt;()
  2324. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  2325. , _lr0 = lvalue_bitset&lt;1&gt;()
  2326. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  2327. );
  2328. b.evaluate( // named arguments
  2329. _lr0 = lvalue_bitset&lt;1&gt;()
  2330. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  2331. );
  2332. </pre>
  2333. <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
  2334. function calls are also legal.</p>
  2335. <pre class="literal-block">
  2336. b.evaluate( // deduced arguments
  2337. rvalue_bitset&lt;3&gt;()
  2338. , lvalue_const_bitset&lt;0&gt;()
  2339. , lvalue_bitset&lt;1&gt;()
  2340. , rvalue_const_bitset&lt;2&gt;()
  2341. );
  2342. b.evaluate( // deduced arguments
  2343. lvalue_bitset&lt;1&gt;()
  2344. , lvalue_const_bitset&lt;0&gt;()
  2345. );
  2346. </pre>
  2347. <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> test program demonstrates proper usage of this macro.</p>
  2348. <p><strong>Macro parameters:</strong></p>
  2349. <ul class="simple">
  2350. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
  2351. <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
  2352. generated forwarding functions.</li>
  2353. <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
  2354. function resides.</li>
  2355. <li><tt class="docutils literal">arguments</tt> is a <a class="reference external" href="../../../preprocessor/doc/index.html">Boost.Preprocessor</a> <a class="reference external" href="../../../preprocessor/doc/data/sequences.html">sequence</a> of
  2356. <em>argument-specifiers</em>, as defined below.</li>
  2357. </ul>
  2358. <p><strong>Argument specifiers syntax:</strong></p>
  2359. <pre class="literal-block">
  2360. argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
  2361. specifier-group0 ::= <em>specifier-group1</em> |
  2362. (
  2363. '<strong>(</strong>' '<strong>deduced</strong>'
  2364. <em>specifier-group1</em> {<em>specifier-group1</em>}
  2365. '<strong>)</strong>'
  2366. )
  2367. specifier-group1 ::=
  2368. (
  2369. '<strong>(</strong>' '<strong>optional</strong>'
  2370. <em>optional-specifier</em> {<em>optional-specifier</em>}
  2371. '<strong>)</strong>'
  2372. ) | (
  2373. '<strong>(</strong>' '<strong>required</strong>'
  2374. <em>required-specifier</em> {<em>required-specifier</em>}
  2375. '<strong>)</strong>'
  2376. )
  2377. optional-specifier ::=
  2378. '<strong>(</strong>'
  2379. <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> '<strong>,</strong>' <em>default-value</em>
  2380. ')'
  2381. required-specifier ::=
  2382. '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
  2383. restriction ::=
  2384. ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
  2385. ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
  2386. '<strong>*</strong>'
  2387. </pre>
  2388. <ul class="simple">
  2389. <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
  2390. <li><tt class="docutils literal"><span class="pre">default-value</span></tt> is any valid C++ expression; if necessary, user code can
  2391. compute it in terms of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>, where <tt class="docutils literal"><span class="pre">previous-name</span></tt>
  2392. is the <tt class="docutils literal"><span class="pre">argument-name</span></tt> in a previous <tt class="docutils literal"><span class="pre">specifier-group0</span></tt> or
  2393. <tt class="docutils literal"><span class="pre">specifier-group1</span></tt>. <em>This expression will be invoked exactly once.</em></li>
  2394. <li><tt class="docutils literal">mfc</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary Metafunction Class</a> whose first argument will
  2395. be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
  2396. will be the entire <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is a <a class="reference external" href="../../../mpl/doc/refmanual/integral-constant.html">Boolean
  2397. Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
  2398. of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
  2399. <li><tt class="docutils literal"><span class="pre">type-name</span></tt> is either the name of a <strong>target type</strong> or an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary
  2400. Metafunction Class</a> whose first argument will be the type of the
  2401. corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
  2402. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>. If
  2403. <tt class="docutils literal">restriction</tt> uses this form, then the type of the generated name
  2404. <tt class="docutils literal"><span class="pre">argument-name</span> ## _type</tt> will be computed in terms of the <strong>target
  2405. type</strong>, and the generated reference <tt class="docutils literal"><span class="pre">argument-name</span></tt> (but not its
  2406. corresponding entry in <tt class="docutils literal">args</tt>) will be cast to that type.</li>
  2407. </ul>
  2408. <p><strong>Approximate expansion:</strong></p>
  2409. <p>Where:</p>
  2410. <ul class="simple">
  2411. <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  2412. <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  2413. </ul>
  2414. <pre class="literal-block">
  2415. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  2416. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  2417. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  2418. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  2419. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  2420. template &lt;typename Args&gt;
  2421. using boost_param_result_const_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
  2422. // If <strong>result</strong> is a simple return type:
  2423. template &lt;typename Args&gt;
  2424. struct boost_param_result_const_ ## __LINE__ ## <strong>name</strong>
  2425. {
  2426. typedef <strong>result</strong> type;
  2427. };
  2428. struct boost_param_params_const_ ## __LINE__ ## <strong>name</strong>
  2429. : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  2430. <em>list of parameter specifications, based on arguments</em>
  2431. &gt;
  2432. {
  2433. };
  2434. typedef boost_param_params_const_ ## __LINE__ ## <strong>name</strong>
  2435. boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>;
  2436. template &lt;typename A0, …, typename A ## <strong>n</strong>&gt;
  2437. <strong>result</strong> <strong>name</strong>(
  2438. A0&amp;&amp; a0, …, A ## <strong>n</strong>&amp;&amp; a ## <strong>n</strong>
  2439. , typename boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>
  2440. ::match&lt;A0, …, A ## <strong>n</strong>&gt;::type
  2441. = boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>()
  2442. ) const
  2443. {
  2444. return this-&gt;boost_param_impl_const ## __LINE__ ## <strong>name</strong>(
  2445. boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>(
  2446. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  2447. , …
  2448. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>n</strong>&gt;(a ## <strong>n</strong>)
  2449. )
  2450. );
  2451. }
  2452. <span class="vellipsis">⋮</span>
  2453. template &lt;typename A0, …, typename A ## <strong>m</strong>&gt;
  2454. <strong>result</strong> <strong>name</strong>(
  2455. A0&amp;&amp; a0, …, A ## <strong>m</strong>&amp;&amp; a ## <strong>m</strong>
  2456. , typename boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>
  2457. ::match&lt;A0, …, A ## <strong>m</strong>&gt;::type
  2458. = boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>()
  2459. ) const
  2460. {
  2461. return this-&gt;boost_param_impl_const ## __LINE__ ## <strong>name</strong>(
  2462. boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>()(
  2463. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  2464. , …
  2465. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>m</strong>&gt;(a ## <strong>m</strong>)
  2466. )
  2467. );
  2468. }
  2469. template &lt;typename Args&gt;
  2470. typename boost_param_result_const_ ## __LINE__ ## <strong>name</strong>&lt;Args&gt;::type
  2471. boost_param_impl_const ## __LINE__ ## <strong>name</strong>(Args const&amp; args) const
  2472. {
  2473. return this-&gt;
  2474. boost_param_dispatch_const_0boost_ ## __LINE__ ## <strong>name</strong>(
  2475. static_cast&lt;
  2476. typename boost_param_result_const_ ## __LINE__ ## <strong>name</strong>&lt;
  2477. Args
  2478. &gt;::type(*)()
  2479. &gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  2480. , args
  2481. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  2482. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  2483. Args
  2484. , <em>keyword tag type of required parameter</em> ## <strong>0</strong>
  2485. &gt;::type
  2486. &gt;(args[ <em>keyword object of required parameter</em> ## <strong>0</strong>])
  2487. , …
  2488. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  2489. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  2490. Args
  2491. , <em>keyword tag type of required parameter</em> ## <strong>n</strong>
  2492. &gt;::type
  2493. &gt;(args[ <em>keyword object of required parameter</em> ## <strong>n</strong>])
  2494. );
  2495. }
  2496. template &lt;
  2497. typename ResultType
  2498. , typename Args
  2499. , typename <em>argument name</em> ## <strong>0</strong> ## _type
  2500. , …
  2501. , typename <em>argument name</em> ## <strong>n</strong> ## _type
  2502. &gt;
  2503. ResultType
  2504. boost_param_dispatch_const_0boost_ ## __LINE__ ## <strong>name</strong>(
  2505. (ResultType(*)())
  2506. , Args const&amp; args
  2507. , <em>argument name</em> ## <strong>0</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>0</strong>
  2508. , …
  2509. , <em>argument name</em> ## <strong>n</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>n</strong>
  2510. ) const
  2511. {
  2512. return this-&gt;
  2513. boost_param_dispatch_const_0boost_ ## __LINE__ ## <strong>name</strong>(
  2514. static_cast&lt;ResultType(*)()&gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  2515. , (args, <em>keyword object of optional parameter</em> ## <strong>n + 1</strong> =
  2516. <em>default value of optional parameter</em> ## <strong>n + 1</strong>
  2517. )
  2518. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;<em>argument name</em> ## <strong>0</strong> ## _type&gt;(
  2519. <em>argument name</em> ## <strong>0</strong>
  2520. )
  2521. , …
  2522. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;<em>argument name</em> ## <strong>n</strong> ## _type&gt;(
  2523. <em>argument name</em> ## <strong>n</strong>
  2524. )
  2525. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  2526. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  2527. Args
  2528. , <em>keyword tag type of optional parameter</em> ## <strong>n + 1</strong>
  2529. &gt;::type
  2530. &gt;(<em>default value of optional parameter</em> ## <strong>n + 1</strong>)
  2531. );
  2532. }
  2533. <span class="vellipsis">⋮</span>
  2534. template &lt;
  2535. typename ResultType
  2536. , typename Args
  2537. , typename <em>argument name</em> ## <strong>0</strong> ## _type
  2538. , …
  2539. , typename <em>argument name</em> ## <strong>m</strong> ## _type
  2540. &gt;
  2541. ResultType
  2542. boost_param_dispatch_const_0boost_ ## __LINE__ ## <strong>name</strong>(
  2543. (ResultType(*)())
  2544. , Args const&amp; args
  2545. , <em>argument name</em> ## <strong>0</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>0</strong>
  2546. , …
  2547. , <em>argument name</em> ## <strong>m</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>m</strong>
  2548. ) const
  2549. </pre>
  2550. </div>
  2551. <div class="section" id="boost-parameter-function-call-operator-result-tag-namespace-arguments">
  2552. <span id="boost-parameter-function-call-operator"></span><h2><a class="toc-backref" href="#id60">7.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_FUNCTION_CALL_OPERATOR(result, tag_namespace, arguments)</tt></a></h2>
  2553. <table class="docutils field-list" frame="void" rules="none">
  2554. <col class="field-name" />
  2555. <col class="field-body" />
  2556. <tbody valign="top">
  2557. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td>
  2558. </tr>
  2559. </tbody>
  2560. </table>
  2561. <p>Generates a function call operator that can take in positional arguments,
  2562. composed arguments, named arguments, and deduced arguments.</p>
  2563. <table class="docutils field-list" frame="void" rules="none">
  2564. <col class="field-name" />
  2565. <col class="field-body" />
  2566. <tbody valign="top">
  2567. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  2568. </tr>
  2569. </tbody>
  2570. </table>
  2571. <p>Define the named parameters that will comprise the argument specification that
  2572. this macro will use. Ensure that all their tag types are in the same
  2573. namespace, which is <tt class="docutils literal">tag</tt> by default.</p>
  2574. <pre class="literal-block">
  2575. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(y)
  2576. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(z)
  2577. </pre>
  2578. <p>Use the macro as a substitute for a normal function call operator
  2579. header. Enclose the return type in parentheses. For each parameter, also
  2580. enclose the expected value type in parentheses. Since the value types are
  2581. mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
  2582. clause. This is especially useful when implementing multiple
  2583. Boost.Parameter-enabled function call operator overloads.</p>
  2584. <pre class="literal-block">
  2585. class char_reader
  2586. {
  2587. int index;
  2588. char const* key;
  2589. public:
  2590. explicit char_reader(char const* k) : index(0), key(k)
  2591. {
  2592. }
  2593. BOOST_PARAMETER_FUNCTION_CALL_OPERATOR((void), tag,
  2594. (deduced
  2595. (required
  2596. (y, (int))
  2597. (z, (char const*))
  2598. )
  2599. )
  2600. )
  2601. {
  2602. this-&gt;index = y;
  2603. this-&gt;key = z;
  2604. }
  2605. <a class="reference internal" href="#boost-parameter-const-function-call-operator"><tt class="docutils literal">BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR</tt></a>((char), tag,
  2606. (deduced
  2607. (required
  2608. (y, (bool))
  2609. (z, (<a class="reference external" href="http://en.cppreference.com/w/cpp/container/map">std::map</a>&lt;char const*, <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>&gt;))
  2610. )
  2611. )
  2612. )
  2613. {
  2614. return y ? (
  2615. (z.find(this-&gt;key)-&gt;second)[this-&gt;index]
  2616. ) : this-&gt;key[this-&gt;index];
  2617. }
  2618. };
  2619. </pre>
  2620. <p>As with regular argument-dependent lookup, the value types of the arguments
  2621. passed in determine which function call operator overload gets invoked.</p>
  2622. <pre class="literal-block">
  2623. char const* keys[] = {&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;};
  2624. <a class="reference external" href="http://en.cppreference.com/w/cpp/container/map">std::map</a>&lt;char const*, <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>&gt; k2s;
  2625. k2s[keys[0]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>(&quot;qux&quot;);
  2626. k2s[keys[1]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>(&quot;wmb&quot;);
  2627. k2s[keys[2]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>(&quot;zxc&quot;);
  2628. char_reader r(keys[0]);
  2629. // positional arguments
  2630. BOOST_TEST_EQ('q', (r(true, k2s)));
  2631. BOOST_TEST_EQ('f', (r(false, k2s)));
  2632. // named arguments
  2633. r(_z = keys[1], _y = 1);
  2634. BOOST_TEST_EQ('m', (r(_z = k2s, _y = true)));
  2635. BOOST_TEST_EQ('a', (r(_z = k2s, _y = false)));
  2636. // deduced arguments
  2637. r(keys[2], 2);
  2638. BOOST_TEST_EQ('c', (r(k2s, true)));
  2639. BOOST_TEST_EQ('z', (r(k2s, false)));
  2640. </pre>
  2641. <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> and <a class="reference external" href="../../test/preprocessor_deduced.cpp">preprocessor_deduced.cpp</a> test programs
  2642. demonstrate proper usage of this macro.</p>
  2643. <p><strong>Macro parameters:</strong></p>
  2644. <ul class="simple">
  2645. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function call operator.</li>
  2646. <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
  2647. function call operator resides.</li>
  2648. <li><tt class="docutils literal">arguments</tt> is a <a class="reference external" href="../../../preprocessor/doc/index.html">Boost.Preprocessor</a> <a class="reference external" href="../../../preprocessor/doc/data/sequences.html">sequence</a> of
  2649. <em>argument-specifiers</em>, as defined below.</li>
  2650. </ul>
  2651. <p><strong>Argument specifiers syntax:</strong></p>
  2652. <pre class="literal-block">
  2653. argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
  2654. specifier-group0 ::= <em>specifier-group1</em> |
  2655. (
  2656. '<strong>(</strong>' '<strong>deduced</strong>'
  2657. <em>specifier-group1</em> {<em>specifier-group1</em>}
  2658. '<strong>)</strong>'
  2659. )
  2660. specifier-group1 ::=
  2661. (
  2662. '<strong>(</strong>' '<strong>optional</strong>'
  2663. <em>optional-specifier</em> {<em>optional-specifier</em>}
  2664. '<strong>)</strong>'
  2665. ) | (
  2666. '<strong>(</strong>' '<strong>required</strong>'
  2667. <em>required-specifier</em> {<em>required-specifier</em>}
  2668. '<strong>)</strong>'
  2669. )
  2670. optional-specifier ::=
  2671. '<strong>(</strong>'
  2672. <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> '<strong>,</strong>' <em>default-value</em>
  2673. ')'
  2674. required-specifier ::=
  2675. '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
  2676. restriction ::=
  2677. ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
  2678. ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
  2679. '<strong>*</strong>'
  2680. </pre>
  2681. <ul class="simple">
  2682. <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
  2683. <li><tt class="docutils literal"><span class="pre">default-value</span></tt> is any valid C++ expression; if necessary, user code can
  2684. compute it in terms of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>, where <tt class="docutils literal"><span class="pre">previous-name</span></tt>
  2685. is the <tt class="docutils literal"><span class="pre">argument-name</span></tt> in a previous <tt class="docutils literal"><span class="pre">specifier-group0</span></tt> or
  2686. <tt class="docutils literal"><span class="pre">specifier-group1</span></tt>. <em>This expression will be invoked exactly once.</em></li>
  2687. <li><tt class="docutils literal">mfc</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary Metafunction Class</a> whose first argument will
  2688. be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
  2689. will be the entire <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is a <a class="reference external" href="../../../mpl/doc/refmanual/integral-constant.html">Boolean
  2690. Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
  2691. of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
  2692. <li><tt class="docutils literal"><span class="pre">type-name</span></tt> is either the name of a <strong>target type</strong> or an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary
  2693. Metafunction Class</a> whose first argument will be the type of the
  2694. corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
  2695. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>. If
  2696. <tt class="docutils literal">restriction</tt> uses this form, then the type of the generated name
  2697. <tt class="docutils literal"><span class="pre">argument-name</span> ## _type</tt> will be computed in terms of the <strong>target
  2698. type</strong>, and the generated reference <tt class="docutils literal"><span class="pre">argument-name</span></tt> (but not its
  2699. corresponding entry in <tt class="docutils literal">args</tt>) will be cast to that type.</li>
  2700. </ul>
  2701. <p><strong>Approximate expansion:</strong></p>
  2702. <p>Where:</p>
  2703. <ul class="simple">
  2704. <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  2705. <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  2706. </ul>
  2707. <pre class="literal-block">
  2708. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  2709. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  2710. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  2711. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  2712. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  2713. template &lt;typename Args&gt;
  2714. using boost_param_result_ ## __LINE__ ## operator = <strong>result</strong>;
  2715. // If <strong>result</strong> is a simple return type:
  2716. template &lt;typename Args&gt;
  2717. struct boost_param_result_ ## __LINE__ ## operator
  2718. {
  2719. typedef <strong>result</strong> type;
  2720. };
  2721. struct boost_param_params_ ## __LINE__ ## operator
  2722. : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  2723. <em>list of parameter specifications, based on arguments</em>
  2724. &gt;
  2725. {
  2726. };
  2727. typedef boost_param_params_ ## __LINE__ ## operator
  2728. boost_param_parameters_ ## __LINE__ ## operator;
  2729. template &lt;typename A0, …, typename A ## <strong>n</strong>&gt;
  2730. <strong>result</strong> operator()(
  2731. A0&amp;&amp; a0, …, A ## <strong>n</strong>&amp;&amp; a ## <strong>n</strong>
  2732. , typename boost_param_parameters_ ## __LINE__ ## operator::match&lt;
  2733. A0, …, A ## <strong>n</strong>
  2734. &gt;::type = boost_param_parameters_ ## __LINE__ ## operator()
  2735. )
  2736. {
  2737. return this-&gt;boost_param_impl ## __LINE__ ## operator(
  2738. boost_param_parameters_ ## __LINE__ ## operator()(
  2739. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  2740. , …
  2741. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>n</strong>&gt;(a ## <strong>n</strong>)
  2742. )
  2743. );
  2744. }
  2745. <span class="vellipsis">⋮</span>
  2746. template &lt;typename A0, …, typename A ## <strong>m</strong>&gt;
  2747. <strong>result</strong> operator()(
  2748. A0&amp;&amp; a0, …, A ## <strong>m</strong>&amp;&amp; a ## <strong>m</strong>
  2749. , typename boost_param_parameters_ ## __LINE__ ## operator::match&lt;
  2750. A0, …, A ## <strong>m</strong>
  2751. &gt;::type = boost_param_parameters_ ## __LINE__ ## operator()
  2752. )
  2753. {
  2754. return this-&gt;boost_param_impl ## __LINE__ ## operator(
  2755. boost_param_parameters_ ## __LINE__ ## operator()(
  2756. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  2757. , …
  2758. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>m</strong>&gt;(a ## <strong>m</strong>)
  2759. )
  2760. );
  2761. }
  2762. template &lt;typename Args&gt;
  2763. typename boost_param_result_ ## __LINE__ ## operator&lt;Args&gt;::type
  2764. boost_param_impl ## __LINE__ ## operator(Args const&amp; args)
  2765. {
  2766. return this-&gt;boost_param_dispatch_0boost_ ## __LINE__ ## operator(
  2767. static_cast&lt;
  2768. typename boost_param_result_ ## __LINE__ ## operator&lt;
  2769. Args
  2770. &gt;::type(*)()
  2771. &gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  2772. , args
  2773. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  2774. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  2775. Args
  2776. , <em>keyword tag type of required parameter</em> ## <strong>0</strong>
  2777. &gt;::type
  2778. &gt;(args[ <em>keyword object of required parameter</em> ## <strong>0</strong>])
  2779. , …
  2780. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  2781. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  2782. Args
  2783. , <em>keyword tag type of required parameter</em> ## <strong>n</strong>
  2784. &gt;::type
  2785. &gt;(args[ <em>keyword object of required parameter</em> ## <strong>n</strong>])
  2786. );
  2787. }
  2788. template &lt;
  2789. typename ResultType
  2790. , typename Args
  2791. , typename <em>argument name</em> ## <strong>0</strong> ## _type
  2792. , …
  2793. , typename <em>argument name</em> ## <strong>n</strong> ## _type
  2794. &gt;
  2795. ResultType
  2796. boost_param_dispatch_0boost_ ## __LINE__ ## operator(
  2797. (ResultType(*)())
  2798. , Args const&amp; args
  2799. , <em>argument name</em> ## <strong>0</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>0</strong>
  2800. , …
  2801. , <em>argument name</em> ## <strong>n</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>n</strong>
  2802. )
  2803. {
  2804. return this-&gt;boost_param_dispatch_0boost_ ## __LINE__ ## operator(
  2805. static_cast&lt;ResultType(*)()&gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  2806. , (args, <em>keyword object of optional parameter</em> ## <strong>n + 1</strong> =
  2807. <em>default value of optional parameter</em> ## <strong>n + 1</strong>
  2808. )
  2809. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;<em>argument name</em> ## <strong>0</strong> ## _type&gt;(
  2810. <em>argument name</em> ## <strong>0</strong>
  2811. )
  2812. , …
  2813. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;<em>argument name</em> ## <strong>n</strong> ## _type&gt;(
  2814. <em>argument name</em> ## <strong>n</strong>
  2815. )
  2816. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  2817. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  2818. Args
  2819. , <em>keyword tag type of optional parameter</em> ## <strong>n + 1</strong>
  2820. &gt;::type
  2821. &gt;(<em>default value of optional parameter</em> ## <strong>n + 1</strong>)
  2822. );
  2823. }
  2824. <span class="vellipsis">⋮</span>
  2825. template &lt;
  2826. typename ResultType
  2827. , typename Args
  2828. , typename <em>argument name</em> ## <strong>0</strong> ## _type
  2829. , …
  2830. , typename <em>argument name</em> ## <strong>m</strong> ## _type
  2831. &gt;
  2832. ResultType
  2833. boost_param_dispatch_0boost_ ## __LINE__ ## operator(
  2834. (ResultType(*)())
  2835. , Args const&amp; args
  2836. , <em>argument name</em> ## <strong>0</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>0</strong>
  2837. , …
  2838. , <em>argument name</em> ## <strong>m</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>m</strong>
  2839. )
  2840. </pre>
  2841. </div>
  2842. <div class="section" id="boost-parameter-const-function-call-operator-result-tag-ns-arguments">
  2843. <span id="boost-parameter-const-function-call-operator"></span><h2><a class="toc-backref" href="#id61">7.5&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, arguments)</tt></a></h2>
  2844. <table class="docutils field-list" frame="void" rules="none">
  2845. <col class="field-name" />
  2846. <col class="field-body" />
  2847. <tbody valign="top">
  2848. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td>
  2849. </tr>
  2850. </tbody>
  2851. </table>
  2852. <p>Generates a function call operator that can take in positional arguments,
  2853. composed arguments, named arguments, and deduced arguments.</p>
  2854. <table class="docutils field-list" frame="void" rules="none">
  2855. <col class="field-name" />
  2856. <col class="field-body" />
  2857. <tbody valign="top">
  2858. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  2859. </tr>
  2860. </tbody>
  2861. </table>
  2862. <p>The return type of each of the following function templates falls under a
  2863. different value category.</p>
  2864. <pre class="literal-block">
  2865. template &lt;std::size_t N&gt;
  2866. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; rvalue_bitset()
  2867. {
  2868. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  2869. }
  2870. template &lt;std::size_t N&gt;
  2871. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const rvalue_const_bitset()
  2872. {
  2873. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  2874. }
  2875. template &lt;std::size_t N&gt;
  2876. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp; lvalue_bitset()
  2877. {
  2878. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  2879. return lset;
  2880. }
  2881. template &lt;std::size_t N&gt;
  2882. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp; lvalue_const_bitset()
  2883. {
  2884. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  2885. return clset;
  2886. }
  2887. </pre>
  2888. <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
  2889. to return the correct value category when passed in an object returned by one
  2890. of the functions defined above. Assume that
  2891. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
  2892. <pre class="literal-block">
  2893. enum invoked
  2894. {
  2895. passed_by_lvalue_reference_to_const
  2896. , passed_by_lvalue_reference
  2897. , passed_by_rvalue_reference_to_const
  2898. , passed_by_rvalue_reference
  2899. };
  2900. struct U
  2901. {
  2902. template &lt;std::size_t N&gt;
  2903. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;)
  2904. {
  2905. return passed_by_lvalue_reference_to_const;
  2906. }
  2907. template &lt;std::size_t N&gt;
  2908. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;)
  2909. {
  2910. return passed_by_lvalue_reference;
  2911. }
  2912. template &lt;std::size_t N&gt;
  2913. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;&amp;)
  2914. {
  2915. return passed_by_rvalue_reference_to_const;
  2916. }
  2917. template &lt;std::size_t N&gt;
  2918. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;&amp;)
  2919. {
  2920. return passed_by_rvalue_reference;
  2921. }
  2922. };
  2923. </pre>
  2924. <p>Define the named parameters that will comprise the argument specification that
  2925. this macro will use. Ensure that all their tag types are in the same
  2926. namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
  2927. underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
  2928. same argument to which the corresponding named parameter (without underscores)
  2929. is bound, as will be shown later.</p>
  2930. <pre class="literal-block">
  2931. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
  2932. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
  2933. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
  2934. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
  2935. </pre>
  2936. <p>Use the macro as a substitute for a normal <tt class="docutils literal">const</tt> function call operator
  2937. header. Enclose the return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter,
  2938. also enclose the expected value type in parentheses. Since the value types
  2939. are mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
  2940. clause. Otherwise, just as with a normal function, the order in which you
  2941. specify the parameters determines their position. Also, just as with a normal
  2942. function, optional parameters have default values, whereas required parameters
  2943. do not. Within the function body, either simply use the parameter name or
  2944. pass the matching identifier with the leading underscore to the bracket
  2945. operator of <tt class="docutils literal">args</tt> to extract the corresponding argument. Note that the
  2946. second method doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to preserve value categories.</p>
  2947. <pre class="literal-block">
  2948. struct B
  2949. {
  2950. B()
  2951. {
  2952. }
  2953. BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR((bool), kw,
  2954. (deduced
  2955. (required
  2956. (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;1&gt;))
  2957. (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;2&gt;))
  2958. )
  2959. (optional
  2960. (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;3&gt;), rvalue_const_bitset&lt;2&gt;())
  2961. (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;4&gt;), rvalue_bitset&lt;3&gt;())
  2962. )
  2963. )
  2964. )
  2965. {
  2966. BOOST_TEST_EQ(
  2967. passed_by_lvalue_reference_to_const
  2968. , U::evaluate_category&lt;0&gt;(lrc)
  2969. );
  2970. BOOST_TEST_EQ(
  2971. passed_by_lvalue_reference
  2972. , U::evaluate_category&lt;1&gt;(lr)
  2973. );
  2974. BOOST_TEST_EQ(
  2975. passed_by_rvalue_reference_to_const
  2976. , U::evaluate_category&lt;2&gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;rrc0_type&gt;(rrc0))
  2977. );
  2978. BOOST_TEST_EQ(
  2979. passed_by_rvalue_reference
  2980. , U::evaluate_category&lt;3&gt;(args[_rr0])
  2981. );
  2982. return true;
  2983. }
  2984. };
  2985. </pre>
  2986. <p>The following function calls are legal.</p>
  2987. <pre class="literal-block">
  2988. B const b = B();
  2989. b( // positional arguments
  2990. lvalue_const_bitset&lt;0&gt;()
  2991. , lvalue_bitset&lt;1&gt;()
  2992. , rvalue_const_bitset&lt;2&gt;()
  2993. , rvalue_bitset&lt;3&gt;()
  2994. );
  2995. b( // positional arguments
  2996. lvalue_const_bitset&lt;0&gt;()
  2997. , lvalue_bitset&lt;1&gt;()
  2998. );
  2999. b(( // composed arguments
  3000. _rr0 = rvalue_bitset&lt;3&gt;()
  3001. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  3002. , _lr0 = lvalue_bitset&lt;1&gt;()
  3003. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  3004. ));
  3005. b( // named arguments
  3006. _rr0 = rvalue_bitset&lt;3&gt;()
  3007. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  3008. , _lr0 = lvalue_bitset&lt;1&gt;()
  3009. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  3010. );
  3011. b( // named arguments
  3012. _lr0 = lvalue_bitset&lt;1&gt;()
  3013. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  3014. );
  3015. </pre>
  3016. <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
  3017. function calls are also legal.</p>
  3018. <pre class="literal-block">
  3019. b( // deduced arguments
  3020. rvalue_bitset&lt;3&gt;()
  3021. , lvalue_const_bitset&lt;0&gt;()
  3022. , lvalue_bitset&lt;1&gt;()
  3023. , rvalue_const_bitset&lt;2&gt;()
  3024. );
  3025. b( // deduced arguments
  3026. lvalue_bitset&lt;1&gt;()
  3027. , lvalue_const_bitset&lt;0&gt;()
  3028. );
  3029. </pre>
  3030. <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a>, <a class="reference external" href="../../test/preprocessor_deduced.cpp">preprocessor_deduced.cpp</a>, and
  3031. <a class="reference external" href="../../test/preprocessor_eval_cat_8.cpp">preprocessor_eval_cat_8.cpp</a> test programs demonstrate proper usage of this
  3032. macro.</p>
  3033. <p><strong>Macro parameters:</strong></p>
  3034. <ul class="simple">
  3035. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function call operator.</li>
  3036. <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
  3037. function call operator resides.</li>
  3038. <li><tt class="docutils literal">arguments</tt> is a <a class="reference external" href="../../../preprocessor/doc/index.html">Boost.Preprocessor</a> <a class="reference external" href="../../../preprocessor/doc/data/sequences.html">sequence</a> of
  3039. <em>argument-specifiers</em>, as defined below.</li>
  3040. </ul>
  3041. <p><strong>Argument specifiers syntax:</strong></p>
  3042. <pre class="literal-block">
  3043. argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
  3044. specifier-group0 ::= <em>specifier-group1</em> |
  3045. (
  3046. '<strong>(</strong>' '<strong>deduced</strong>'
  3047. <em>specifier-group1</em> {<em>specifier-group1</em>}
  3048. '<strong>)</strong>'
  3049. )
  3050. specifier-group1 ::=
  3051. (
  3052. '<strong>(</strong>' '<strong>optional</strong>'
  3053. <em>optional-specifier</em> {<em>optional-specifier</em>}
  3054. '<strong>)</strong>'
  3055. ) | (
  3056. '<strong>(</strong>' '<strong>required</strong>'
  3057. <em>required-specifier</em> {<em>required-specifier</em>}
  3058. '<strong>)</strong>'
  3059. )
  3060. optional-specifier ::=
  3061. '<strong>(</strong>'
  3062. <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> '<strong>,</strong>' <em>default-value</em>
  3063. ')'
  3064. required-specifier ::=
  3065. '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
  3066. restriction ::=
  3067. ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
  3068. ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
  3069. '<strong>*</strong>'
  3070. </pre>
  3071. <ul class="simple">
  3072. <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
  3073. <li><tt class="docutils literal"><span class="pre">default-value</span></tt> is any valid C++ expression; if necessary, user code can
  3074. compute it in terms of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>, where <tt class="docutils literal"><span class="pre">previous-name</span></tt>
  3075. is the <tt class="docutils literal"><span class="pre">argument-name</span></tt> in a previous <tt class="docutils literal"><span class="pre">specifier-group0</span></tt> or
  3076. <tt class="docutils literal"><span class="pre">specifier-group1</span></tt>. <em>This expression will be invoked exactly once.</em></li>
  3077. <li><tt class="docutils literal">mfc</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary Metafunction Class</a> whose first argument will
  3078. be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
  3079. will be the entire <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is a <a class="reference external" href="../../../mpl/doc/refmanual/integral-constant.html">Boolean
  3080. Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
  3081. of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
  3082. <li><tt class="docutils literal"><span class="pre">type-name</span></tt> is either the name of a <strong>target type</strong> or an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary
  3083. Metafunction Class</a> whose first argument will be the type of the
  3084. corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
  3085. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>. If
  3086. <tt class="docutils literal">restriction</tt> uses this form, then the type of the generated name
  3087. <tt class="docutils literal"><span class="pre">argument-name</span> ## _type</tt> will be computed in terms of the <strong>target
  3088. type</strong>, and the generated reference <tt class="docutils literal"><span class="pre">argument-name</span></tt> (but not its
  3089. corresponding entry in <tt class="docutils literal">args</tt>) will be cast to that type.</li>
  3090. </ul>
  3091. <p><strong>Approximate expansion:</strong></p>
  3092. <p>Where:</p>
  3093. <ul class="simple">
  3094. <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  3095. <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  3096. </ul>
  3097. <pre class="literal-block">
  3098. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  3099. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  3100. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  3101. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  3102. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  3103. template &lt;typename Args&gt;
  3104. using boost_param_result_const_ ## __LINE__ ## operator = <strong>result</strong>;
  3105. // If <strong>result</strong> is a simple return type:
  3106. template &lt;typename Args&gt;
  3107. struct boost_param_result_const_ ## __LINE__ ## operator
  3108. {
  3109. typedef <strong>result</strong> type;
  3110. };
  3111. struct boost_param_params_const_ ## __LINE__ ## operator
  3112. : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  3113. <em>list of parameter specifications, based on arguments</em>
  3114. &gt;
  3115. {
  3116. };
  3117. typedef boost_param_params_const_ ## __LINE__ ## operator
  3118. boost_param_parameters_const_ ## __LINE__ ## operator;
  3119. template &lt;typename A0, …, typename A ## <strong>n</strong>&gt;
  3120. <strong>result</strong> operator()(
  3121. A0&amp;&amp; a0, …, A ## <strong>n</strong>&amp;&amp; a ## <strong>n</strong>
  3122. , typename boost_param_parameters_const_ ## __LINE__ ## operator
  3123. ::match&lt;A0, …, A ## <strong>n</strong>&gt;::type
  3124. = boost_param_parameters_const_ ## __LINE__ ## operator()
  3125. ) const
  3126. {
  3127. return this-&gt;boost_param_impl_const ## __LINE__ ## operator(
  3128. boost_param_parameters_const_ ## __LINE__ ## operator()(
  3129. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  3130. , …
  3131. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>n</strong>&gt;(a ## <strong>n</strong>)
  3132. )
  3133. );
  3134. }
  3135. <span class="vellipsis">⋮</span>
  3136. template &lt;typename A0, …, typename A ## <strong>m</strong>&gt;
  3137. <strong>result</strong> operator()(
  3138. A0&amp;&amp; a0, …, A ## <strong>m</strong>&amp;&amp; a ## <strong>m</strong>
  3139. , typename boost_param_parameters_const_ ## __LINE__ ## operator
  3140. ::match&lt;A0, …, A ## <strong>m</strong>&gt;::type
  3141. = boost_param_parameters_const_ ## __LINE__ ## operator()
  3142. ) const
  3143. {
  3144. return this-&gt;boost_param_impl_const ## __LINE__ ## operator(
  3145. boost_param_parameters_const_ ## __LINE__ ## operator()(
  3146. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  3147. , …
  3148. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>m</strong>&gt;(a ## <strong>m</strong>)
  3149. )
  3150. );
  3151. }
  3152. template &lt;typename Args&gt;
  3153. typename boost_param_result_const_ ## __LINE__ ## operator&lt;Args&gt;::type
  3154. boost_param_impl_const ## __LINE__ ## operator(Args const&amp; args) const
  3155. {
  3156. return this-&gt;
  3157. boost_param_dispatch_const_0boost_ ## __LINE__ ## operator(
  3158. static_cast&lt;
  3159. typename boost_param_result_const_ ## __LINE__ ## operator&lt;
  3160. Args
  3161. &gt;::type(*)()
  3162. &gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  3163. , args
  3164. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  3165. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  3166. Args
  3167. , <em>keyword tag type of required parameter</em> ## <strong>0</strong>
  3168. &gt;::type
  3169. &gt;(args[ <em>keyword object of required parameter</em> ## <strong>0</strong>])
  3170. , …
  3171. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  3172. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  3173. Args
  3174. , <em>keyword tag type of required parameter</em> ## <strong>n</strong>
  3175. &gt;::type
  3176. &gt;(args[ <em>keyword object of required parameter</em> ## <strong>n</strong>])
  3177. );
  3178. }
  3179. template &lt;
  3180. typename ResultType
  3181. , typename Args
  3182. , typename <em>argument name</em> ## <strong>0</strong> ## _type
  3183. , …
  3184. , typename <em>argument name</em> ## <strong>n</strong> ## _type
  3185. &gt;
  3186. ResultType
  3187. boost_param_dispatch_const_0boost_ ## __LINE__ ## operator(
  3188. (ResultType(*)())
  3189. , Args const&amp; args
  3190. , <em>argument name</em> ## <strong>0</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>0</strong>
  3191. , …
  3192. , <em>argument name</em> ## <strong>n</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>n</strong>
  3193. ) const
  3194. {
  3195. return this-&gt;
  3196. boost_param_dispatch_const_0boost_ ## __LINE__ ## operator(
  3197. static_cast&lt;ResultType(*)()&gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  3198. , (args, <em>keyword object of optional parameter</em> ## <strong>n + 1</strong> =
  3199. <em>default value of optional parameter</em> ## <strong>n + 1</strong>
  3200. )
  3201. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;<em>argument name</em> ## <strong>0</strong> ## _type&gt;(
  3202. <em>argument name</em> ## <strong>0</strong>
  3203. )
  3204. , …
  3205. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;<em>argument name</em> ## <strong>n</strong> ## _type&gt;(
  3206. <em>argument name</em> ## <strong>n</strong>
  3207. )
  3208. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;
  3209. typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;
  3210. Args
  3211. , <em>keyword tag type of optional parameter</em> ## <strong>n + 1</strong>
  3212. &gt;::type
  3213. &gt;(<em>default value of optional parameter</em> ## <strong>n + 1</strong>)
  3214. );
  3215. }
  3216. <span class="vellipsis">⋮</span>
  3217. template &lt;
  3218. typename ResultType
  3219. , typename Args
  3220. , typename <em>argument name</em> ## <strong>0</strong> ## _type
  3221. , …
  3222. , typename <em>argument name</em> ## <strong>m</strong> ## _type
  3223. &gt;
  3224. ResultType
  3225. boost_param_dispatch_const_0boost_ ## __LINE__ ## operator(
  3226. (ResultType(*)())
  3227. , Args const&amp; args
  3228. , <em>argument name</em> ## <strong>0</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>0</strong>
  3229. , …
  3230. , <em>argument name</em> ## <strong>m</strong> ## _type&amp;&amp; <em>argument name</em> ## <strong>m</strong>
  3231. ) const
  3232. </pre>
  3233. </div>
  3234. <div class="section" id="boost-parameter-constructor-cls-impl-tag-namespace-arguments">
  3235. <span id="boost-parameter-constructor"></span><h2><a class="toc-backref" href="#id62">7.6&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_CONSTRUCTOR(cls, impl, tag_namespace, arguments)</tt></a></h2>
  3236. <table class="docutils field-list" frame="void" rules="none">
  3237. <col class="field-name" />
  3238. <col class="field-body" />
  3239. <tbody valign="top">
  3240. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td>
  3241. </tr>
  3242. </tbody>
  3243. </table>
  3244. <p>Generates a constructor that can take in positional arguments, composed
  3245. arguments, named arguments, and deduced arguments.</p>
  3246. <table class="docutils field-list" frame="void" rules="none">
  3247. <col class="field-name" />
  3248. <col class="field-body" />
  3249. <tbody valign="top">
  3250. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  3251. </tr>
  3252. </tbody>
  3253. </table>
  3254. <p>Define the named parameters that will comprise the argument specification that
  3255. this macro will use. Ensure that all their tag types are in the same
  3256. namespace, which is <tt class="docutils literal">tag</tt> by default.</p>
  3257. <pre class="literal-block">
  3258. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(y)
  3259. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(z)
  3260. </pre>
  3261. <p>In the base class, implement a delegate constructor template that takes in an
  3262. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>. You must pass the identifiers with leading underscores to
  3263. <tt class="docutils literal">args</tt> in order to extract the corresponding arguments.</p>
  3264. <pre class="literal-block">
  3265. class char_read_base
  3266. {
  3267. int index;
  3268. char const* key;
  3269. public:
  3270. template &lt;typename Args&gt;
  3271. explicit char_read_base(Args const&amp; args)
  3272. : index(args[_y]), key(args[_z])
  3273. {
  3274. }
  3275. <a class="reference internal" href="#boost-parameter-const-function-call-operator"><tt class="docutils literal">BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR</tt></a>((char), tag,
  3276. (deduced
  3277. (required
  3278. (y, (bool))
  3279. (z, (<a class="reference external" href="http://en.cppreference.com/w/cpp/container/map">std::map</a>&lt;char const*, <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>&gt;))
  3280. )
  3281. )
  3282. )
  3283. {
  3284. return y ? (
  3285. (z.find(this-&gt;key)-&gt;second)[this-&gt;index]
  3286. ) : this-&gt;key[this-&gt;index];
  3287. }
  3288. };
  3289. </pre>
  3290. <p>Use the macro as a substitute for a normal constructor definition. Note the
  3291. lack of an explicit body. Enclose the base type in parentheses. For each
  3292. parameter, also enclose the expected value type in parentheses. Since the
  3293. value types are mutually exclusive, you can wrap the parameters in a
  3294. <tt class="docutils literal">(deduced …)</tt> clause.</p>
  3295. <pre class="literal-block">
  3296. struct char_reader : public char_read_base
  3297. {
  3298. BOOST_PARAMETER_CONSTRUCTOR(char_reader, (char_read_base), tag,
  3299. (deduced
  3300. (required
  3301. (y, (int))
  3302. (z, (char const*))
  3303. )
  3304. )
  3305. )
  3306. };
  3307. </pre>
  3308. <p>The following <tt class="docutils literal">char_reader</tt> constructor calls are legal.</p>
  3309. <pre class="literal-block">
  3310. char const* keys[] = {&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;};
  3311. <a class="reference external" href="http://en.cppreference.com/w/cpp/container/map">std::map</a>&lt;char const*, <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>&gt; k2s;
  3312. k2s[keys[0]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>(&quot;qux&quot;);
  3313. k2s[keys[1]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>(&quot;wmb&quot;);
  3314. k2s[keys[2]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>(&quot;zxc&quot;);
  3315. // positional arguments
  3316. char_reader r0(0, keys[0]);
  3317. BOOST_TEST_EQ('q', (r0(true, k2s)));
  3318. BOOST_TEST_EQ('f', (r0(false, k2s)));
  3319. // named arguments
  3320. char_reader r1(_z = keys[1], _y = 1);
  3321. BOOST_TEST_EQ('m', (r1(_z = k2s, _y = true)));
  3322. BOOST_TEST_EQ('a', (r1(_z = k2s, _y = false)));
  3323. // deduced arguments
  3324. char_reader r2(keys[2], 2);
  3325. BOOST_TEST_EQ('c', (r2(k2s, true)));
  3326. BOOST_TEST_EQ('z', (r2(k2s, false)));
  3327. </pre>
  3328. <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> and <a class="reference external" href="../../test/preprocessor_deduced.cpp">preprocessor_deduced.cpp</a> test programs
  3329. demonstrate proper usage of this macro.</p>
  3330. <p><strong>Macro parameters:</strong></p>
  3331. <ul class="simple">
  3332. <li><tt class="docutils literal">cls</tt> is the name of the enclosing class.</li>
  3333. <li><tt class="docutils literal">impl</tt> is the parenthesized implementation base class for <tt class="docutils literal">cls</tt>.</li>
  3334. <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
  3335. constructor resides.</li>
  3336. <li><tt class="docutils literal">arguments</tt> is a list of <em>argument-specifiers</em>, as defined below.</li>
  3337. </ul>
  3338. <p><strong>Argument specifiers syntax:</strong></p>
  3339. <pre class="literal-block">
  3340. argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
  3341. specifier-group0 ::= <em>specifier-group1</em> |
  3342. (
  3343. '<strong>(</strong>' '<strong>deduced</strong>'
  3344. <em>specifier-group1</em> {<em>specifier-group1</em>}
  3345. '<strong>)</strong>'
  3346. )
  3347. specifier-group1 ::=
  3348. (
  3349. '<strong>(</strong>' '<strong>optional</strong>'
  3350. <em>specifier</em> {<em>specifier</em>}
  3351. '<strong>)</strong>'
  3352. ) | (
  3353. '<strong>(</strong>' '<strong>required</strong>'
  3354. <em>specifier</em> {<em>specifier</em>}
  3355. '<strong>)</strong>'
  3356. )
  3357. specifier ::=
  3358. '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
  3359. restriction ::=
  3360. ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
  3361. ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
  3362. '<strong>*</strong>'
  3363. </pre>
  3364. <ul class="simple">
  3365. <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
  3366. <li><tt class="docutils literal">mfc</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary Metafunction Class</a> whose first argument will
  3367. be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
  3368. will be the entire <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is a <a class="reference external" href="../../../mpl/doc/refmanual/integral-constant.html">Boolean
  3369. Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
  3370. of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
  3371. <li><tt class="docutils literal"><span class="pre">type-name</span></tt> is either the name of a <strong>target type</strong> or an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary
  3372. Metafunction Class</a> whose first argument will be the type of the
  3373. corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
  3374. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>.</li>
  3375. </ul>
  3376. <p>Note that <em>specifier</em> does not include <em>default-value</em>. It is up to the
  3377. delegate constructor in <tt class="docutils literal">impl</tt> to determine the default value of all
  3378. optional arguments.</p>
  3379. <p><strong>Approximate expansion:</strong></p>
  3380. <p>Where:</p>
  3381. <ul class="simple">
  3382. <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  3383. <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  3384. </ul>
  3385. <pre class="literal-block">
  3386. struct boost_param_params_ ## __LINE__ ## ctor
  3387. : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  3388. <em>list of parameter specifications, based on arguments</em>
  3389. &gt;
  3390. {
  3391. };
  3392. typedef boost_param_params_ ## __LINE__ ## ctor
  3393. constructor_parameters ## __LINE__;
  3394. template &lt;typename A0, …, typename A ## <strong>n</strong>&gt;
  3395. <strong>cls</strong>(A0&amp;&amp; a0, …, A ## <strong>n</strong> &amp;&amp; a ## <strong>n</strong>)
  3396. : <strong>impl</strong>(
  3397. constructor_parameters ## __LINE__(
  3398. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  3399. , …
  3400. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>n</strong>&gt;(a ## <strong>n</strong>)
  3401. )
  3402. )
  3403. {
  3404. }
  3405. <span class="vellipsis">⋮</span>
  3406. template &lt;typename A0, …, typename A ## <strong>m</strong>&gt;
  3407. <strong>cls</strong>(A0&amp;&amp; a0, …, A ## <strong>m</strong> &amp;&amp; a ## <strong>m</strong>)
  3408. : <strong>impl</strong>(
  3409. constructor_parameters ## __LINE__(
  3410. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  3411. , …
  3412. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>m</strong>&gt;(a ## <strong>m</strong>)
  3413. )
  3414. )
  3415. {
  3416. }
  3417. </pre>
  3418. </div>
  3419. <div class="section" id="boost-parameter-basic-function-result-name-tag-namespace-arguments">
  3420. <span id="boost-parameter-basic-function"></span><h2><a class="toc-backref" href="#id63">7.7&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_BASIC_FUNCTION(result, name, tag_namespace, arguments)</tt></a></h2>
  3421. <table class="docutils field-list" frame="void" rules="none">
  3422. <col class="field-name" />
  3423. <col class="field-body" />
  3424. <tbody valign="top">
  3425. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td>
  3426. </tr>
  3427. </tbody>
  3428. </table>
  3429. <p>Generates a function that can take in positional arguments, composed
  3430. arguments, named arguments, and deduced arguments.</p>
  3431. <table class="docutils field-list" frame="void" rules="none">
  3432. <col class="field-name" />
  3433. <col class="field-body" />
  3434. <tbody valign="top">
  3435. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  3436. </tr>
  3437. </tbody>
  3438. </table>
  3439. <p>The return type of each of the following function templates falls under a
  3440. different value category.</p>
  3441. <pre class="literal-block">
  3442. template &lt;std::size_t N&gt;
  3443. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; rvalue_bitset()
  3444. {
  3445. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  3446. }
  3447. template &lt;std::size_t N&gt;
  3448. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const rvalue_const_bitset()
  3449. {
  3450. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  3451. }
  3452. template &lt;std::size_t N&gt;
  3453. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp; lvalue_bitset()
  3454. {
  3455. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  3456. return lset;
  3457. }
  3458. template &lt;std::size_t N&gt;
  3459. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp; lvalue_const_bitset()
  3460. {
  3461. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  3462. return clset;
  3463. }
  3464. </pre>
  3465. <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
  3466. to return the correct value category when passed in an object returned by one
  3467. of the functions defined above. Assume that
  3468. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
  3469. <pre class="literal-block">
  3470. enum invoked
  3471. {
  3472. passed_by_lvalue_reference_to_const
  3473. , passed_by_lvalue_reference
  3474. , passed_by_rvalue_reference_to_const
  3475. , passed_by_rvalue_reference
  3476. };
  3477. struct U
  3478. {
  3479. template &lt;std::size_t N&gt;
  3480. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;)
  3481. {
  3482. return passed_by_lvalue_reference_to_const;
  3483. }
  3484. template &lt;std::size_t N&gt;
  3485. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;)
  3486. {
  3487. return passed_by_lvalue_reference;
  3488. }
  3489. template &lt;std::size_t N&gt;
  3490. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;&amp;)
  3491. {
  3492. return passed_by_rvalue_reference_to_const;
  3493. }
  3494. template &lt;std::size_t N&gt;
  3495. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;&amp;)
  3496. {
  3497. return passed_by_rvalue_reference;
  3498. }
  3499. };
  3500. </pre>
  3501. <p>Define the named parameters that will comprise the argument specification that
  3502. this macro will use. Ensure that all their tag types are in the same
  3503. namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
  3504. underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
  3505. same argument to which the corresponding named parameter (without underscores)
  3506. is bound, as will be shown later.</p>
  3507. <pre class="literal-block">
  3508. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
  3509. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
  3510. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
  3511. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
  3512. </pre>
  3513. <p>Use the macro as a substitute for a normal function header. Enclose the
  3514. return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter, also enclose the
  3515. expected value type in parentheses. Since the value types are mutually
  3516. exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
  3517. clause. Otherwise, just as with a normal function, the order in which you
  3518. specify the parameters determines their position. However, unlike a normal
  3519. function, default values must be specified within the function body. Also
  3520. within the function body, you must pass the matching identifier with the
  3521. leading underscore to the bracket operator of <tt class="docutils literal">args</tt> to extract the
  3522. corresponding argument, but at least this doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to
  3523. preserve value categories.</p>
  3524. <pre class="literal-block">
  3525. BOOST_PARAMETER_BASIC_FUNCTION((bool), evaluate, kw,
  3526. (deduced
  3527. (required
  3528. (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;1&gt;))
  3529. (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;2&gt;))
  3530. )
  3531. (optional
  3532. (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;3&gt;))
  3533. (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;4&gt;))
  3534. )
  3535. )
  3536. )
  3537. {
  3538. BOOST_TEST_EQ(
  3539. passed_by_lvalue_reference_to_const
  3540. , U::evaluate_category&lt;0&gt;(args[_lrc])
  3541. );
  3542. BOOST_TEST_EQ(
  3543. passed_by_lvalue_reference
  3544. , U::evaluate_category&lt;1&gt;(args[_lr])
  3545. );
  3546. BOOST_TEST_EQ(
  3547. passed_by_rvalue_reference_to_const
  3548. , U::evaluate_category&lt;2&gt;(
  3549. args[_rrc0 | rvalue_const_bitset&lt;2&gt;()]
  3550. )
  3551. );
  3552. BOOST_TEST_EQ(
  3553. passed_by_rvalue_reference
  3554. , U::evaluate_category&lt;3&gt;(args[_rr0 | rvalue_bitset&lt;3&gt;()])
  3555. );
  3556. return true;
  3557. }
  3558. </pre>
  3559. <p>The following function calls are legal.</p>
  3560. <pre class="literal-block">
  3561. evaluate( // positional arguments
  3562. lvalue_const_bitset&lt;0&gt;()
  3563. , lvalue_bitset&lt;1&gt;()
  3564. , rvalue_const_bitset&lt;2&gt;()
  3565. , rvalue_bitset&lt;3&gt;()
  3566. );
  3567. evaluate( // positional arguments
  3568. lvalue_const_bitset&lt;0&gt;()
  3569. , lvalue_bitset&lt;1&gt;()
  3570. );
  3571. evaluate(( // composed arguments
  3572. _rr0 = rvalue_bitset&lt;3&gt;()
  3573. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  3574. , _lr0 = lvalue_bitset&lt;1&gt;()
  3575. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  3576. ));
  3577. evaluate( // named arguments
  3578. _rr0 = rvalue_bitset&lt;3&gt;()
  3579. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  3580. , _lr0 = lvalue_bitset&lt;1&gt;()
  3581. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  3582. );
  3583. evaluate( // named arguments
  3584. _lr0 = lvalue_bitset&lt;1&gt;()
  3585. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  3586. );
  3587. </pre>
  3588. <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
  3589. function calls are also legal.</p>
  3590. <pre class="literal-block">
  3591. evaluate( // deduced arguments
  3592. rvalue_bitset&lt;3&gt;()
  3593. , lvalue_const_bitset&lt;0&gt;()
  3594. , lvalue_bitset&lt;1&gt;()
  3595. , rvalue_const_bitset&lt;2&gt;()
  3596. );
  3597. evaluate( // deduced arguments
  3598. lvalue_bitset&lt;1&gt;()
  3599. , lvalue_const_bitset&lt;0&gt;()
  3600. );
  3601. </pre>
  3602. <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> test program demonstrates proper usage of this macro.</p>
  3603. <p><strong>Macro parameters:</strong></p>
  3604. <ul class="simple">
  3605. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
  3606. <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
  3607. generated forwarding functions.</li>
  3608. <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
  3609. function resides.</li>
  3610. <li><tt class="docutils literal">arguments</tt> is a <a class="reference external" href="../../../preprocessor/doc/index.html">Boost.Preprocessor</a> <a class="reference external" href="../../../preprocessor/doc/data/sequences.html">sequence</a> of
  3611. <em>argument-specifiers</em>, as defined below.</li>
  3612. </ul>
  3613. <p><strong>Argument specifiers syntax:</strong></p>
  3614. <pre class="literal-block">
  3615. argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
  3616. specifier-group0 ::= <em>specifier-group1</em> |
  3617. (
  3618. '<strong>(</strong>' '<strong>deduced</strong>'
  3619. <em>specifier-group1</em> {<em>specifier-group1</em>}
  3620. '<strong>)</strong>'
  3621. )
  3622. specifier-group1 ::=
  3623. (
  3624. '<strong>(</strong>' '<strong>optional</strong>'
  3625. <em>specifier</em> {<em>specifier</em>}
  3626. '<strong>)</strong>'
  3627. ) | (
  3628. '<strong>(</strong>' '<strong>required</strong>'
  3629. <em>specifier</em> {<em>specifier</em>}
  3630. '<strong>)</strong>'
  3631. )
  3632. specifier ::=
  3633. '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
  3634. restriction ::=
  3635. ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
  3636. ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
  3637. '<strong>*</strong>'
  3638. </pre>
  3639. <ul class="simple">
  3640. <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
  3641. <li><tt class="docutils literal">mfc</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary Metafunction Class</a> whose first argument will
  3642. be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
  3643. will be the entire <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is a <a class="reference external" href="../../../mpl/doc/refmanual/integral-constant.html">Boolean
  3644. Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
  3645. of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
  3646. <li><tt class="docutils literal"><span class="pre">type-name</span></tt> is either the name of a <strong>target type</strong> or an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary
  3647. Metafunction Class</a> whose first argument will be the type of the
  3648. corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
  3649. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>.</li>
  3650. </ul>
  3651. <p>Note that <em>specifier</em> does not include <em>default-value</em>. It is up to the
  3652. function body to determine the default value of all optional arguments.</p>
  3653. <p><strong>Approximate expansion:</strong></p>
  3654. <p>Where:</p>
  3655. <ul class="simple">
  3656. <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  3657. <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  3658. </ul>
  3659. <pre class="literal-block">
  3660. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  3661. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  3662. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  3663. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  3664. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  3665. template &lt;typename Args&gt;
  3666. using boost_param_result_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
  3667. // If <strong>result</strong> is a simple return type:
  3668. template &lt;typename Args&gt;
  3669. struct boost_param_result_ ## __LINE__ ## <strong>name</strong>
  3670. {
  3671. typedef <strong>result</strong> type;
  3672. };
  3673. struct boost_param_params_ ## __LINE__ ## <strong>name</strong>
  3674. : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  3675. <em>list of parameter specifications, based on arguments</em>
  3676. &gt;
  3677. {
  3678. };
  3679. typedef boost_param_params_ ## __LINE__ ## <strong>name</strong>
  3680. boost_param_parameters_ ## __LINE__ ## <strong>name</strong>;
  3681. template &lt;typename Args&gt;
  3682. typename boost_param_result_ ## __LINE__ ## <strong>name</strong>&lt;Args&gt;::type
  3683. boost_param_impl ## <strong>name</strong>(Args const&amp;);
  3684. template &lt;typename A0, …, typename A ## <strong>n</strong>&gt;
  3685. <strong>result</strong> <strong>name</strong>(
  3686. A0&amp;&amp; a0, …, A ## <strong>n</strong>&amp;&amp; a ## <strong>n</strong>
  3687. , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
  3688. ::match&lt;A0, …, A ## <strong>n</strong>&gt;::type
  3689. = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
  3690. )
  3691. {
  3692. return boost_param_impl ## __LINE__ ## <strong>name</strong>(
  3693. boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
  3694. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  3695. , …
  3696. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>n</strong>&gt;(a ## <strong>n</strong>)
  3697. )
  3698. );
  3699. }
  3700. <span class="vellipsis">⋮</span>
  3701. template &lt;typename A0, …, typename A ## <strong>m</strong>&gt;
  3702. <strong>result</strong> <strong>name</strong>(
  3703. A0&amp;&amp; a0, …, A ## <strong>m</strong>&amp;&amp; a ## <strong>m</strong>
  3704. , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
  3705. ::match&lt;A0, …, A ## <strong>m</strong>&gt;::type
  3706. = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
  3707. )
  3708. {
  3709. return boost_param_impl ## __LINE__ ## <strong>name</strong>(
  3710. boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
  3711. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  3712. , …
  3713. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>m</strong>&gt;(a ## <strong>m</strong>)
  3714. )
  3715. );
  3716. }
  3717. template &lt;typename Args&gt;
  3718. typename boost_param_result_ ## __LINE__ ## <strong>name</strong>&lt;Args&gt;::type
  3719. boost_param_impl ## __LINE__ ## <strong>name</strong>(Args const&amp; args)
  3720. </pre>
  3721. <p>Only the <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> type <tt class="docutils literal">Args</tt> and its object instance <tt class="docutils literal">args</tt> are
  3722. available for use within the function body.</p>
  3723. </div>
  3724. <div class="section" id="boost-parameter-basic-member-function-result-name-tag-ns-arguments">
  3725. <span id="boost-parameter-basic-member-function"></span><h2><a class="toc-backref" href="#id64">7.8&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_BASIC_MEMBER_FUNCTION(result, name, tag_ns, arguments)</tt></a></h2>
  3726. <table class="docutils field-list" frame="void" rules="none">
  3727. <col class="field-name" />
  3728. <col class="field-body" />
  3729. <tbody valign="top">
  3730. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td>
  3731. </tr>
  3732. </tbody>
  3733. </table>
  3734. <p>Generates a member function that can take in positional arguments, composed
  3735. arguments, named arguments, and deduced arguments.</p>
  3736. <table class="docutils field-list" frame="void" rules="none">
  3737. <col class="field-name" />
  3738. <col class="field-body" />
  3739. <tbody valign="top">
  3740. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  3741. </tr>
  3742. </tbody>
  3743. </table>
  3744. <p>The return type of each of the following function templates falls under a
  3745. different value category.</p>
  3746. <pre class="literal-block">
  3747. template &lt;std::size_t N&gt;
  3748. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; rvalue_bitset()
  3749. {
  3750. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  3751. }
  3752. template &lt;std::size_t N&gt;
  3753. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const rvalue_const_bitset()
  3754. {
  3755. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  3756. }
  3757. template &lt;std::size_t N&gt;
  3758. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp; lvalue_bitset()
  3759. {
  3760. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  3761. return lset;
  3762. }
  3763. template &lt;std::size_t N&gt;
  3764. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp; lvalue_const_bitset()
  3765. {
  3766. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  3767. return clset;
  3768. }
  3769. </pre>
  3770. <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
  3771. to return the correct value category when passed in an object returned by one
  3772. of the functions defined above. Assume that
  3773. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
  3774. <pre class="literal-block">
  3775. enum invoked
  3776. {
  3777. passed_by_lvalue_reference_to_const
  3778. , passed_by_lvalue_reference
  3779. , passed_by_rvalue_reference_to_const
  3780. , passed_by_rvalue_reference
  3781. };
  3782. struct U
  3783. {
  3784. template &lt;std::size_t N&gt;
  3785. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;)
  3786. {
  3787. return passed_by_lvalue_reference_to_const;
  3788. }
  3789. template &lt;std::size_t N&gt;
  3790. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;)
  3791. {
  3792. return passed_by_lvalue_reference;
  3793. }
  3794. template &lt;std::size_t N&gt;
  3795. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;&amp;)
  3796. {
  3797. return passed_by_rvalue_reference_to_const;
  3798. }
  3799. template &lt;std::size_t N&gt;
  3800. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;&amp;)
  3801. {
  3802. return passed_by_rvalue_reference;
  3803. }
  3804. };
  3805. </pre>
  3806. <p>Define the named parameters that will comprise the argument specification that
  3807. this macro will use. Ensure that all their tag types are in the same
  3808. namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
  3809. underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
  3810. same argument to which the corresponding named parameter (without underscores)
  3811. is bound, as will be shown later.</p>
  3812. <pre class="literal-block">
  3813. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
  3814. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
  3815. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
  3816. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
  3817. </pre>
  3818. <p>Use the macro as a substitute for a normal <tt class="docutils literal">static</tt> member function
  3819. header. Enclose the return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter,
  3820. also enclose the expected value type in parentheses. Since the value types
  3821. are mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
  3822. clause. Otherwise, just as with a normal function, the order in which you
  3823. specify the parameters determines their position. However, unlike a normal
  3824. function, default values must be specified within the function body. Also
  3825. within the function body, you must pass the matching identifier with the
  3826. leading underscore to the bracket operator of <tt class="docutils literal">args</tt> to extract the
  3827. corresponding argument, but at least this doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to
  3828. preserve value categories.</p>
  3829. <pre class="literal-block">
  3830. struct B
  3831. {
  3832. BOOST_PARAMETER_BASIC_MEMBER_FUNCTION((bool), static evaluate, kw,
  3833. (deduced
  3834. (required
  3835. (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;1&gt;))
  3836. (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;2&gt;))
  3837. )
  3838. (optional
  3839. (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;3&gt;))
  3840. (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;4&gt;))
  3841. )
  3842. )
  3843. )
  3844. {
  3845. BOOST_TEST_EQ(
  3846. passed_by_lvalue_reference_to_const
  3847. , U::evaluate_category&lt;0&gt;(args[_lrc])
  3848. );
  3849. BOOST_TEST_EQ(
  3850. passed_by_lvalue_reference
  3851. , U::evaluate_category&lt;1&gt;(args[_lr])
  3852. );
  3853. BOOST_TEST_EQ(
  3854. passed_by_rvalue_reference_to_const
  3855. , U::evaluate_category&lt;2&gt;(
  3856. args[_rrc0 | rvalue_const_bitset&lt;2&gt;()]
  3857. )
  3858. );
  3859. BOOST_TEST_EQ(
  3860. passed_by_rvalue_reference
  3861. , U::evaluate_category&lt;3&gt;(
  3862. args[_rr0 | rvalue_bitset&lt;3&gt;()]
  3863. )
  3864. );
  3865. return true;
  3866. }
  3867. };
  3868. </pre>
  3869. <p>The following function calls are legal.</p>
  3870. <pre class="literal-block">
  3871. B::evaluate( // positional arguments
  3872. lvalue_const_bitset&lt;0&gt;()
  3873. , lvalue_bitset&lt;1&gt;()
  3874. , rvalue_const_bitset&lt;2&gt;()
  3875. , rvalue_bitset&lt;3&gt;()
  3876. );
  3877. B::evaluate( // positional arguments
  3878. lvalue_const_bitset&lt;0&gt;()
  3879. , lvalue_bitset&lt;1&gt;()
  3880. );
  3881. B::evaluate(( // composed arguments
  3882. _rr0 = rvalue_bitset&lt;3&gt;()
  3883. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  3884. , _lr0 = lvalue_bitset&lt;1&gt;()
  3885. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  3886. ));
  3887. B::evaluate( // named arguments
  3888. _rr0 = rvalue_bitset&lt;3&gt;()
  3889. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  3890. , _lr0 = lvalue_bitset&lt;1&gt;()
  3891. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  3892. );
  3893. B::evaluate( // named arguments
  3894. _lr0 = lvalue_bitset&lt;1&gt;()
  3895. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  3896. );
  3897. </pre>
  3898. <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
  3899. function calls are also legal.</p>
  3900. <pre class="literal-block">
  3901. B::evaluate( // deduced arguments
  3902. rvalue_bitset&lt;3&gt;()
  3903. , lvalue_const_bitset&lt;0&gt;()
  3904. , lvalue_bitset&lt;1&gt;()
  3905. , rvalue_const_bitset&lt;2&gt;()
  3906. );
  3907. B::evaluate( // deduced arguments
  3908. lvalue_bitset&lt;1&gt;()
  3909. , lvalue_const_bitset&lt;0&gt;()
  3910. );
  3911. </pre>
  3912. <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> test program demonstrates proper usage of this macro.</p>
  3913. <p><strong>Macro parameters:</strong></p>
  3914. <ul class="simple">
  3915. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
  3916. <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
  3917. generated forwarding functions. <tt class="docutils literal">name</tt> may be qualified by the
  3918. <tt class="docutils literal">static</tt> keyword to declare the member function and its helpers as not
  3919. associated with any object of the enclosing type.</li>
  3920. <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
  3921. function resides.</li>
  3922. <li><tt class="docutils literal">arguments</tt> is a <a class="reference external" href="../../../preprocessor/doc/index.html">Boost.Preprocessor</a> <a class="reference external" href="../../../preprocessor/doc/data/sequences.html">sequence</a> of
  3923. <em>argument-specifiers</em>, as defined below.</li>
  3924. </ul>
  3925. <p><strong>Argument specifiers syntax:</strong></p>
  3926. <pre class="literal-block">
  3927. argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
  3928. specifier-group0 ::= <em>specifier-group1</em> |
  3929. (
  3930. '<strong>(</strong>' '<strong>deduced</strong>'
  3931. <em>specifier-group1</em> {<em>specifier-group1</em>}
  3932. '<strong>)</strong>'
  3933. )
  3934. specifier-group1 ::=
  3935. (
  3936. '<strong>(</strong>' '<strong>optional</strong>'
  3937. <em>specifier</em> {<em>specifier</em>}
  3938. '<strong>)</strong>'
  3939. ) | (
  3940. '<strong>(</strong>' '<strong>required</strong>'
  3941. <em>specifier</em> {<em>specifier</em>}
  3942. '<strong>)</strong>'
  3943. )
  3944. specifier ::=
  3945. '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
  3946. restriction ::=
  3947. ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
  3948. ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
  3949. '<strong>*</strong>'
  3950. </pre>
  3951. <ul class="simple">
  3952. <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
  3953. <li><tt class="docutils literal">mfc</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary Metafunction Class</a> whose first argument will
  3954. be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
  3955. will be the entire <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is a <a class="reference external" href="../../../mpl/doc/refmanual/integral-constant.html">Boolean
  3956. Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
  3957. of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
  3958. <li><tt class="docutils literal"><span class="pre">type-name</span></tt> is either the name of a <strong>target type</strong> or an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary
  3959. Metafunction Class</a> whose first argument will be the type of the
  3960. corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
  3961. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>.</li>
  3962. </ul>
  3963. <p>Note that <em>specifier</em> does not include <em>default-value</em>. It is up to the
  3964. function body to determine the default value of all optional arguments.</p>
  3965. <p><strong>Approximate expansion:</strong></p>
  3966. <p>Where:</p>
  3967. <ul class="simple">
  3968. <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  3969. <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  3970. </ul>
  3971. <pre class="literal-block">
  3972. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  3973. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  3974. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  3975. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  3976. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  3977. template &lt;typename Args&gt;
  3978. using boost_param_result_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
  3979. // If <strong>result</strong> is a simple return type:
  3980. template &lt;typename Args&gt;
  3981. struct boost_param_result_ ## __LINE__ ## <strong>name</strong>
  3982. {
  3983. typedef <strong>result</strong> type;
  3984. };
  3985. struct boost_param_params_ ## __LINE__ ## <strong>name</strong>
  3986. : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  3987. <em>list of parameter specifications, based on arguments</em>
  3988. &gt;
  3989. {
  3990. };
  3991. typedef boost_param_params_ ## __LINE__ ## <strong>name</strong>
  3992. boost_param_parameters_ ## __LINE__ ## <strong>name</strong>;
  3993. template &lt;typename A0, …, typename A ## <strong>n</strong>&gt;
  3994. <strong>result</strong> <strong>name</strong>(
  3995. A0&amp;&amp; a0, …, A ## <strong>n</strong>&amp;&amp; a ## <strong>n</strong>
  3996. , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
  3997. ::match&lt;A0, …, A ## <strong>n</strong>&gt;::type
  3998. = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
  3999. )
  4000. {
  4001. return this-&gt;boost_param_impl ## <strong>name</strong>(
  4002. boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
  4003. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  4004. , …
  4005. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>n</strong>&gt;(a ## <strong>n</strong>)
  4006. )
  4007. );
  4008. }
  4009. <span class="vellipsis">⋮</span>
  4010. template &lt;typename A0, …, typename A ## <strong>m</strong>&gt;
  4011. <strong>result</strong> <strong>name</strong>(
  4012. A0&amp;&amp; a0, …, A ## <strong>m</strong>&amp;&amp; a ## <strong>m</strong>
  4013. , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
  4014. ::match&lt;A0, …, A ## <strong>m</strong>&gt;::type
  4015. = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
  4016. )
  4017. {
  4018. return this-&gt;boost_param_impl ## <strong>name</strong>(
  4019. boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
  4020. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  4021. , …
  4022. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>m</strong>&gt;(a ## <strong>m</strong>)
  4023. )
  4024. );
  4025. }
  4026. template &lt;typename Args&gt;
  4027. typename boost_param_result_ ## __LINE__ ## <strong>name</strong>&lt;Args&gt;::type
  4028. boost_param_impl ## <strong>name</strong>(Args const&amp; args)
  4029. </pre>
  4030. <p>Only the <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> type <tt class="docutils literal">Args</tt> and its object instance <tt class="docutils literal">args</tt> are
  4031. available for use within the function body.</p>
  4032. </div>
  4033. <div class="section" id="boost-parameter-basic-const-member-function-result-name-tag-ns-args">
  4034. <span id="boost-parameter-basic-const-member-function"></span><h2><a class="toc-backref" href="#id65">7.9&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION(result, name, tag_ns, args)</tt></a></h2>
  4035. <table class="docutils field-list" frame="void" rules="none">
  4036. <col class="field-name" />
  4037. <col class="field-body" />
  4038. <tbody valign="top">
  4039. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td>
  4040. </tr>
  4041. </tbody>
  4042. </table>
  4043. <p>Generates a member function that can take in positional arguments, composed
  4044. arguments, named arguments, and deduced arguments.</p>
  4045. <table class="docutils field-list" frame="void" rules="none">
  4046. <col class="field-name" />
  4047. <col class="field-body" />
  4048. <tbody valign="top">
  4049. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  4050. </tr>
  4051. </tbody>
  4052. </table>
  4053. <p>The return type of each of the following function templates falls under a
  4054. different value category.</p>
  4055. <pre class="literal-block">
  4056. template &lt;std::size_t N&gt;
  4057. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; rvalue_bitset()
  4058. {
  4059. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  4060. }
  4061. template &lt;std::size_t N&gt;
  4062. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const rvalue_const_bitset()
  4063. {
  4064. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  4065. }
  4066. template &lt;std::size_t N&gt;
  4067. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp; lvalue_bitset()
  4068. {
  4069. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  4070. return lset;
  4071. }
  4072. template &lt;std::size_t N&gt;
  4073. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp; lvalue_const_bitset()
  4074. {
  4075. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  4076. return clset;
  4077. }
  4078. </pre>
  4079. <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
  4080. to return the correct value category when passed in an object returned by one
  4081. of the functions defined above. Assume that
  4082. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
  4083. <pre class="literal-block">
  4084. enum invoked
  4085. {
  4086. passed_by_lvalue_reference_to_const
  4087. , passed_by_lvalue_reference
  4088. , passed_by_rvalue_reference_to_const
  4089. , passed_by_rvalue_reference
  4090. };
  4091. struct U
  4092. {
  4093. template &lt;std::size_t N&gt;
  4094. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;)
  4095. {
  4096. return passed_by_lvalue_reference_to_const;
  4097. }
  4098. template &lt;std::size_t N&gt;
  4099. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;)
  4100. {
  4101. return passed_by_lvalue_reference;
  4102. }
  4103. template &lt;std::size_t N&gt;
  4104. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;&amp;)
  4105. {
  4106. return passed_by_rvalue_reference_to_const;
  4107. }
  4108. template &lt;std::size_t N&gt;
  4109. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;&amp;)
  4110. {
  4111. return passed_by_rvalue_reference;
  4112. }
  4113. };
  4114. </pre>
  4115. <p>Define the named parameters that will comprise the argument specification that
  4116. this macro will use. Ensure that all their tag types are in the same
  4117. namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
  4118. underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
  4119. same argument to which the corresponding named parameter (without underscores)
  4120. is bound, as will be shown later.</p>
  4121. <pre class="literal-block">
  4122. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
  4123. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
  4124. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
  4125. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
  4126. </pre>
  4127. <p>Use the macro as a substitute for a normal <tt class="docutils literal">const</tt> member function
  4128. header. Enclose the return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter,
  4129. also enclose the expected value type in parentheses. Since the value types
  4130. are mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
  4131. clause. Otherwise, just as with a normal function, the order in which you
  4132. specify the parameters determines their position. However, unlike a normal
  4133. function, default values must be specified within the function body. Also
  4134. within the function body, you must pass the matching identifier with the
  4135. leading underscore to the bracket operator of <tt class="docutils literal">args</tt> to extract the
  4136. corresponding argument, but at least this doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to
  4137. preserve value categories.</p>
  4138. <pre class="literal-block">
  4139. struct B
  4140. {
  4141. B()
  4142. {
  4143. }
  4144. BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION((bool), evaluate, kw,
  4145. (deduced
  4146. (required
  4147. (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;1&gt;))
  4148. (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;2&gt;))
  4149. )
  4150. (optional
  4151. (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;3&gt;))
  4152. (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;4&gt;))
  4153. )
  4154. )
  4155. )
  4156. {
  4157. BOOST_TEST_EQ(
  4158. passed_by_lvalue_reference_to_const
  4159. , U::evaluate_category&lt;0&gt;(args[_lrc])
  4160. );
  4161. BOOST_TEST_EQ(
  4162. passed_by_lvalue_reference
  4163. , U::evaluate_category&lt;1&gt;(args[_lr])
  4164. );
  4165. BOOST_TEST_EQ(
  4166. passed_by_rvalue_reference_to_const
  4167. , U::evaluate_category&lt;2&gt;(
  4168. args[_rrc0 | rvalue_const_bitset&lt;2&gt;()]
  4169. )
  4170. );
  4171. BOOST_TEST_EQ(
  4172. passed_by_rvalue_reference
  4173. , U::evaluate_category&lt;3&gt;(
  4174. args[_rr0 | rvalue_bitset&lt;3&gt;()]
  4175. )
  4176. );
  4177. return true;
  4178. }
  4179. };
  4180. </pre>
  4181. <p>The following function calls are legal.</p>
  4182. <pre class="literal-block">
  4183. B const b = B();
  4184. b.evaluate( // positional arguments
  4185. lvalue_const_bitset&lt;0&gt;()
  4186. , lvalue_bitset&lt;1&gt;()
  4187. , rvalue_const_bitset&lt;2&gt;()
  4188. , rvalue_bitset&lt;3&gt;()
  4189. );
  4190. b.evaluate( // positional arguments
  4191. lvalue_const_bitset&lt;0&gt;()
  4192. , lvalue_bitset&lt;1&gt;()
  4193. );
  4194. b.evaluate(( // composed arguments
  4195. _rr0 = rvalue_bitset&lt;3&gt;()
  4196. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  4197. , _lr0 = lvalue_bitset&lt;1&gt;()
  4198. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  4199. ));
  4200. b.evaluate( // named arguments
  4201. _rr0 = rvalue_bitset&lt;3&gt;()
  4202. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  4203. , _lr0 = lvalue_bitset&lt;1&gt;()
  4204. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  4205. );
  4206. b.evaluate( // named arguments
  4207. _lr0 = lvalue_bitset&lt;1&gt;()
  4208. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  4209. );
  4210. </pre>
  4211. <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
  4212. function calls are also legal.</p>
  4213. <pre class="literal-block">
  4214. b.evaluate( // deduced arguments
  4215. rvalue_bitset&lt;3&gt;()
  4216. , lvalue_const_bitset&lt;0&gt;()
  4217. , lvalue_bitset&lt;1&gt;()
  4218. , rvalue_const_bitset&lt;2&gt;()
  4219. );
  4220. b.evaluate( // deduced arguments
  4221. lvalue_bitset&lt;1&gt;()
  4222. , lvalue_const_bitset&lt;0&gt;()
  4223. );
  4224. </pre>
  4225. <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> test program demonstrates proper usage of this macro.</p>
  4226. <p><strong>Macro parameters:</strong></p>
  4227. <ul class="simple">
  4228. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
  4229. <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
  4230. generated forwarding functions.</li>
  4231. <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
  4232. function resides.</li>
  4233. <li><tt class="docutils literal">arguments</tt> is a <a class="reference external" href="../../../preprocessor/doc/index.html">Boost.Preprocessor</a> <a class="reference external" href="../../../preprocessor/doc/data/sequences.html">sequence</a> of
  4234. <em>argument-specifiers</em>, as defined below.</li>
  4235. </ul>
  4236. <p><strong>Argument specifiers syntax:</strong></p>
  4237. <pre class="literal-block">
  4238. argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
  4239. specifier-group0 ::= <em>specifier-group1</em> |
  4240. (
  4241. '<strong>(</strong>' '<strong>deduced</strong>'
  4242. <em>specifier-group1</em> {<em>specifier-group1</em>}
  4243. '<strong>)</strong>'
  4244. )
  4245. specifier-group1 ::=
  4246. (
  4247. '<strong>(</strong>' '<strong>optional</strong>'
  4248. <em>specifier</em> {<em>specifier</em>}
  4249. '<strong>)</strong>'
  4250. ) | (
  4251. '<strong>(</strong>' '<strong>required</strong>'
  4252. <em>specifier</em> {<em>specifier</em>}
  4253. '<strong>)</strong>'
  4254. )
  4255. specifier ::=
  4256. '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
  4257. restriction ::=
  4258. ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
  4259. ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
  4260. '<strong>*</strong>'
  4261. </pre>
  4262. <ul class="simple">
  4263. <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
  4264. <li><tt class="docutils literal">mfc</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary Metafunction Class</a> whose first argument will
  4265. be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
  4266. will be the entire <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is a <a class="reference external" href="../../../mpl/doc/refmanual/integral-constant.html">Boolean
  4267. Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
  4268. of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
  4269. <li><tt class="docutils literal"><span class="pre">type-name</span></tt> is either the name of a <strong>target type</strong> or an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary
  4270. Metafunction Class</a> whose first argument will be the type of the
  4271. corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
  4272. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>.</li>
  4273. </ul>
  4274. <p>Note that <em>specifier</em> does not include <em>default-value</em>. It is up to the
  4275. function body to determine the default value of all optional arguments.</p>
  4276. <p><strong>Approximate expansion:</strong></p>
  4277. <p>Where:</p>
  4278. <ul class="simple">
  4279. <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  4280. <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  4281. </ul>
  4282. <pre class="literal-block">
  4283. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  4284. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  4285. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  4286. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  4287. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  4288. template &lt;typename Args&gt;
  4289. using boost_param_result_const_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
  4290. // If <strong>result</strong> is a simple return type:
  4291. template &lt;typename Args&gt;
  4292. struct boost_param_result_const_ ## __LINE__ ## <strong>name</strong>
  4293. {
  4294. typedef <strong>result</strong> type;
  4295. };
  4296. struct boost_param_params_const_ ## __LINE__ ## <strong>name</strong>
  4297. : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  4298. <em>list of parameter specifications, based on arguments</em>
  4299. &gt;
  4300. {
  4301. };
  4302. typedef boost_param_params_const_ ## __LINE__ ## <strong>name</strong>
  4303. boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>;
  4304. template &lt;typename A0, …, typename A ## <strong>n</strong>&gt;
  4305. <strong>result</strong> <strong>name</strong>(
  4306. A0&amp;&amp; a0, …, A ## <strong>n</strong>&amp;&amp; a ## <strong>n</strong>
  4307. , typename boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>
  4308. ::match&lt;A0, …, A ## <strong>n</strong>&gt;::type
  4309. = boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>()
  4310. ) const
  4311. {
  4312. return this-&gt;boost_param_impl_const ## __LINE__ ## <strong>name</strong>(
  4313. boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>()(
  4314. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  4315. , …
  4316. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>n</strong>&gt;(a ## <strong>n</strong>)
  4317. )
  4318. );
  4319. }
  4320. <span class="vellipsis">⋮</span>
  4321. template &lt;typename A0, …, typename A ## <strong>m</strong>&gt;
  4322. <strong>result</strong> <strong>name</strong>(
  4323. A0&amp;&amp; a0, …, A ## <strong>m</strong>&amp;&amp; a ## <strong>m</strong>
  4324. , typename boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>
  4325. ::match&lt;A0, …, A ## <strong>m</strong>&gt;::type
  4326. = boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>()
  4327. ) const
  4328. {
  4329. return this-&gt;boost_param_impl_const ## __LINE__ ## <strong>name</strong>(
  4330. boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>()(
  4331. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  4332. , …
  4333. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>m</strong>&gt;(a ## <strong>m</strong>)
  4334. )
  4335. );
  4336. }
  4337. template &lt;typename Args&gt;
  4338. typename boost_param_result_const_ ## __LINE__ ## <strong>name</strong>&lt;Args&gt;::type
  4339. boost_param_impl_const ## __LINE__ ## <strong>name</strong>(Args const&amp; args) const
  4340. </pre>
  4341. <p>Only the <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> type <tt class="docutils literal">Args</tt> and its object instance <tt class="docutils literal">args</tt> are
  4342. available for use within the function body.</p>
  4343. </div>
  4344. <div class="section" id="boost-parameter-basic-function-call-operator-result-tag-ns-arguments">
  4345. <span id="boost-parameter-basic-function-call-operator"></span><h2><a class="toc-backref" href="#id66">7.10&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR(result, tag_ns, arguments)</tt></a></h2>
  4346. <table class="docutils field-list" frame="void" rules="none">
  4347. <col class="field-name" />
  4348. <col class="field-body" />
  4349. <tbody valign="top">
  4350. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td>
  4351. </tr>
  4352. </tbody>
  4353. </table>
  4354. <p>Generates a function call operator that can take in positional arguments,
  4355. composed arguments, named arguments, and deduced arguments.</p>
  4356. <table class="docutils field-list" frame="void" rules="none">
  4357. <col class="field-name" />
  4358. <col class="field-body" />
  4359. <tbody valign="top">
  4360. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  4361. </tr>
  4362. </tbody>
  4363. </table>
  4364. <p>Define the named parameters that will comprise the argument specification that
  4365. this macro will use. Ensure that all their tag types are in the same
  4366. namespace, which is <tt class="docutils literal">tag</tt> by default.</p>
  4367. <pre class="literal-block">
  4368. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(y)
  4369. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(z)
  4370. </pre>
  4371. <p>Use the macro as a substitute for a normal function call operator
  4372. header. Enclose the return type in parentheses. For each parameter, also
  4373. enclose the expected value type in parentheses. Since the value types are
  4374. mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
  4375. clause. This is especially useful when implementing multiple
  4376. Boost.Parameter-enabled function call operator overloads.</p>
  4377. <pre class="literal-block">
  4378. class char_reader
  4379. {
  4380. int index;
  4381. char const* key;
  4382. public:
  4383. explicit char_reader(char const* k) : index(0), key(k)
  4384. {
  4385. }
  4386. BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR((void), tag,
  4387. (deduced
  4388. (required
  4389. (y, (int))
  4390. (z, (char const*))
  4391. )
  4392. )
  4393. )
  4394. {
  4395. this-&gt;index = args[_y];
  4396. this-&gt;key = args[_z];
  4397. }
  4398. <a class="reference internal" href="#boost-parameter-basic-const-function-call-operator"><tt class="docutils literal">BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR</tt></a>((char), tag,
  4399. (deduced
  4400. (required
  4401. (y, (bool))
  4402. (z, (<a class="reference external" href="http://en.cppreference.com/w/cpp/container/map">std::map</a>&lt;char const*, <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>&gt;))
  4403. )
  4404. )
  4405. )
  4406. {
  4407. return args[_y] ? (
  4408. (args[_z].find(this-&gt;key)-&gt;second)[this-&gt;index]
  4409. ) : this-&gt;key[this-&gt;index];
  4410. }
  4411. };
  4412. </pre>
  4413. <p>As with regular argument-dependent lookup, the value types of the arguments
  4414. passed in determine which function call operator overload gets invoked.</p>
  4415. <pre class="literal-block">
  4416. char const* keys[] = {&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;};
  4417. <a class="reference external" href="http://en.cppreference.com/w/cpp/container/map">std::map</a>&lt;char const*, <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>&gt; k2s;
  4418. k2s[keys[0]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>(&quot;qux&quot;);
  4419. k2s[keys[1]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>(&quot;wmb&quot;);
  4420. k2s[keys[2]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>(&quot;zxc&quot;);
  4421. char_reader r(keys[0]);
  4422. // positional arguments
  4423. BOOST_TEST_EQ('q', (r(true, k2s)));
  4424. BOOST_TEST_EQ('f', (r(false, k2s)));
  4425. // named arguments
  4426. r(_z = keys[1], _y = 1);
  4427. BOOST_TEST_EQ('m', (r(_z = k2s, _y = true)));
  4428. BOOST_TEST_EQ('a', (r(_z = k2s, _y = false)));
  4429. // deduced arguments
  4430. r(keys[2], 2);
  4431. BOOST_TEST_EQ('c', (r(k2s, true)));
  4432. BOOST_TEST_EQ('z', (r(k2s, false)));
  4433. </pre>
  4434. <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> test program demonstrates proper usage of this macro.</p>
  4435. <p><strong>Macro parameters:</strong></p>
  4436. <ul class="simple">
  4437. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function call operator.</li>
  4438. <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
  4439. function call operator resides.</li>
  4440. <li><tt class="docutils literal">arguments</tt> is a <a class="reference external" href="../../../preprocessor/doc/index.html">Boost.Preprocessor</a> <a class="reference external" href="../../../preprocessor/doc/data/sequences.html">sequence</a> of
  4441. <em>argument-specifiers</em>, as defined below.</li>
  4442. </ul>
  4443. <p><strong>Argument specifiers syntax:</strong></p>
  4444. <pre class="literal-block">
  4445. argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
  4446. specifier-group0 ::= <em>specifier-group1</em> |
  4447. (
  4448. '<strong>(</strong>' '<strong>deduced</strong>'
  4449. <em>specifier-group1</em> {<em>specifier-group1</em>}
  4450. '<strong>)</strong>'
  4451. )
  4452. specifier-group1 ::=
  4453. (
  4454. '<strong>(</strong>' '<strong>optional</strong>'
  4455. <em>specifier</em> {<em>specifier</em>}
  4456. '<strong>)</strong>'
  4457. ) | (
  4458. '<strong>(</strong>' '<strong>required</strong>'
  4459. <em>specifier</em> {<em>specifier</em>}
  4460. '<strong>)</strong>'
  4461. )
  4462. specifier ::=
  4463. '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
  4464. restriction ::=
  4465. ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
  4466. ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
  4467. '<strong>*</strong>'
  4468. </pre>
  4469. <ul class="simple">
  4470. <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
  4471. <li><tt class="docutils literal">mfc</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary Metafunction Class</a> whose first argument will
  4472. be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
  4473. will be the entire <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is a <a class="reference external" href="../../../mpl/doc/refmanual/integral-constant.html">Boolean
  4474. Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
  4475. of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
  4476. <li><tt class="docutils literal"><span class="pre">type-name</span></tt> is either the name of a <strong>target type</strong> or an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary
  4477. Metafunction Class</a> whose first argument will be the type of the
  4478. corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
  4479. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>.</li>
  4480. </ul>
  4481. <p>Note that <em>specifier</em> does not include <em>default-value</em>. It is up to the
  4482. function body to determine the default value of all optional arguments.</p>
  4483. <p><strong>Approximate expansion:</strong></p>
  4484. <p>Where:</p>
  4485. <ul class="simple">
  4486. <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  4487. <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  4488. </ul>
  4489. <pre class="literal-block">
  4490. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  4491. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  4492. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  4493. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  4494. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  4495. template &lt;typename Args&gt;
  4496. using boost_param_result_ ## __LINE__ ## operator = <strong>result</strong>;
  4497. // If <strong>result</strong> is a simple return type:
  4498. template &lt;typename Args&gt;
  4499. struct boost_param_result_ ## __LINE__ ## operator
  4500. {
  4501. typedef <strong>result</strong> type;
  4502. };
  4503. struct boost_param_params_ ## __LINE__ ## operator
  4504. : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  4505. <em>list of parameter specifications, based on arguments</em>
  4506. &gt;
  4507. {
  4508. };
  4509. typedef boost_param_params_ ## __LINE__ ## operator
  4510. boost_param_parameters_ ## __LINE__ ## operator;
  4511. template &lt;typename A0, …, typename A ## <strong>n</strong>&gt;
  4512. <strong>result</strong> operator()(
  4513. A0&amp;&amp; a0, …, A ## <strong>n</strong>&amp;&amp; a ## <strong>n</strong>
  4514. , typename boost_param_parameters_ ## __LINE__ ## operator::match&lt;
  4515. A0, …, A ## <strong>n</strong>
  4516. &gt;::type = boost_param_parameters_ ## __LINE__ ## operator()
  4517. )
  4518. {
  4519. return this-&gt;boost_param_impl ## __LINE__ ## operator(
  4520. boost_param_parameters_ ## __LINE__ ## operator()(
  4521. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  4522. , …
  4523. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>n</strong>&gt;(a ## <strong>n</strong>)
  4524. )
  4525. );
  4526. }
  4527. <span class="vellipsis">⋮</span>
  4528. template &lt;typename A0, …, typename A ## <strong>m</strong>&gt;
  4529. <strong>result</strong> operator()(
  4530. A0&amp;&amp; a0, …, A ## <strong>m</strong>&amp;&amp; a ## <strong>m</strong>
  4531. , typename boost_param_parameters_ ## __LINE__ ## operator::match&lt;
  4532. A0, …, A ## <strong>m</strong>
  4533. &gt;::type = boost_param_parameters_ ## __LINE__ ## operator()
  4534. )
  4535. {
  4536. return this-&gt;boost_param_impl ## __LINE__ ## operator(
  4537. boost_param_parameters_ ## __LINE__ ## operator()(
  4538. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  4539. , …
  4540. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>m</strong>&gt;(a ## <strong>m</strong>)
  4541. )
  4542. );
  4543. }
  4544. template &lt;typename Args&gt;
  4545. typename boost_param_result_ ## __LINE__ ## operator&lt;Args&gt;::type
  4546. boost_param_impl ## __LINE__ ## operator(Args const&amp; args)
  4547. </pre>
  4548. <p>Only the <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> type <tt class="docutils literal">Args</tt> and its object instance <tt class="docutils literal">args</tt> are
  4549. available for use within the function call operator body.</p>
  4550. </div>
  4551. <div class="section" id="boost-parameter-basic-const-function-call-operator-result-tag-ns-args">
  4552. <span id="boost-parameter-basic-const-function-call-operator"></span><h2><a class="toc-backref" href="#id67">7.11&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, args)</tt></a></h2>
  4553. <table class="docutils field-list" frame="void" rules="none">
  4554. <col class="field-name" />
  4555. <col class="field-body" />
  4556. <tbody valign="top">
  4557. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></td>
  4558. </tr>
  4559. </tbody>
  4560. </table>
  4561. <p>Generates a function call operator that can take in positional arguments,
  4562. composed arguments, named arguments, and deduced arguments.</p>
  4563. <table class="docutils field-list" frame="void" rules="none">
  4564. <col class="field-name" />
  4565. <col class="field-body" />
  4566. <tbody valign="top">
  4567. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  4568. </tr>
  4569. </tbody>
  4570. </table>
  4571. <p>The return type of each of the following function templates falls under a
  4572. different value category.</p>
  4573. <pre class="literal-block">
  4574. template &lt;std::size_t N&gt;
  4575. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; rvalue_bitset()
  4576. {
  4577. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  4578. }
  4579. template &lt;std::size_t N&gt;
  4580. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const rvalue_const_bitset()
  4581. {
  4582. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  4583. }
  4584. template &lt;std::size_t N&gt;
  4585. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp; lvalue_bitset()
  4586. {
  4587. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  4588. return lset;
  4589. }
  4590. template &lt;std::size_t N&gt;
  4591. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp; lvalue_const_bitset()
  4592. {
  4593. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  4594. return clset;
  4595. }
  4596. </pre>
  4597. <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
  4598. to return the correct value category when passed in an object returned by one
  4599. of the functions defined above. Assume that
  4600. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
  4601. <pre class="literal-block">
  4602. enum invoked
  4603. {
  4604. passed_by_lvalue_reference_to_const
  4605. , passed_by_lvalue_reference
  4606. , passed_by_rvalue_reference_to_const
  4607. , passed_by_rvalue_reference
  4608. };
  4609. struct U
  4610. {
  4611. template &lt;std::size_t N&gt;
  4612. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;)
  4613. {
  4614. return passed_by_lvalue_reference_to_const;
  4615. }
  4616. template &lt;std::size_t N&gt;
  4617. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;)
  4618. {
  4619. return passed_by_lvalue_reference;
  4620. }
  4621. template &lt;std::size_t N&gt;
  4622. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;&amp;)
  4623. {
  4624. return passed_by_rvalue_reference_to_const;
  4625. }
  4626. template &lt;std::size_t N&gt;
  4627. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;&amp;)
  4628. {
  4629. return passed_by_rvalue_reference;
  4630. }
  4631. };
  4632. </pre>
  4633. <p>Define the named parameters that will comprise the argument specification that
  4634. this macro will use. Ensure that all their tag types are in the same
  4635. namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
  4636. underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
  4637. same argument to which the corresponding named parameter (without underscores)
  4638. is bound, as will be shown later.</p>
  4639. <pre class="literal-block">
  4640. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
  4641. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
  4642. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
  4643. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
  4644. </pre>
  4645. <p>Use the macro as a substitute for a normal <tt class="docutils literal">const</tt> function call operator
  4646. header. Enclose the return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter,
  4647. also enclose the expected value type in parentheses. Since the value types
  4648. are mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
  4649. clause. Otherwise, just as with a normal function, the order in which you
  4650. specify the parameters determines their position. However, unlike a normal
  4651. function, default values must be specified within the function body. Also
  4652. within the function body, you must pass the matching identifier with the
  4653. leading underscore to the bracket operator of <tt class="docutils literal">args</tt> to extract the
  4654. corresponding argument, but at least this doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to
  4655. preserve value categories.</p>
  4656. <pre class="literal-block">
  4657. struct B
  4658. {
  4659. B()
  4660. {
  4661. }
  4662. BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR((bool), kw,
  4663. (deduced
  4664. (required
  4665. (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;1&gt;))
  4666. (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;2&gt;))
  4667. )
  4668. (optional
  4669. (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;3&gt;))
  4670. (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;4&gt;))
  4671. )
  4672. )
  4673. )
  4674. {
  4675. BOOST_TEST_EQ(
  4676. passed_by_lvalue_reference_to_const
  4677. , U::evaluate_category&lt;0&gt;(args[_lrc])
  4678. );
  4679. BOOST_TEST_EQ(
  4680. passed_by_lvalue_reference
  4681. , U::evaluate_category&lt;1&gt;(args[_lr])
  4682. );
  4683. BOOST_TEST_EQ(
  4684. passed_by_rvalue_reference_to_const
  4685. , U::evaluate_category&lt;2&gt;(
  4686. args[_rrc0 | rvalue_const_bitset&lt;2&gt;()]
  4687. )
  4688. );
  4689. BOOST_TEST_EQ(
  4690. passed_by_rvalue_reference
  4691. , U::evaluate_category&lt;3&gt;(
  4692. args[_rr0 | rvalue_bitset&lt;3&gt;()]
  4693. )
  4694. );
  4695. return true;
  4696. }
  4697. };
  4698. </pre>
  4699. <p>The following function calls are legal.</p>
  4700. <pre class="literal-block">
  4701. B const b = B();
  4702. b( // positional arguments
  4703. lvalue_const_bitset&lt;0&gt;()
  4704. , lvalue_bitset&lt;1&gt;()
  4705. , rvalue_const_bitset&lt;2&gt;()
  4706. , rvalue_bitset&lt;3&gt;()
  4707. );
  4708. b( // positional arguments
  4709. lvalue_const_bitset&lt;0&gt;()
  4710. , lvalue_bitset&lt;1&gt;()
  4711. );
  4712. b(( // composed arguments
  4713. _rr0 = rvalue_bitset&lt;3&gt;()
  4714. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  4715. , _lr0 = lvalue_bitset&lt;1&gt;()
  4716. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  4717. ));
  4718. b( // named arguments
  4719. _rr0 = rvalue_bitset&lt;3&gt;()
  4720. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  4721. , _lr0 = lvalue_bitset&lt;1&gt;()
  4722. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  4723. );
  4724. b( // named arguments
  4725. _lr0 = lvalue_bitset&lt;1&gt;()
  4726. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  4727. );
  4728. </pre>
  4729. <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
  4730. function calls are also legal.</p>
  4731. <pre class="literal-block">
  4732. b( // deduced arguments
  4733. rvalue_bitset&lt;3&gt;()
  4734. , lvalue_const_bitset&lt;0&gt;()
  4735. , lvalue_bitset&lt;1&gt;()
  4736. , rvalue_const_bitset&lt;2&gt;()
  4737. );
  4738. b( // deduced arguments
  4739. lvalue_bitset&lt;1&gt;()
  4740. , lvalue_const_bitset&lt;0&gt;()
  4741. );
  4742. </pre>
  4743. <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> test program demonstrates proper usage of this macro.</p>
  4744. <p><strong>Macro parameters:</strong></p>
  4745. <ul class="simple">
  4746. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function call operator.</li>
  4747. <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
  4748. function call operator resides.</li>
  4749. <li><tt class="docutils literal">arguments</tt> is a <a class="reference external" href="../../../preprocessor/doc/index.html">Boost.Preprocessor</a> <a class="reference external" href="../../../preprocessor/doc/data/sequences.html">sequence</a> of
  4750. <em>argument-specifiers</em>, as defined below.</li>
  4751. </ul>
  4752. <p><strong>Argument specifiers syntax:</strong></p>
  4753. <pre class="literal-block">
  4754. argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
  4755. specifier-group0 ::= <em>specifier-group1</em> |
  4756. (
  4757. '<strong>(</strong>' '<strong>deduced</strong>'
  4758. <em>specifier-group1</em> {<em>specifier-group1</em>}
  4759. '<strong>)</strong>'
  4760. )
  4761. specifier-group1 ::=
  4762. (
  4763. '<strong>(</strong>' '<strong>optional</strong>'
  4764. <em>specifier</em> {<em>specifier</em>}
  4765. '<strong>)</strong>'
  4766. ) | (
  4767. '<strong>(</strong>' '<strong>required</strong>'
  4768. <em>specifier</em> {<em>specifier</em>}
  4769. '<strong>)</strong>'
  4770. )
  4771. specifier ::=
  4772. '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
  4773. restriction ::=
  4774. ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
  4775. ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
  4776. '<strong>*</strong>'
  4777. </pre>
  4778. <ul class="simple">
  4779. <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
  4780. <li><tt class="docutils literal">mfc</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary Metafunction Class</a> whose first argument will
  4781. be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
  4782. will be the entire <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is a <a class="reference external" href="../../../mpl/doc/refmanual/integral-constant.html">Boolean
  4783. Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
  4784. of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
  4785. <li><tt class="docutils literal"><span class="pre">type-name</span></tt> is either the name of a <strong>target type</strong> or an <a class="reference external" href="../../../mpl/doc/refmanual/metafunction-class.html">MPL Binary
  4786. Metafunction Class</a> whose first argument will be the type of the
  4787. corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
  4788. <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>.</li>
  4789. </ul>
  4790. <p>Note that <em>specifier</em> does not include <em>default-value</em>. It is up to the
  4791. function body to determine the default value of all optional arguments.</p>
  4792. <p><strong>Approximate expansion:</strong></p>
  4793. <p>Where:</p>
  4794. <ul class="simple">
  4795. <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  4796. <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
  4797. </ul>
  4798. <pre class="literal-block">
  4799. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  4800. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  4801. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  4802. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  4803. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  4804. template &lt;typename Args&gt;
  4805. using boost_param_result_const_ ## __LINE__ ## operator = <strong>result</strong>;
  4806. // If <strong>result</strong> is a simple return type:
  4807. template &lt;typename Args&gt;
  4808. struct boost_param_result_const_ ## __LINE__ ## operator
  4809. {
  4810. typedef <strong>result</strong> type;
  4811. };
  4812. struct boost_param_params_const_ ## __LINE__ ## operator
  4813. : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  4814. <em>list of parameter specifications, based on arguments</em>
  4815. &gt;
  4816. {
  4817. };
  4818. typedef boost_param_params_const_ ## __LINE__ ## operator
  4819. boost_param_parameters_const_ ## __LINE__ ## operator;
  4820. template &lt;typename A0, …, typename A ## <strong>n</strong>&gt;
  4821. <strong>result</strong> operator()(
  4822. A0&amp;&amp; a0, …, A ## <strong>n</strong>&amp;&amp; a ## <strong>n</strong>
  4823. , typename boost_param_parameters_const_ ## __LINE__ ## operator
  4824. ::match&lt;A0, …, A ## <strong>n</strong>&gt;::type
  4825. = boost_param_parameters_const_ ## __LINE__ ## operator()
  4826. ) const
  4827. {
  4828. return this-&gt;boost_param_impl_const ## __LINE__ ## operator(
  4829. boost_param_parameters_const_ ## __LINE__ ## operator()(
  4830. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  4831. , …
  4832. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>n</strong>&gt;(a ## <strong>n</strong>)
  4833. )
  4834. );
  4835. }
  4836. <span class="vellipsis">⋮</span>
  4837. template &lt;typename A0, …, typename A ## <strong>m</strong>&gt;
  4838. <strong>result</strong> operator()(
  4839. A0&amp;&amp; a0, …, A ## <strong>m</strong>&amp;&amp; a ## <strong>m</strong>
  4840. , typename boost_param_parameters_const_ ## __LINE__ ## operator
  4841. ::match&lt;A0, …, A ## <strong>m</strong>&gt;::type
  4842. = boost_param_parameters_const_ ## __LINE__ ## operator()
  4843. ) const
  4844. {
  4845. return this-&gt;boost_param_impl_const ## __LINE__ ## operator(
  4846. boost_param_parameters_const_ ## __LINE__ ## operator()(
  4847. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A0&gt;(a0)
  4848. , …
  4849. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>m</strong>&gt;(a ## <strong>m</strong>)
  4850. )
  4851. );
  4852. }
  4853. template &lt;typename Args&gt;
  4854. typename boost_param_result_const_ ## __LINE__ ## operator&lt;Args&gt;::type
  4855. boost_param_impl_const ## __LINE__ ## operator(Args const&amp; args) const
  4856. </pre>
  4857. <p>Only the <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> type <tt class="docutils literal">Args</tt> and its object instance <tt class="docutils literal">args</tt> are
  4858. available for use within the function call operator body.</p>
  4859. </div>
  4860. <div class="section" id="boost-parameter-no-spec-function-result-name">
  4861. <span id="boost-parameter-no-spec-function"></span><h2><a class="toc-backref" href="#id68">7.12&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_FUNCTION(result, name)</tt></a></h2>
  4862. <table class="docutils field-list" frame="void" rules="none">
  4863. <col class="field-name" />
  4864. <col class="field-body" />
  4865. <tbody valign="top">
  4866. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor_no_spec.hpp">boost/parameter/preprocessor_no_spec.hpp</a></td>
  4867. </tr>
  4868. </tbody>
  4869. </table>
  4870. <p>Generates a function that can take in named arguments.</p>
  4871. <table class="docutils field-list" frame="void" rules="none">
  4872. <col class="field-name" />
  4873. <col class="field-body" />
  4874. <tbody valign="top">
  4875. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  4876. </tr>
  4877. </tbody>
  4878. </table>
  4879. <p>The return type of each of the following function templates falls under a
  4880. different value category.</p>
  4881. <pre class="literal-block">
  4882. template &lt;std::size_t N&gt;
  4883. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; rvalue_bitset()
  4884. {
  4885. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  4886. }
  4887. template &lt;std::size_t N&gt;
  4888. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const rvalue_const_bitset()
  4889. {
  4890. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  4891. }
  4892. template &lt;std::size_t N&gt;
  4893. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp; lvalue_bitset()
  4894. {
  4895. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  4896. return lset;
  4897. }
  4898. template &lt;std::size_t N&gt;
  4899. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp; lvalue_const_bitset()
  4900. {
  4901. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  4902. return clset;
  4903. }
  4904. </pre>
  4905. <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
  4906. to return the correct value category when passed in an object returned by one
  4907. of the functions defined above. Assume that
  4908. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
  4909. <pre class="literal-block">
  4910. enum invoked
  4911. {
  4912. passed_by_lvalue_reference_to_const
  4913. , passed_by_lvalue_reference
  4914. , passed_by_rvalue_reference_to_const
  4915. , passed_by_rvalue_reference
  4916. };
  4917. struct U
  4918. {
  4919. template &lt;std::size_t N&gt;
  4920. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;)
  4921. {
  4922. return passed_by_lvalue_reference_to_const;
  4923. }
  4924. template &lt;std::size_t N&gt;
  4925. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;)
  4926. {
  4927. return passed_by_lvalue_reference;
  4928. }
  4929. template &lt;std::size_t N&gt;
  4930. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;&amp;)
  4931. {
  4932. return passed_by_rvalue_reference_to_const;
  4933. }
  4934. template &lt;std::size_t N&gt;
  4935. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;&amp;)
  4936. {
  4937. return passed_by_rvalue_reference;
  4938. }
  4939. };
  4940. </pre>
  4941. <p>Named parameters are required when invoking the function; however, none of
  4942. their tags need to be in the same namespace.</p>
  4943. <pre class="literal-block">
  4944. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw0) in(lrc))
  4945. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw1) in_out(lr))
  4946. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw2) in(rrc))
  4947. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw3) consume(rr))
  4948. </pre>
  4949. <p>Use the macro as a substitute for a variadic function header. Enclose the
  4950. return type <tt class="docutils literal">bool</tt> in parentheses.</p>
  4951. <pre class="literal-block">
  4952. BOOST_PARAMETER_NO_SPEC_FUNCTION((bool), evaluate)
  4953. {
  4954. BOOST_TEST_EQ(
  4955. passed_by_lvalue_reference_to_const
  4956. , U::evaluate_category&lt;0&gt;(args[_lrc])
  4957. );
  4958. BOOST_TEST_EQ(
  4959. passed_by_lvalue_reference
  4960. , U::evaluate_category&lt;1&gt;(args[_lr])
  4961. );
  4962. BOOST_TEST_EQ(
  4963. passed_by_rvalue_reference_to_const
  4964. , U::evaluate_category&lt;2&gt;(
  4965. args[_rrc | rvalue_const_bitset&lt;2&gt;()]
  4966. )
  4967. );
  4968. BOOST_TEST_EQ(
  4969. passed_by_rvalue_reference
  4970. , U::evaluate_category&lt;3&gt;(args[_rr | rvalue_bitset&lt;3&gt;()])
  4971. );
  4972. return true;
  4973. }
  4974. </pre>
  4975. <p>To invoke the function, bind all its arguments to named parameters.</p>
  4976. <pre class="literal-block">
  4977. evaluate(
  4978. _rr0 = rvalue_bitset&lt;3&gt;()
  4979. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  4980. , _lr0 = lvalue_bitset&lt;1&gt;()
  4981. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  4982. );
  4983. evaluate(
  4984. _lr0 = lvalue_bitset&lt;1&gt;()
  4985. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  4986. );
  4987. </pre>
  4988. <p>The <a class="reference external" href="../../test/preprocessor_eval_cat_no_spec.cpp">preprocessor_eval_cat_no_spec.cpp</a> test program demonstrates proper usage of
  4989. this macro.</p>
  4990. <p><strong>Macro parameters:</strong></p>
  4991. <ul class="simple">
  4992. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
  4993. <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
  4994. generated implementation function.</li>
  4995. </ul>
  4996. <p><strong>Argument specifiers syntax:</strong></p>
  4997. <p>None.</p>
  4998. <p><strong>Approximate expansion:</strong></p>
  4999. <pre class="literal-block">
  5000. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  5001. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  5002. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  5003. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  5004. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  5005. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5006. using boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
  5007. // If <strong>result</strong> is a simple return type:
  5008. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5009. struct boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong>
  5010. {
  5011. typedef <strong>result</strong> type;
  5012. };
  5013. template &lt;typename ResultType, typename Args&gt;
  5014. ResultType
  5015. boost_param_no_spec_impl ## __LINE__ ## <strong>name</strong>(
  5016. (ResultType(*)())
  5017. , Args const&amp; args
  5018. );
  5019. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5020. inline typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>&lt;
  5021. <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a>&lt;TaggedArg0,TaggedArgs...&gt;
  5022. , boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong>&lt;
  5023. TaggedArg0
  5024. , TaggedArgs...
  5025. &gt;
  5026. &gt;::type
  5027. <strong>name</strong>(TaggedArg0 const&amp; arg0, TaggedArgs const&amp;... args)
  5028. {
  5029. return boost_param_no_spec_impl ## __LINE__ ## <strong>name</strong>(
  5030. static_cast&lt;
  5031. typename
  5032. boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong>&lt;
  5033. TaggedArg0
  5034. , TaggedArgs...
  5035. &gt;::type(*)()
  5036. &gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  5037. , <a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a>(arg0, args...)
  5038. );
  5039. }
  5040. template &lt;typename ResultType, typename Args&gt;
  5041. ResultType
  5042. boost_param_no_spec_impl ## __LINE__ ## <strong>name</strong>(
  5043. (ResultType(*)())
  5044. , Args const&amp; args
  5045. )
  5046. </pre>
  5047. <p>Only the <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> type <tt class="docutils literal">Args</tt> and its object instance <tt class="docutils literal">args</tt> are
  5048. available for use within the function body.</p>
  5049. </div>
  5050. <div class="section" id="boost-parameter-no-spec-member-function-result-name">
  5051. <span id="boost-parameter-no-spec-member-function"></span><h2><a class="toc-backref" href="#id69">7.13&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION(result, name)</tt></a></h2>
  5052. <table class="docutils field-list" frame="void" rules="none">
  5053. <col class="field-name" />
  5054. <col class="field-body" />
  5055. <tbody valign="top">
  5056. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor_no_spec.hpp">boost/parameter/preprocessor_no_spec.hpp</a></td>
  5057. </tr>
  5058. </tbody>
  5059. </table>
  5060. <p>Generates a member function that can take in named arguments.</p>
  5061. <table class="docutils field-list" frame="void" rules="none">
  5062. <col class="field-name" />
  5063. <col class="field-body" />
  5064. <tbody valign="top">
  5065. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  5066. </tr>
  5067. </tbody>
  5068. </table>
  5069. <p>When designing a front-end class template whose back-end is configurable via
  5070. parameterized inheritance, it can be useful to omit argument specifiers from
  5071. a named-parameter member function so that the delegate member functions of the
  5072. back-end classes can enforce their own specifications.</p>
  5073. <pre class="literal-block">
  5074. template &lt;typename B&gt;
  5075. struct frontend : B
  5076. {
  5077. frontend() : B()
  5078. {
  5079. }
  5080. BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION((void), initialize)
  5081. {
  5082. this-&gt;initialize_impl(args);
  5083. }
  5084. };
  5085. </pre>
  5086. <p>Named parameters are required when invoking the member function; however, none
  5087. of their tags need to be in the same namespace.</p>
  5088. <pre class="literal-block">
  5089. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a0)
  5090. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a1)
  5091. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a2)
  5092. </pre>
  5093. <p>For this example, each of the back-end class templates requires its own
  5094. parameter to be present in the argument pack. In practice, such parameters
  5095. should be optional, with default values.</p>
  5096. <pre class="literal-block">
  5097. template &lt;typename T&gt;
  5098. class backend0
  5099. {
  5100. T a0;
  5101. public:
  5102. backend0() : a0()
  5103. {
  5104. }
  5105. T const&amp; get_a0() const
  5106. {
  5107. return this-&gt;a0;
  5108. }
  5109. protected:
  5110. template &lt;typename ArgPack&gt;
  5111. void initialize_impl(ArgPack const&amp; args)
  5112. {
  5113. this-&gt;a0 = args[_a0];
  5114. }
  5115. };
  5116. template &lt;typename B, typename T&gt;
  5117. class backend1 : public B
  5118. {
  5119. T a1;
  5120. public:
  5121. backend1() : B(), a1()
  5122. {
  5123. }
  5124. T const&amp; get_a1() const
  5125. {
  5126. return this-&gt;a1;
  5127. }
  5128. protected:
  5129. template &lt;typename ArgPack&gt;
  5130. void initialize_impl(ArgPack const&amp; args)
  5131. {
  5132. B::initialize_impl(args);
  5133. this-&gt;a1 = args[_a1];
  5134. }
  5135. };
  5136. template &lt;typename B, typename T&gt;
  5137. class backend2 : public B
  5138. {
  5139. T a2;
  5140. public:
  5141. backend2() : B(), a2()
  5142. {
  5143. }
  5144. T const&amp; get_a2() const
  5145. {
  5146. return this-&gt;a2;
  5147. }
  5148. protected:
  5149. template &lt;typename ArgPack&gt;
  5150. void initialize_impl(ArgPack const&amp; args)
  5151. {
  5152. B::initialize_impl(args);
  5153. this-&gt;a2 = args[_a2];
  5154. }
  5155. };
  5156. </pre>
  5157. <p>This example shows that while <tt class="docutils literal">backend0</tt> must always be the root base class
  5158. template and that <tt class="docutils literal">frontend</tt> must always be the most derived class template,
  5159. the other back-ends can be chained together in different orders.</p>
  5160. <pre class="literal-block">
  5161. char const* p = &quot;foo&quot;;
  5162. frontend&lt;
  5163. backend2&lt;backend1&lt;backend0&lt;char const*&gt;, char&gt;, int&gt;
  5164. &gt; composed_obj0;
  5165. frontend&lt;
  5166. backend1&lt;backend2&lt;backend0&lt;char const*&gt;, int&gt;, char&gt;
  5167. &gt; composed_obj1;
  5168. composed_obj0.initialize(_a2 = 4, _a1 = ' ', _a0 = p);
  5169. composed_obj1.initialize(_a0 = p, _a1 = ' ', _a2 = 4);
  5170. BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
  5171. BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
  5172. BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
  5173. </pre>
  5174. <p>The <a class="reference external" href="../../test/parameterized_inheritance.cpp">parameterized_inheritance.cpp</a> and <a class="reference external" href="../../test/preprocessor_eval_cat_no_spec.cpp">preprocessor_eval_cat_no_spec.cpp</a> test
  5175. programs demonstrate proper usage of this macro.</p>
  5176. <p><strong>Macro parameters:</strong></p>
  5177. <ul class="simple">
  5178. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
  5179. <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
  5180. generated implementation function. <tt class="docutils literal">name</tt> may be qualified by the
  5181. <tt class="docutils literal">static</tt> keyword to declare the member function and its helpers as not
  5182. associated with any object of the enclosing type.</li>
  5183. </ul>
  5184. <p><strong>Argument specifiers syntax:</strong></p>
  5185. <p>None.</p>
  5186. <p><strong>Approximate expansion:</strong></p>
  5187. <pre class="literal-block">
  5188. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  5189. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  5190. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  5191. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  5192. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  5193. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5194. using boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
  5195. // If <strong>result</strong> is a simple return type:
  5196. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5197. struct boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong>
  5198. {
  5199. typedef <strong>result</strong> type;
  5200. };
  5201. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5202. inline typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>&lt;
  5203. <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a>&lt;TaggedArg0,TaggedArgs...&gt;
  5204. , boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong>&lt;
  5205. TaggedArg0
  5206. , TaggedArgs...
  5207. &gt;
  5208. &gt;::type
  5209. <strong>name</strong>(TaggedArg0 const&amp; arg0, TaggedArgs const&amp;... args)
  5210. {
  5211. return this-&gt;boost_param_no_spec_impl ## __LINE__ ## <strong>name</strong>(
  5212. static_cast&lt;
  5213. typename
  5214. boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong>&lt;
  5215. TaggedArg0
  5216. , TaggedArgs...
  5217. &gt;::type(*)()
  5218. &gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  5219. , <a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a>(arg0, args...)
  5220. );
  5221. }
  5222. template &lt;typename ResultType, typename Args&gt;
  5223. ResultType
  5224. boost_param_no_spec_impl ## __LINE__ ## <strong>name</strong>(
  5225. (ResultType(*)())
  5226. , Args const&amp; args
  5227. )
  5228. </pre>
  5229. <p>Only the <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> type <tt class="docutils literal">Args</tt> and its object instance <tt class="docutils literal">args</tt> are
  5230. available for use within the function body.</p>
  5231. </div>
  5232. <div class="section" id="boost-parameter-no-spec-const-member-function-result-name">
  5233. <span id="boost-parameter-no-spec-const-member-function"></span><h2><a class="toc-backref" href="#id70">7.14&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION(result, name)</tt></a></h2>
  5234. <table class="docutils field-list" frame="void" rules="none">
  5235. <col class="field-name" />
  5236. <col class="field-body" />
  5237. <tbody valign="top">
  5238. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor_no_spec.hpp">boost/parameter/preprocessor_no_spec.hpp</a></td>
  5239. </tr>
  5240. </tbody>
  5241. </table>
  5242. <p>Generates a member function that can take in named arguments.</p>
  5243. <table class="docutils field-list" frame="void" rules="none">
  5244. <col class="field-name" />
  5245. <col class="field-body" />
  5246. <tbody valign="top">
  5247. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  5248. </tr>
  5249. </tbody>
  5250. </table>
  5251. <p>The return type of each of the following function templates falls under a
  5252. different value category.</p>
  5253. <pre class="literal-block">
  5254. template &lt;std::size_t N&gt;
  5255. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; rvalue_bitset()
  5256. {
  5257. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  5258. }
  5259. template &lt;std::size_t N&gt;
  5260. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const rvalue_const_bitset()
  5261. {
  5262. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  5263. }
  5264. template &lt;std::size_t N&gt;
  5265. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp; lvalue_bitset()
  5266. {
  5267. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  5268. return lset;
  5269. }
  5270. template &lt;std::size_t N&gt;
  5271. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp; lvalue_const_bitset()
  5272. {
  5273. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  5274. return clset;
  5275. }
  5276. </pre>
  5277. <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
  5278. to return the correct value category when passed in an object returned by one
  5279. of the functions defined above. Assume that
  5280. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
  5281. <pre class="literal-block">
  5282. enum invoked
  5283. {
  5284. passed_by_lvalue_reference_to_const
  5285. , passed_by_lvalue_reference
  5286. , passed_by_rvalue_reference_to_const
  5287. , passed_by_rvalue_reference
  5288. };
  5289. struct U
  5290. {
  5291. template &lt;std::size_t N&gt;
  5292. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;)
  5293. {
  5294. return passed_by_lvalue_reference_to_const;
  5295. }
  5296. template &lt;std::size_t N&gt;
  5297. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;)
  5298. {
  5299. return passed_by_lvalue_reference;
  5300. }
  5301. template &lt;std::size_t N&gt;
  5302. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;&amp;)
  5303. {
  5304. return passed_by_rvalue_reference_to_const;
  5305. }
  5306. template &lt;std::size_t N&gt;
  5307. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;&amp;)
  5308. {
  5309. return passed_by_rvalue_reference;
  5310. }
  5311. };
  5312. </pre>
  5313. <p>Named parameters are required when invoking the member function; however, none
  5314. of their tags need to be in the same namespace.</p>
  5315. <pre class="literal-block">
  5316. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw0) in(lrc))
  5317. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw1) in_out(lr))
  5318. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw2) in(rrc))
  5319. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw3) consume(rr))
  5320. </pre>
  5321. <p>Use the macro as a substitute for a variadic function header. Enclose the
  5322. return type <tt class="docutils literal">bool</tt> in parentheses. The macro will qualify the function with
  5323. the <tt class="docutils literal">const</tt> keyword.</p>
  5324. <pre class="literal-block">
  5325. struct D
  5326. {
  5327. D()
  5328. {
  5329. }
  5330. BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION((bool), evaluate_m)
  5331. {
  5332. BOOST_TEST_EQ(
  5333. passed_by_lvalue_reference_to_const
  5334. , U::evaluate_category&lt;0&gt;(args[_lrc])
  5335. );
  5336. BOOST_TEST_EQ(
  5337. passed_by_lvalue_reference
  5338. , U::evaluate_category&lt;1&gt;(args[_lr])
  5339. );
  5340. BOOST_TEST_EQ(
  5341. passed_by_rvalue_reference_to_const
  5342. , U::evaluate_category&lt;2&gt;(
  5343. args[_rrc | rvalue_const_bitset&lt;2&gt;()]
  5344. )
  5345. );
  5346. BOOST_TEST_EQ(
  5347. passed_by_rvalue_reference
  5348. , U::evaluate_category&lt;3&gt;(
  5349. args[_rr | rvalue_bitset&lt;3&gt;()]
  5350. )
  5351. );
  5352. return true;
  5353. }
  5354. };
  5355. </pre>
  5356. <p>To invoke the member function, bind all its arguments to named parameters.</p>
  5357. <pre class="literal-block">
  5358. D const d = D();
  5359. d.evaluate_m(
  5360. _rr0 = rvalue_bitset&lt;3&gt;()
  5361. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  5362. , _lr0 = lvalue_bitset&lt;1&gt;()
  5363. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  5364. );
  5365. d.evaluate_m(
  5366. _lr0 = lvalue_bitset&lt;1&gt;()
  5367. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  5368. );
  5369. </pre>
  5370. <p>The <a class="reference external" href="../../test/preprocessor_eval_cat_no_spec.cpp">preprocessor_eval_cat_no_spec.cpp</a> test program demonstrates proper usage of
  5371. this macro.</p>
  5372. <p><strong>Macro parameters:</strong></p>
  5373. <ul class="simple">
  5374. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
  5375. <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
  5376. generated implementation function.</li>
  5377. </ul>
  5378. <p><strong>Argument specifiers syntax:</strong></p>
  5379. <p>None.</p>
  5380. <p><strong>Approximate expansion:</strong></p>
  5381. <pre class="literal-block">
  5382. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  5383. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  5384. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  5385. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  5386. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  5387. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5388. using boost_param_no_spec_result_const_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
  5389. // If <strong>result</strong> is a simple return type:
  5390. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5391. struct boost_param_no_spec_result_const_ ## __LINE__ ## <strong>name</strong>
  5392. {
  5393. typedef <strong>result</strong> type;
  5394. };
  5395. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5396. inline typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>&lt;
  5397. <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a>&lt;TaggedArg0,TaggedArgs...&gt;
  5398. , boost_param_no_spec_result_const_ ## __LINE__ ## <strong>name</strong>&lt;
  5399. TaggedArg0
  5400. , TaggedArgs...
  5401. &gt;
  5402. &gt;::type
  5403. <strong>name</strong>(TaggedArg0 const&amp; arg0, TaggedArgs const&amp;... args) const
  5404. {
  5405. return this-&gt;boost_param_no_spec_impl_const ## __LINE__ ## <strong>name</strong>(
  5406. static_cast&lt;
  5407. typename
  5408. boost_param_no_spec_result_const_ ## __LINE__ ## <strong>name</strong>&lt;
  5409. TaggedArg0
  5410. , TaggedArgs...
  5411. &gt;::type(*)()
  5412. &gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  5413. , <a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a>(arg0, args...)
  5414. );
  5415. }
  5416. template &lt;typename ResultType, typename Args&gt;
  5417. ResultType
  5418. boost_param_no_spec_impl_const ## __LINE__ ## <strong>name</strong>(
  5419. (ResultType(*)())
  5420. , Args const&amp; args
  5421. ) const
  5422. </pre>
  5423. <p>Only the <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> type <tt class="docutils literal">Args</tt> and its object instance <tt class="docutils literal">args</tt> are
  5424. available for use within the function body.</p>
  5425. </div>
  5426. <div class="section" id="boost-parameter-no-spec-function-call-operator-result">
  5427. <span id="boost-parameter-no-spec-function-call-operator"></span><h2><a class="toc-backref" href="#id71">7.15&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR(result)</tt></a></h2>
  5428. <table class="docutils field-list" frame="void" rules="none">
  5429. <col class="field-name" />
  5430. <col class="field-body" />
  5431. <tbody valign="top">
  5432. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor_no_spec.hpp">boost/parameter/preprocessor_no_spec.hpp</a></td>
  5433. </tr>
  5434. </tbody>
  5435. </table>
  5436. <p>Generates a function call operator that can take in named arguments.</p>
  5437. <table class="docutils field-list" frame="void" rules="none">
  5438. <col class="field-name" />
  5439. <col class="field-body" />
  5440. <tbody valign="top">
  5441. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  5442. </tr>
  5443. </tbody>
  5444. </table>
  5445. <p>When designing a front-end class template whose back-end is configurable via
  5446. parameterized inheritance, it can be useful to omit argument specifiers from
  5447. a named-parameter function call operator so that the delegate member functions
  5448. of the back-end classes can enforce their own specifications.</p>
  5449. <pre class="literal-block">
  5450. template &lt;typename B&gt;
  5451. struct frontend : B
  5452. {
  5453. frontend() : B()
  5454. {
  5455. }
  5456. BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR((void))
  5457. {
  5458. this-&gt;initialize_impl(args);
  5459. }
  5460. };
  5461. </pre>
  5462. <p>Named parameters are required when invoking the function call operator;
  5463. however, none of their tags need to be in the same namespace.</p>
  5464. <pre class="literal-block">
  5465. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a0)
  5466. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a1)
  5467. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a2)
  5468. </pre>
  5469. <p>For this example, each of the back-end class templates requires its own
  5470. parameter to be present in the argument pack. In practice, such parameters
  5471. should be optional, with default values.</p>
  5472. <pre class="literal-block">
  5473. template &lt;typename T&gt;
  5474. class backend0
  5475. {
  5476. T a0;
  5477. public:
  5478. backend0() : a0()
  5479. {
  5480. }
  5481. T const&amp; get_a0() const
  5482. {
  5483. return this-&gt;a0;
  5484. }
  5485. protected:
  5486. template &lt;typename ArgPack&gt;
  5487. void initialize_impl(ArgPack const&amp; args)
  5488. {
  5489. this-&gt;a0 = args[_a0];
  5490. }
  5491. };
  5492. template &lt;typename B, typename T&gt;
  5493. class backend1 : public B
  5494. {
  5495. T a1;
  5496. public:
  5497. backend1() : B(), a1()
  5498. {
  5499. }
  5500. T const&amp; get_a1() const
  5501. {
  5502. return this-&gt;a1;
  5503. }
  5504. protected:
  5505. template &lt;typename ArgPack&gt;
  5506. void initialize_impl(ArgPack const&amp; args)
  5507. {
  5508. B::initialize_impl(args);
  5509. this-&gt;a1 = args[_a1];
  5510. }
  5511. };
  5512. template &lt;typename B, typename T&gt;
  5513. class backend2 : public B
  5514. {
  5515. T a2;
  5516. public:
  5517. backend2() : B(), a2()
  5518. {
  5519. }
  5520. T const&amp; get_a2() const
  5521. {
  5522. return this-&gt;a2;
  5523. }
  5524. protected:
  5525. template &lt;typename ArgPack&gt;
  5526. void initialize_impl(ArgPack const&amp; args)
  5527. {
  5528. B::initialize_impl(args);
  5529. this-&gt;a2 = args[_a2];
  5530. }
  5531. };
  5532. </pre>
  5533. <p>This example shows that while <tt class="docutils literal">backend0</tt> must always be the root base class
  5534. template and that <tt class="docutils literal">frontend</tt> must always be the most derived class template,
  5535. the other back-ends can be chained together in different orders.</p>
  5536. <pre class="literal-block">
  5537. char const* p = &quot;foo&quot;;
  5538. frontend&lt;
  5539. backend2&lt;backend1&lt;backend0&lt;char const*&gt;, char&gt;, int&gt;
  5540. &gt; composed_obj0;
  5541. frontend&lt;
  5542. backend1&lt;backend2&lt;backend0&lt;char const*&gt;, int&gt;, char&gt;
  5543. &gt; composed_obj1;
  5544. composed_obj0(_a2 = 4, _a1 = ' ', _a0 = p);
  5545. composed_obj1(_a0 = p, _a1 = ' ', _a2 = 4);
  5546. BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
  5547. BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
  5548. BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
  5549. </pre>
  5550. <p>The <a class="reference external" href="../../test/parameterized_inheritance.cpp">parameterized_inheritance.cpp</a> and <a class="reference external" href="../../test/preprocessor_eval_cat_no_spec.cpp">preprocessor_eval_cat_no_spec.cpp</a> test
  5551. programs demonstrate proper usage of this macro.</p>
  5552. <p><strong>Macro parameters:</strong></p>
  5553. <ul class="simple">
  5554. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function call operator.</li>
  5555. </ul>
  5556. <p><strong>Argument specifiers syntax:</strong></p>
  5557. <p>None.</p>
  5558. <p><strong>Approximate expansion:</strong></p>
  5559. <pre class="literal-block">
  5560. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  5561. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  5562. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  5563. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  5564. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  5565. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5566. using boost_param_no_spec_result_ ## __LINE__ ## operator = <strong>result</strong>;
  5567. // If <strong>result</strong> is a simple return type:
  5568. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5569. struct boost_param_no_spec_result_ ## __LINE__ ## operator
  5570. {
  5571. typedef <strong>result</strong> type;
  5572. };
  5573. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5574. inline typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>&lt;
  5575. <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a>&lt;TaggedArg0,TaggedArgs...&gt;
  5576. , boost_param_no_spec_result_ ## __LINE__ ## operator&lt;
  5577. TaggedArg0
  5578. , TaggedArgs...
  5579. &gt;
  5580. &gt;::type
  5581. operator()(TaggedArg0 const&amp; arg0, TaggedArgs const&amp;... args)
  5582. {
  5583. return this-&gt;boost_param_no_spec_impl ## __LINE__ ## operator(
  5584. static_cast&lt;
  5585. typename
  5586. boost_param_no_spec_result_ ## __LINE__ ## operator&lt;
  5587. TaggedArg0
  5588. , TaggedArgs...
  5589. &gt;::type(*)()
  5590. &gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  5591. , <a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a>(arg0, args...)
  5592. );
  5593. }
  5594. template &lt;typename ResultType, typename Args&gt;
  5595. ResultType
  5596. boost_param_no_spec_impl ## __LINE__ ## operator(
  5597. (ResultType(*)())
  5598. , Args const&amp; args
  5599. )
  5600. </pre>
  5601. <p>Only the <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> type <tt class="docutils literal">Args</tt> and its object instance <tt class="docutils literal">args</tt> are
  5602. available for use within the function body.</p>
  5603. </div>
  5604. <div class="section" id="boost-parameter-no-spec-const-function-call-operator-result">
  5605. <span id="boost-parameter-no-spec-const-function-call-operator"></span><h2><a class="toc-backref" href="#id72">7.16&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR(result)</tt></a></h2>
  5606. <table class="docutils field-list" frame="void" rules="none">
  5607. <col class="field-name" />
  5608. <col class="field-body" />
  5609. <tbody valign="top">
  5610. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor_no_spec.hpp">boost/parameter/preprocessor_no_spec.hpp</a></td>
  5611. </tr>
  5612. </tbody>
  5613. </table>
  5614. <p>Generates a function call operator that can take in named arguments.</p>
  5615. <table class="docutils field-list" frame="void" rules="none">
  5616. <col class="field-name" />
  5617. <col class="field-body" />
  5618. <tbody valign="top">
  5619. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  5620. </tr>
  5621. </tbody>
  5622. </table>
  5623. <p>The return type of each of the following function templates falls under a
  5624. different value category.</p>
  5625. <pre class="literal-block">
  5626. template &lt;std::size_t N&gt;
  5627. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; rvalue_bitset()
  5628. {
  5629. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  5630. }
  5631. template &lt;std::size_t N&gt;
  5632. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const rvalue_const_bitset()
  5633. {
  5634. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  5635. }
  5636. template &lt;std::size_t N&gt;
  5637. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp; lvalue_bitset()
  5638. {
  5639. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  5640. return lset;
  5641. }
  5642. template &lt;std::size_t N&gt;
  5643. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp; lvalue_const_bitset()
  5644. {
  5645. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  5646. return clset;
  5647. }
  5648. </pre>
  5649. <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
  5650. to return the correct value category when passed in an object returned by one
  5651. of the functions defined above. Assume that
  5652. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
  5653. <pre class="literal-block">
  5654. enum invoked
  5655. {
  5656. passed_by_lvalue_reference_to_const
  5657. , passed_by_lvalue_reference
  5658. , passed_by_rvalue_reference_to_const
  5659. , passed_by_rvalue_reference
  5660. };
  5661. struct U
  5662. {
  5663. template &lt;std::size_t N&gt;
  5664. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;)
  5665. {
  5666. return passed_by_lvalue_reference_to_const;
  5667. }
  5668. template &lt;std::size_t N&gt;
  5669. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;)
  5670. {
  5671. return passed_by_lvalue_reference;
  5672. }
  5673. template &lt;std::size_t N&gt;
  5674. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;&amp;)
  5675. {
  5676. return passed_by_rvalue_reference_to_const;
  5677. }
  5678. template &lt;std::size_t N&gt;
  5679. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;&amp;)
  5680. {
  5681. return passed_by_rvalue_reference;
  5682. }
  5683. };
  5684. </pre>
  5685. <p>Named parameters are required when invoking the function call operator;
  5686. however, none of their tags need to be in the same namespace.</p>
  5687. <pre class="literal-block">
  5688. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw0) in(lrc))
  5689. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw1) in_out(lr))
  5690. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw2) in(rrc))
  5691. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw3) consume(rr))
  5692. </pre>
  5693. <p>Use the macro as a substitute for a variadic function call operator
  5694. header. Enclose the return type <tt class="docutils literal">bool</tt> in parentheses. The macro will
  5695. qualify the function with the <tt class="docutils literal">const</tt> keyword.</p>
  5696. <pre class="literal-block">
  5697. struct D
  5698. {
  5699. D()
  5700. {
  5701. }
  5702. BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR((bool))
  5703. {
  5704. BOOST_TEST_EQ(
  5705. passed_by_lvalue_reference_to_const
  5706. , U::evaluate_category&lt;0&gt;(args[_lrc])
  5707. );
  5708. BOOST_TEST_EQ(
  5709. passed_by_lvalue_reference
  5710. , U::evaluate_category&lt;1&gt;(args[_lr])
  5711. );
  5712. BOOST_TEST_EQ(
  5713. passed_by_rvalue_reference_to_const
  5714. , U::evaluate_category&lt;2&gt;(
  5715. args[_rrc | rvalue_const_bitset&lt;2&gt;()]
  5716. )
  5717. );
  5718. BOOST_TEST_EQ(
  5719. passed_by_rvalue_reference
  5720. , U::evaluate_category&lt;3&gt;(
  5721. args[_rr | rvalue_bitset&lt;3&gt;()]
  5722. )
  5723. );
  5724. return true;
  5725. }
  5726. };
  5727. </pre>
  5728. <p>To invoke the function call operator, bind all its arguments to named
  5729. parameters.</p>
  5730. <pre class="literal-block">
  5731. D const d = D();
  5732. d(
  5733. _rr0 = rvalue_bitset&lt;3&gt;()
  5734. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  5735. , _lr0 = lvalue_bitset&lt;1&gt;()
  5736. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  5737. );
  5738. d(
  5739. _lr0 = lvalue_bitset&lt;1&gt;()
  5740. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  5741. );
  5742. </pre>
  5743. <p>The <a class="reference external" href="../../test/preprocessor_eval_cat_no_spec.cpp">preprocessor_eval_cat_no_spec.cpp</a> test program demonstrates proper usage of this
  5744. macro.</p>
  5745. <p><strong>Macro parameters:</strong></p>
  5746. <ul class="simple">
  5747. <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function call operator.</li>
  5748. </ul>
  5749. <p><strong>Argument specifiers syntax:</strong></p>
  5750. <p>None.</p>
  5751. <p><strong>Approximate expansion:</strong></p>
  5752. <pre class="literal-block">
  5753. // If <strong>result</strong> is a template instantiation of <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>,
  5754. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>,
  5755. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if_c</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if_c</a>,
  5756. // <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if</a>, <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_disable_if_c</a>, or
  5757. // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
  5758. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5759. using boost_param_no_spec_result_const_ ## __LINE__ ## operator = <strong>result</strong>;
  5760. // If <strong>result</strong> is a simple return type:
  5761. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5762. struct boost_param_no_spec_result_const_ ## __LINE__ ## operator
  5763. {
  5764. typedef <strong>result</strong> type;
  5765. };
  5766. template &lt;typename TaggedArg0, typename ...TaggedArgs&gt;
  5767. inline typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a>&lt;
  5768. <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a>&lt;TaggedArg0,TaggedArgs...&gt;
  5769. , boost_param_no_spec_result_const_ ## __LINE__ ## operator&lt;
  5770. TaggedArg0
  5771. , TaggedArgs...
  5772. &gt;
  5773. &gt;::type
  5774. operator()(
  5775. TaggedArg0 const&amp; arg0
  5776. , TaggedArgs const&amp;... args
  5777. ) const
  5778. {
  5779. return this-&gt;boost_param_no_spec_impl_const ## __LINE__ ## operator(
  5780. static_cast&lt;
  5781. typename
  5782. boost_param_no_spec_result_const_ ## __LINE__ ## operator&lt;
  5783. TaggedArg0
  5784. , TaggedArgs...
  5785. &gt;::type(*)()
  5786. &gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  5787. , <a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a>(arg0, args...)
  5788. );
  5789. }
  5790. template &lt;typename ResultType, typename Args&gt;
  5791. ResultType
  5792. boost_param_no_spec_impl_const ## __LINE__ ## operator(
  5793. (ResultType(*)())
  5794. , Args const&amp; args
  5795. ) const
  5796. </pre>
  5797. <p>Only the <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> type <tt class="docutils literal">Args</tt> and its object instance <tt class="docutils literal">args</tt> are
  5798. available for use within the function body.</p>
  5799. </div>
  5800. <div class="section" id="boost-parameter-no-spec-constructor-cls-impl">
  5801. <span id="boost-parameter-no-spec-constructor"></span><h2><a class="toc-backref" href="#id73">7.17&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(cls, impl)</tt></a></h2>
  5802. <table class="docutils field-list" frame="void" rules="none">
  5803. <col class="field-name" />
  5804. <col class="field-body" />
  5805. <tbody valign="top">
  5806. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor_no_spec.hpp">boost/parameter/preprocessor_no_spec.hpp</a></td>
  5807. </tr>
  5808. </tbody>
  5809. </table>
  5810. <p>Generates a constructor that can take in named arguments.</p>
  5811. <table class="docutils field-list" frame="void" rules="none">
  5812. <col class="field-name" />
  5813. <col class="field-body" />
  5814. <tbody valign="top">
  5815. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  5816. </tr>
  5817. </tbody>
  5818. </table>
  5819. <p>When designing a front-end class template whose back-end is configurable via
  5820. parameterized inheritance, it can be useful to omit argument specifiers from
  5821. a named-parameter constructor so that the delegate constructors of the
  5822. back-end classes can enforce their own specifications.</p>
  5823. <pre class="literal-block">
  5824. template &lt;typename B&gt;
  5825. struct frontend : B
  5826. {
  5827. BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(frontend, (B))
  5828. };
  5829. </pre>
  5830. <p>Named parameters are required when invoking the constructor; however, none of
  5831. their tags need to be in the same namespace.</p>
  5832. <pre class="literal-block">
  5833. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a0)
  5834. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a1)
  5835. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a2)
  5836. </pre>
  5837. <p>For this example, each of the back-end class templates requires its own
  5838. parameter to be present in the argument pack. In practice, such parameters
  5839. should be optional, with default values.</p>
  5840. <pre class="literal-block">
  5841. struct _enabler
  5842. {
  5843. };
  5844. template &lt;typename T&gt;
  5845. class backend0
  5846. {
  5847. T a0;
  5848. public:
  5849. template &lt;typename ArgPack&gt;
  5850. explicit backend0(
  5851. ArgPack const&amp; args
  5852. , typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  5853. <a class="reference internal" href="#is-argument-pack"><tt class="docutils literal">is_argument_pack</tt></a>&lt;ArgPack&gt;
  5854. , _enabler
  5855. &gt;::type = _enabler()
  5856. ) : a0(args[_a0])
  5857. {
  5858. }
  5859. T const&amp; get_a0() const
  5860. {
  5861. return this-&gt;a0;
  5862. }
  5863. };
  5864. template &lt;typename B, typename T&gt;
  5865. class backend1 : public B
  5866. {
  5867. T a1;
  5868. public:
  5869. template &lt;typename ArgPack&gt;
  5870. explicit backend1(
  5871. ArgPack const&amp; args
  5872. , typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  5873. <a class="reference internal" href="#is-argument-pack"><tt class="docutils literal">is_argument_pack</tt></a>&lt;ArgPack&gt;
  5874. , _enabler
  5875. &gt;::type = _enabler()
  5876. ) : B(args), a1(args[_a1])
  5877. {
  5878. }
  5879. T const&amp; get_a1() const
  5880. {
  5881. return this-&gt;a1;
  5882. }
  5883. };
  5884. template &lt;typename B, typename T&gt;
  5885. class backend2 : public B
  5886. {
  5887. T a2;
  5888. public:
  5889. template &lt;typename ArgPack&gt;
  5890. explicit backend2(
  5891. ArgPack const&amp; args
  5892. , typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  5893. <a class="reference internal" href="#is-argument-pack"><tt class="docutils literal">is_argument_pack</tt></a>&lt;ArgPack&gt;
  5894. , _enabler
  5895. &gt;::type = _enabler()
  5896. ) : B(args), a2(args[_a2])
  5897. {
  5898. }
  5899. T const&amp; get_a2() const
  5900. {
  5901. return this-&gt;a2;
  5902. }
  5903. };
  5904. </pre>
  5905. <p>This example shows that while <tt class="docutils literal">backend0</tt> must always be the root base class
  5906. template and that <tt class="docutils literal">frontend</tt> must always be the most derived class template,
  5907. the other back-ends can be chained together in different orders.</p>
  5908. <pre class="literal-block">
  5909. char const* p = &quot;foo&quot;;
  5910. frontend&lt;
  5911. backend2&lt;backend1&lt;backend0&lt;char const*&gt;, char&gt;, int&gt;
  5912. &gt; composed_obj0(_a2 = 4, _a1 = ' ', _a0 = p);
  5913. frontend&lt;
  5914. backend1&lt;backend2&lt;backend0&lt;char const*&gt;, int&gt;, char&gt;
  5915. &gt; composed_obj1(_a0 = p, _a1 = ' ', _a2 = 4);
  5916. BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
  5917. BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
  5918. BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
  5919. </pre>
  5920. <p>The <a class="reference external" href="../../test/parameterized_inheritance.cpp">parameterized_inheritance.cpp</a> and <a class="reference external" href="../../test/preprocessor_eval_cat_no_spec.cpp">preprocessor_eval_cat_no_spec.cpp</a> test
  5921. programs demonstrate proper usage of this macro.</p>
  5922. <p><strong>Macro parameters:</strong></p>
  5923. <ul class="simple">
  5924. <li><tt class="docutils literal">cls</tt> is the name of the enclosing class.</li>
  5925. <li><tt class="docutils literal">impl</tt> is the parenthesized implementation base class for <tt class="docutils literal">cls</tt>.</li>
  5926. </ul>
  5927. <p><strong>Argument specifiers syntax:</strong></p>
  5928. <p>None.</p>
  5929. <p><strong>Approximate expansion:</strong></p>
  5930. <pre class="literal-block">
  5931. template &lt;
  5932. typename TaggedArg0
  5933. , typename ...TaggedArgs
  5934. , typename = typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  5935. <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a>&lt;TaggedArg0,TaggedArgs...&gt;
  5936. &gt;::type
  5937. &gt;
  5938. inline explicit <strong>cls</strong>(
  5939. TaggedArg0 const&amp; arg0
  5940. , TaggedArgs const&amp;... args
  5941. ) : <strong>impl</strong>(<a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a>(arg0, args...))
  5942. {
  5943. }
  5944. </pre>
  5945. </div>
  5946. <div class="section" id="boost-parameter-no-spec-no-base-constructor-cls-impl">
  5947. <span id="boost-parameter-no-spec-no-base-constructor"></span><h2><a class="toc-backref" href="#id74">7.18&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(cls, impl)</tt></a></h2>
  5948. <table class="docutils field-list" frame="void" rules="none">
  5949. <col class="field-name" />
  5950. <col class="field-body" />
  5951. <tbody valign="top">
  5952. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/preprocessor_no_spec.hpp">boost/parameter/preprocessor_no_spec.hpp</a></td>
  5953. </tr>
  5954. </tbody>
  5955. </table>
  5956. <p>Generates a constructor that can take in named arguments.</p>
  5957. <table class="docutils field-list" frame="void" rules="none">
  5958. <col class="field-name" />
  5959. <col class="field-body" />
  5960. <tbody valign="top">
  5961. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  5962. </tr>
  5963. </tbody>
  5964. </table>
  5965. <p>The return type of each of the following function templates falls under a
  5966. different value category.</p>
  5967. <pre class="literal-block">
  5968. template &lt;std::size_t N&gt;
  5969. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; rvalue_bitset()
  5970. {
  5971. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  5972. }
  5973. template &lt;std::size_t N&gt;
  5974. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const rvalue_const_bitset()
  5975. {
  5976. return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  5977. }
  5978. template &lt;std::size_t N&gt;
  5979. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp; lvalue_bitset()
  5980. {
  5981. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  5982. return lset;
  5983. }
  5984. template &lt;std::size_t N&gt;
  5985. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp; lvalue_const_bitset()
  5986. {
  5987. static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;();
  5988. return clset;
  5989. }
  5990. </pre>
  5991. <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
  5992. to return the correct value category when passed in an object returned by one
  5993. of the functions defined above. Assume that
  5994. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
  5995. <pre class="literal-block">
  5996. enum invoked
  5997. {
  5998. passed_by_lvalue_reference_to_const
  5999. , passed_by_lvalue_reference
  6000. , passed_by_rvalue_reference_to_const
  6001. , passed_by_rvalue_reference
  6002. };
  6003. struct U
  6004. {
  6005. template &lt;std::size_t N&gt;
  6006. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;)
  6007. {
  6008. return passed_by_lvalue_reference_to_const;
  6009. }
  6010. template &lt;std::size_t N&gt;
  6011. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;)
  6012. {
  6013. return passed_by_lvalue_reference;
  6014. }
  6015. template &lt;std::size_t N&gt;
  6016. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt; const&amp;&amp;)
  6017. {
  6018. return passed_by_rvalue_reference_to_const;
  6019. }
  6020. template &lt;std::size_t N&gt;
  6021. static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a>&lt;N + 1&gt;&amp;&amp;)
  6022. {
  6023. return passed_by_rvalue_reference;
  6024. }
  6025. };
  6026. </pre>
  6027. <p>Named parameters are required when invoking the constructor; however, none of
  6028. their tags need to be in the same namespace.</p>
  6029. <pre class="literal-block">
  6030. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw0) in(lrc))
  6031. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw1) in_out(lr))
  6032. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw2) in(rrc))
  6033. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw3) consume(rr))
  6034. </pre>
  6035. <p>Unlike <a class="reference internal" href="#boost-parameter-no-spec-constructor"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR</tt></a>, this macro doesn't require a
  6036. base class, only a delegate function to which the generated constructor can
  6037. pass its <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</p>
  6038. <pre class="literal-block">
  6039. struct D
  6040. {
  6041. BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(D, D::_evaluate)
  6042. private:
  6043. template &lt;typename Args&gt;
  6044. static bool _evaluate(Args const&amp; args)
  6045. {
  6046. BOOST_TEST_EQ(
  6047. passed_by_lvalue_reference_to_const
  6048. , U::evaluate_category&lt;0&gt;(args[_lrc])
  6049. );
  6050. BOOST_TEST_EQ(
  6051. passed_by_lvalue_reference
  6052. , U::evaluate_category&lt;1&gt;(args[_lr])
  6053. );
  6054. BOOST_TEST_EQ(
  6055. passed_by_rvalue_reference_to_const
  6056. , U::evaluate_category&lt;2&gt;(
  6057. args[_rrc | rvalue_const_bitset&lt;2&gt;()]
  6058. )
  6059. );
  6060. BOOST_TEST_EQ(
  6061. passed_by_rvalue_reference
  6062. , U::evaluate_category&lt;3&gt;(
  6063. args[_rr | rvalue_bitset&lt;3&gt;()]
  6064. )
  6065. );
  6066. return true;
  6067. }
  6068. };
  6069. </pre>
  6070. <p>To invoke the constructor, bind all its arguments to named parameters.</p>
  6071. <pre class="literal-block">
  6072. D dp0(
  6073. _rr0 = rvalue_bitset&lt;3&gt;()
  6074. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  6075. , _lr0 = lvalue_bitset&lt;1&gt;()
  6076. , _rrc0 = rvalue_const_bitset&lt;2&gt;()
  6077. );
  6078. D dp1(
  6079. _lr0 = lvalue_bitset&lt;1&gt;()
  6080. , _lrc0 = lvalue_const_bitset&lt;0&gt;()
  6081. );
  6082. </pre>
  6083. <p>The <a class="reference external" href="../../test/preprocessor_eval_cat_no_spec.cpp">preprocessor_eval_cat_no_spec.cpp</a> test program demonstrates proper usage of
  6084. this macro.</p>
  6085. <p><strong>Macro parameters:</strong></p>
  6086. <ul class="simple">
  6087. <li><tt class="docutils literal">cls</tt> is the name of the enclosing class.</li>
  6088. <li><tt class="docutils literal">func</tt> is a function that takes in the <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> that the
  6089. generated constructor passes on.</li>
  6090. </ul>
  6091. <p><strong>Argument specifiers syntax:</strong></p>
  6092. <p>None.</p>
  6093. <p><strong>Approximate expansion:</strong></p>
  6094. <pre class="literal-block">
  6095. template &lt;
  6096. typename TaggedArg0
  6097. , typename ...TaggedArgs
  6098. , typename = typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;
  6099. <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a>&lt;TaggedArg0,TaggedArgs...&gt;
  6100. &gt;::type
  6101. &gt;
  6102. inline explicit <strong>cls</strong>(
  6103. TaggedArg0 const&amp; arg0
  6104. , TaggedArgs const&amp;... args
  6105. )
  6106. {
  6107. <strong>func</strong>(<a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a>(arg0, args...));
  6108. }
  6109. </pre>
  6110. </div>
  6111. <div class="section" id="boost-parameter-name-name">
  6112. <span id="boost-parameter-name"></span><h2><a class="toc-backref" href="#id75">7.19&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NAME(name)</tt></a></h2>
  6113. <table class="docutils field-list" frame="void" rules="none">
  6114. <col class="field-name" />
  6115. <col class="field-body" />
  6116. <tbody valign="top">
  6117. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/name.hpp">boost/parameter/name.hpp</a></td>
  6118. </tr>
  6119. </tbody>
  6120. </table>
  6121. <p>Declares a tag-type and keyword object.</p>
  6122. <p><strong>If</strong> <em>name</em> is of the form:</p>
  6123. <pre class="literal-block">
  6124. (<em>object-name</em>, <em>namespace-name</em>) <em>qualifier</em>(<em>tag-name</em>)
  6125. </pre>
  6126. <p><strong>then</strong></p>
  6127. <table class="docutils field-list" frame="void" rules="none">
  6128. <col class="field-name" />
  6129. <col class="field-body" />
  6130. <tbody valign="top">
  6131. <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><em>qualifier</em> is either <tt class="docutils literal">in</tt>, <tt class="docutils literal">out</tt>, <tt class="docutils literal">in_out</tt>, <tt class="docutils literal">consume</tt>,
  6132. <tt class="docutils literal">move_from</tt>, or <tt class="docutils literal">forward</tt>.</td>
  6133. </tr>
  6134. <tr class="field"><th class="field-name">Expands to:</th><td class="field-body"></td>
  6135. </tr>
  6136. </tbody>
  6137. </table>
  6138. <pre class="literal-block">
  6139. namespace <em>namespace-name</em> {
  6140. struct <em>tag-name</em>
  6141. {
  6142. static constexpr char const* keyword_name()
  6143. {
  6144. return ## <em>tag-name</em>;
  6145. }
  6146. typedef <em>unspecified</em> _;
  6147. typedef <em>unspecified</em> _1;
  6148. typedef boost::parameter::<em>qualifier</em> ## _reference qualifier;
  6149. // The following definitions are available only when
  6150. // <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> is defined.
  6151. template &lt;typename ArgumentPack&gt;
  6152. using binding_fn = typename <a class="reference internal" href="#binding"><tt class="docutils literal">binding</tt></a>&lt;
  6153. ArgumentPack
  6154. , <em>tag-name</em>
  6155. &gt;::type;
  6156. template &lt;typename ArgumentPack&gt;
  6157. using fn = typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;ArgumentPack, <em>tag-name</em>&gt;::type;
  6158. };
  6159. }
  6160. <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a>&lt;<em>tag-namespace</em>::<em>tag-name</em>&gt; const&amp; <em>object-name</em>
  6161. = <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a>&lt;<em>tag-namespace</em>::<em>tag-name</em>&gt;::instance;
  6162. </pre>
  6163. <p><strong>Else If</strong> <em>name</em> is of the form:</p>
  6164. <pre class="literal-block">
  6165. (<em>tag-name</em>, <em>namespace-name</em>) <em>object-name</em>
  6166. </pre>
  6167. <p><strong>then</strong></p>
  6168. <p>Treats <em>name</em> as if it were of the form:</p>
  6169. <pre class="literal-block">
  6170. (forward(<em>tag-name</em>), <em>namespace-name</em>) <em>object-name</em>
  6171. </pre>
  6172. <p><strong>Else If</strong> <em>name</em> is of the form:</p>
  6173. <pre class="literal-block">
  6174. <em>qualifier</em>(<em>tag-name</em>)
  6175. </pre>
  6176. <p><strong>then</strong></p>
  6177. <table class="docutils field-list" frame="void" rules="none">
  6178. <col class="field-name" />
  6179. <col class="field-body" />
  6180. <tbody valign="top">
  6181. <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><em>qualifier</em> is either <tt class="docutils literal">in</tt>, <tt class="docutils literal">out</tt>, <tt class="docutils literal">in_out</tt>, <tt class="docutils literal">consume</tt>,
  6182. <tt class="docutils literal">move_from</tt>, or <tt class="docutils literal">forward</tt>.</td>
  6183. </tr>
  6184. <tr class="field"><th class="field-name">Expands to:</th><td class="field-body"></td>
  6185. </tr>
  6186. </tbody>
  6187. </table>
  6188. <pre class="literal-block">
  6189. namespace tag {
  6190. struct <em>tag-name</em>
  6191. {
  6192. static constexpr char const* keyword_name()
  6193. {
  6194. return ## <em>tag-name</em>;
  6195. }
  6196. typedef <em>unspecified</em> _;
  6197. typedef <em>unspecified</em> _1;
  6198. typedef boost::parameter::<em>qualifier</em> ## _reference qualifier;
  6199. // The following definitions are available only when
  6200. // <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> is defined.
  6201. template &lt;typename ArgumentPack&gt;
  6202. using binding_fn = typename <a class="reference internal" href="#binding"><tt class="docutils literal">binding</tt></a>&lt;
  6203. ArgumentPack
  6204. , <em>tag-name</em>
  6205. &gt;::type;
  6206. template &lt;typename ArgumentPack&gt;
  6207. using fn = typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;ArgumentPack, <em>tag-name</em>&gt;::type;
  6208. };
  6209. }
  6210. <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a>&lt;tag::<em>tag-name</em>&gt; const&amp; _ ## <em>tag-name</em>
  6211. = <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a>&lt;tag::<em>tag-name</em>&gt;::instance;
  6212. </pre>
  6213. <p><strong>Else</strong></p>
  6214. <p>Treats <em>name</em> as if it were of the form:</p>
  6215. <pre class="literal-block">
  6216. forward(<em>tag-name</em>)
  6217. </pre>
  6218. </div>
  6219. <div class="section" id="boost-parameter-nested-keyword-tag-namespace-name-alias">
  6220. <span id="boost-parameter-nested-keyword"></span><h2><a class="toc-backref" href="#id76">7.20&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NESTED_KEYWORD(tag_namespace, name, alias)</tt></a></h2>
  6221. <table class="docutils field-list" frame="void" rules="none">
  6222. <col class="field-name" />
  6223. <col class="field-body" />
  6224. <tbody valign="top">
  6225. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/nested_keyword.hpp">boost/parameter/nested_keyword.hpp</a></td>
  6226. </tr>
  6227. </tbody>
  6228. </table>
  6229. <p>Declares a tag-type, a keyword object, and an alias for that object nested in
  6230. the tag-type.</p>
  6231. <p><strong>If</strong> <em>name</em> is of the form:</p>
  6232. <pre class="literal-block">
  6233. <em>qualifier</em>(<em>tag-name</em>)
  6234. </pre>
  6235. <p><strong>then</strong></p>
  6236. <table class="docutils field-list" frame="void" rules="none">
  6237. <col class="field-name" />
  6238. <col class="field-body" />
  6239. <tbody valign="top">
  6240. <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><em>qualifier</em> is either <tt class="docutils literal">in</tt>, <tt class="docutils literal">out</tt>, <tt class="docutils literal">in_out</tt>, <tt class="docutils literal">consume</tt>,
  6241. <tt class="docutils literal">move_from</tt>, or <tt class="docutils literal">forward</tt>.</td>
  6242. </tr>
  6243. <tr class="field"><th class="field-name">Expands to:</th><td class="field-body"></td>
  6244. </tr>
  6245. </tbody>
  6246. </table>
  6247. <pre class="literal-block">
  6248. namespace tag {
  6249. struct <em>tag-name</em>
  6250. {
  6251. static constexpr char const* keyword_name()
  6252. {
  6253. return ## <em>tag-name</em> ## _;
  6254. }
  6255. typedef <em>unspecified</em> _;
  6256. typedef <em>unspecified</em> _1;
  6257. typedef boost::parameter::<em>qualifier</em> ## _reference qualifier;
  6258. static <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a>&lt;<em>tag-name</em>&gt; const&amp; <em>alias</em>;
  6259. // The following definitions are available only when
  6260. // <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> is defined.
  6261. template &lt;typename ArgumentPack&gt;
  6262. using binding_fn = typename <a class="reference internal" href="#binding"><tt class="docutils literal">binding</tt></a>&lt;
  6263. ArgumentPack
  6264. , <em>tag-name</em>
  6265. &gt;::type;
  6266. template &lt;typename ArgumentPack&gt;
  6267. using fn = typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;ArgumentPack, <em>tag-name</em>&gt;::type;
  6268. };
  6269. <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a>&lt;<em>tag-name</em>&gt; const&amp; tag::<em>tag-name</em>::<em>alias</em>
  6270. = <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a>&lt;<em>tag-name</em>&gt;::instance;
  6271. }
  6272. <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a>&lt;tag::<em>tag-name</em>&gt; const&amp; tag::<em>tag-name</em>::<em>name</em>
  6273. = <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a>&lt;tag::<em>tag-name</em>&gt;::instance;
  6274. </pre>
  6275. <p><strong>Else</strong></p>
  6276. <p>Treats <em>name</em> as if it were of the form:</p>
  6277. <pre class="literal-block">
  6278. forward(<em>tag-name</em>)
  6279. </pre>
  6280. </div>
  6281. <div class="section" id="boost-parameter-template-keyword-name">
  6282. <span id="boost-parameter-template-keyword"></span><h2><a class="toc-backref" href="#id77">7.21&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_TEMPLATE_KEYWORD(name)</tt></a></h2>
  6283. <table class="docutils field-list" frame="void" rules="none">
  6284. <col class="field-name" />
  6285. <col class="field-body" />
  6286. <tbody valign="top">
  6287. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/template_keyword.hpp">boost/parameter/template_keyword.hpp</a></td>
  6288. </tr>
  6289. <tr class="field"><th class="field-name">Included by:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/name.hpp">boost/parameter/name.hpp</a></td>
  6290. </tr>
  6291. <tr class="field"><th class="field-name">Expands to:</th><td class="field-body"></td>
  6292. </tr>
  6293. </tbody>
  6294. </table>
  6295. <pre class="literal-block">
  6296. namespace tag {
  6297. struct <em>name</em>;
  6298. }
  6299. template &lt;typename T&gt;
  6300. struct <em>name</em> : <a class="reference internal" href="#template-keyword"><tt class="docutils literal">template_keyword</tt></a>&lt;tag:: <em>name</em>, T&gt;
  6301. {
  6302. };
  6303. </pre>
  6304. <p>The <a class="reference external" href="../../test/function_type_tpl_param.cpp">function_type_tpl_param.cpp</a> test program demonstrates proper usage of
  6305. this macro.</p>
  6306. </div>
  6307. <div class="section" id="boost-parameter-fun-r-n-l-h-p">
  6308. <span id="boost-parameter-fun"></span><h2><a class="toc-backref" href="#id78">7.22&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_FUN(r, n, l, h, p)</tt></a></h2>
  6309. <div class="admonition-deprecated admonition">
  6310. <p class="first admonition-title">Deprecated</p>
  6311. <p class="last">This macro has been deprecated in favor of
  6312. <tt class="docutils literal">BOOST_PARAMETER_FUNCTION</tt>.</p>
  6313. </div>
  6314. <p>Generates a sequence of <a class="reference external" href="index.html#forwarding-functions">forwarding function</a> templates named
  6315. <tt class="docutils literal">n</tt>, with arities ranging from <tt class="docutils literal">l</tt> to <tt class="docutils literal">h</tt>, returning <tt class="docutils literal">r</tt>,
  6316. and using <tt class="docutils literal">p</tt> to control overload resolution and assign tags to
  6317. positional arguments.</p>
  6318. <table class="docutils field-list" frame="void" rules="none">
  6319. <col class="field-name" />
  6320. <col class="field-body" />
  6321. <tbody valign="top">
  6322. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/macros.hpp">boost/parameter/macros.hpp</a></td>
  6323. </tr>
  6324. <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">l</tt> and <tt class="docutils literal">h</tt> are nonnegative integer tokens
  6325. such that <tt class="docutils literal">l</tt> &lt; <tt class="docutils literal">h</tt></td>
  6326. </tr>
  6327. <tr class="field"><th class="field-name">Expands to:</th><td class="field-body"></td>
  6328. </tr>
  6329. </tbody>
  6330. </table>
  6331. <pre class="literal-block">
  6332. template &lt;typename A1, typename A2, …, typename A ## <strong>l</strong>&gt;
  6333. r
  6334. name(
  6335. A1 &amp;&amp; a1, A2 &amp;&amp; a2, …, A ## <strong>l</strong> &amp;&amp; a ## <strong>l</strong>
  6336. , typename <strong>p</strong>::match&lt;A1, A2, …, A ## <strong>l</strong>&gt;::type p = <strong>p</strong>()
  6337. )
  6338. {
  6339. return <strong>name</strong>_with_named_params(
  6340. <strong>p</strong>(
  6341. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A1&gt;(a1)
  6342. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A2&gt;(a2)
  6343. , …
  6344. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>l</strong>&gt;(a ## <strong>l</strong>)
  6345. )
  6346. );
  6347. }
  6348. template &lt;
  6349. typename A1
  6350. , typename A2
  6351. , …
  6352. , typename A ## <strong>l</strong>
  6353. , typename A ## <a class="reference external" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>)
  6354. &gt;
  6355. r
  6356. name(
  6357. A1 &amp;&amp; a1, A2 &amp;&amp; a2, …, A ## <strong>l</strong> &amp;&amp; a ## <strong>l</strong>
  6358. , A ## <a class="reference external" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>) const&amp; a ## <a class="reference external" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>)
  6359. , typename <strong>p</strong>::match&lt;
  6360. A1, A2, …, A ## <strong>l</strong>, A ## <a class="reference external" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>)
  6361. &gt;::type p = <strong>p</strong>()
  6362. )
  6363. {
  6364. return <strong>name</strong>_with_named_params(
  6365. <strong>p</strong>(
  6366. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A1&gt;(a1)
  6367. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A2&gt;(a2)
  6368. , …
  6369. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>l</strong>&gt;(a ## <strong>l</strong>)
  6370. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <a class="reference external" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>)&gt;(
  6371. a ## <a class="reference external" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>)
  6372. )
  6373. )
  6374. );
  6375. }
  6376. <span class="vellipsis">⋮</span>
  6377. template &lt;typename A1, typename A2, …, typename A ## <strong>h</strong>&gt;
  6378. r
  6379. name(
  6380. A1 &amp;&amp; a1, A2 &amp;&amp; a2, …, A ## <strong>h</strong> &amp;&amp; x ## <strong>h</strong>
  6381. , typename <strong>p</strong>::match&lt;A1, A2, …, A ## <strong>h</strong>&gt;::type p = <strong>p</strong>()
  6382. )
  6383. {
  6384. return <strong>name</strong>_with_named_params(
  6385. <strong>p</strong>(
  6386. <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A1&gt;(a1)
  6387. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A2&gt;(a2)
  6388. , …
  6389. , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a>&lt;A ## <strong>h</strong>&gt;(a ## <strong>h</strong>)
  6390. )
  6391. );
  6392. }
  6393. </pre>
  6394. <p>The <a class="reference external" href="../../test/macros.cpp">macros.cpp</a> and <a class="reference external" href="../../test/macros_eval_category.cpp">macros_eval_category.cpp</a> test programs demonstrate proper
  6395. usage of this macro.</p>
  6396. </div>
  6397. <div class="section" id="boost-parameter-keyword-n-k">
  6398. <span id="boost-parameter-keyword"></span><h2><a class="toc-backref" href="#id79">7.23&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_KEYWORD(n, k)</tt></a></h2>
  6399. <div class="admonition-deprecated admonition">
  6400. <p class="first admonition-title">Deprecated</p>
  6401. <p class="last">This macro has been deprecated in favor of
  6402. <tt class="docutils literal">BOOST_PARAMETER_NAME</tt>.</p>
  6403. </div>
  6404. <p>Generates the declaration of a <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> named <tt class="docutils literal">k</tt> in
  6405. namespace <tt class="docutils literal">n</tt> and a corresponding <a class="reference internal" href="#keyword-object">keyword object</a> definition in
  6406. the enclosing namespace.</p>
  6407. <table class="docutils field-list" frame="void" rules="none">
  6408. <col class="field-name" />
  6409. <col class="field-body" />
  6410. <tbody valign="top">
  6411. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/keyword.hpp">boost/parameter/keyword.hpp</a></td>
  6412. </tr>
  6413. <tr class="field"><th class="field-name">Expands to:</th><td class="field-body"></td>
  6414. </tr>
  6415. </tbody>
  6416. </table>
  6417. <pre class="literal-block">
  6418. namespace <strong>n</strong> {
  6419. struct <strong>k</strong>
  6420. {
  6421. static constexpr char const* keyword_name()
  6422. {
  6423. return ## <em>k</em>;
  6424. }
  6425. typedef <em>unspecified</em> _;
  6426. typedef <em>unspecified</em> _1;
  6427. typedef boost::parameter::forward_reference qualifier;
  6428. // The following definitions are available only when
  6429. // <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> is defined.
  6430. template &lt;typename ArgumentPack&gt;
  6431. using binding_fn = typename <a class="reference internal" href="#binding"><tt class="docutils literal">binding</tt></a>&lt;
  6432. ArgumentPack
  6433. , <em>k</em>
  6434. &gt;::type;
  6435. template &lt;typename ArgumentPack&gt;
  6436. using fn = typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a>&lt;ArgumentPack, <em>k</em>&gt;::type;
  6437. };
  6438. }
  6439. namespace {
  6440. <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a>&lt;<em>n</em>::<strong>k</strong>&gt; const&amp; <strong>k</strong>
  6441. = <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a>&lt;<em>n</em>::<strong>k</strong>&gt;::instance;
  6442. }
  6443. </pre>
  6444. </div>
  6445. <div class="section" id="boost-parameter-match-p-a-x">
  6446. <h2><a class="toc-backref" href="#id80">7.24&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_MATCH(p, a, x)</tt></a></h2>
  6447. <p>Generates a defaulted parameter declaration for a <a class="reference external" href="index.html#forwarding-functions">forwarding function</a>.</p>
  6448. <table class="docutils field-list" frame="void" rules="none">
  6449. <col class="field-name" />
  6450. <col class="field-body" />
  6451. <tbody valign="top">
  6452. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/match.hpp">boost/parameter/match.hpp</a></td>
  6453. </tr>
  6454. <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">a</tt> is a <a class="reference external" href="../../../preprocessor/doc/data.html">Boost.Preprocessor sequence</a> of the form</td>
  6455. </tr>
  6456. </tbody>
  6457. </table>
  6458. <pre class="literal-block">
  6459. (A0)(A1)…(A ## <em>n</em>)
  6460. </pre>
  6461. <table class="docutils field-list" frame="void" rules="none">
  6462. <col class="field-name" />
  6463. <col class="field-body" />
  6464. <tbody valign="top">
  6465. <tr class="field"><th class="field-name">Expands to:</th><td class="field-body"></td>
  6466. </tr>
  6467. </tbody>
  6468. </table>
  6469. <pre class="literal-block">
  6470. typename <strong>p</strong>::match&lt;<strong>A0</strong>, <strong>A1</strong>, …, <strong>A</strong> ## <em>n</em>&gt;::type
  6471. <strong>x</strong> = <strong>p</strong>()
  6472. </pre>
  6473. </div>
  6474. </div>
  6475. <div class="section" id="configuration-macros">
  6476. <h1><a class="toc-backref" href="#id81">8&nbsp;&nbsp;&nbsp;Configuration Macros</a></h1>
  6477. <div class="section" id="id21">
  6478. <span id="boost-parameter-has-perfect-forwarding"></span><h2><a class="toc-backref" href="#id82">8.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a></h2>
  6479. <p>Determines whether or not the library supports perfect forwarding, or the
  6480. preservation of parameter value categories. Users can manually disable this
  6481. macro by <tt class="docutils literal">#defining</tt> the <a class="reference internal" href="#boost-parameter-disable-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING</tt></a>
  6482. macro. Otherwise, the library will <tt class="docutils literal">#define</tt> this macro if and only if it
  6483. is not already defined, and if the configuration macros
  6484. <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__03_defects"><tt class="docutils literal">BOOST_NO_FUNCTION_TEMPLATE_ORDERING</tt></a>, <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__03_defects"><tt class="docutils literal">BOOST_NO_SFINAE</tt></a>,
  6485. <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_RVALUE_REFERENCES</tt></a>, <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_VARIADIC_TEMPLATES</tt></a>, and
  6486. <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS</tt></a> are not already defined by
  6487. <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a>.</p>
  6488. <table class="docutils field-list" frame="void" rules="none">
  6489. <col class="field-name" />
  6490. <col class="field-body" />
  6491. <tbody valign="top">
  6492. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/config.hpp">boost/parameter/config.hpp</a></td>
  6493. </tr>
  6494. </tbody>
  6495. </table>
  6496. </div>
  6497. <div class="section" id="id22">
  6498. <span id="boost-parameter-disable-perfect-forwarding"></span><h2><a class="toc-backref" href="#id83">8.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING</tt></a></h2>
  6499. <p>It may be necessary to test user code in case perfect forwarding support is
  6500. unavailable. Users can <tt class="docutils literal">#define</tt> this macro either in their project
  6501. settings or before including any library header files. Doing so will leave
  6502. both <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> and
  6503. <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> undefined.</p>
  6504. </div>
  6505. <div class="section" id="id23">
  6506. <span id="boost-parameter-can-use-mp11"></span><h2><a class="toc-backref" href="#id84">8.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a></h2>
  6507. <p>Determines whether or not the library can use <a class="reference external" href="../../../mp11/doc/html/mp11.html">Boost.MP11</a>, a C++11
  6508. metaprogramming library. Users can manually disable this macro by
  6509. <tt class="docutils literal">#defining</tt> the <a class="reference internal" href="#boost-parameter-disable-mp11-usage"><tt class="docutils literal">BOOST_PARAMETER_DISABLE_MP11_USAGE</tt></a> macro or the
  6510. <a class="reference internal" href="#boost-parameter-disable-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING</tt></a> macro. Otherwise, the library
  6511. will <tt class="docutils literal">#define</tt> this macro if and only if it is not already defined, if
  6512. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined, and if the configuration
  6513. macros <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_CONSTEXPR</tt></a>, <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_DECLTYPE_N3276</tt></a>,
  6514. <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_AUTO_DECLARATIONS</tt></a>, <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_TEMPLATE_ALIASES</tt></a>,
  6515. <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_STATIC_ASSERT</tt></a>, <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_HDR_TYPE_TRAITS</tt></a>,
  6516. <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_HDR_INITIALIZER_LIST</tt></a>, and <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_HDR_TUPLE</tt></a>
  6517. are not already defined by <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a>.</p>
  6518. <div class="admonition-usage-note admonition">
  6519. <p class="first admonition-title">Usage Note</p>
  6520. <p class="last"><a class="reference external" href="../../../mp11/doc/html/mp11.html">Boost.MP11</a> and <a class="reference external" href="../../../mpl/doc/index.html">Boost.MPL</a> are <strong>not</strong> mutually exclusive. It's
  6521. perfectly acceptable to specify deduced parameters using both quoted
  6522. metafunctions and metafunction classes, for example. See
  6523. <a class="reference external" href="../../test/evaluate_category.cpp">evaluate_category.cpp</a>.</p>
  6524. </div>
  6525. <table class="docutils field-list" frame="void" rules="none">
  6526. <col class="field-name" />
  6527. <col class="field-body" />
  6528. <tbody valign="top">
  6529. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/config.hpp">boost/parameter/config.hpp</a></td>
  6530. </tr>
  6531. <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
  6532. </tr>
  6533. </tbody>
  6534. </table>
  6535. <p>Given the following definitions:</p>
  6536. <pre class="literal-block">
  6537. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(x)
  6538. template &lt;typename A0&gt;
  6539. typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a>&lt;<a class="reference external" href="http://en.cppreference.com/w/cpp/types/is_same">std::is_same</a>&lt;int,A0&gt;,int&gt;::type
  6540. sfinae(A0 const&amp; a0)
  6541. {
  6542. return 0;
  6543. }
  6544. </pre>
  6545. <p><a class="reference external" href="../../../mp11/doc/html/mp11.html">Boost.MP11</a> allows deduced parameters to be defined more succinctly:</p>
  6546. <pre class="literal-block">
  6547. template &lt;typename T, typename Args&gt;
  6548. using predicate = <a class="reference external" href="http://en.cppreference.com/w/cpp/types/is_convertible">std::is_convertible</a>&lt;T,char const*&gt;;
  6549. <a class="reference internal" href="#boost-parameter-function"><tt class="docutils literal">BOOST_PARAMETER_FUNCTION</tt></a>((int), sfinae, tag,
  6550. (deduced
  6551. (optional
  6552. (x
  6553. , *(<a class="reference external" href="../../../mp11/doc/html/mp11.html#mp_quotef">boost::mp11::mp_quote</a>&lt;predicate&gt;)
  6554. , static_cast&lt;char const*&gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  6555. )
  6556. )
  6557. )
  6558. )
  6559. {
  6560. return 1;
  6561. }
  6562. </pre>
  6563. <p>Without <a class="reference external" href="../../../mp11/doc/html/mp11.html">Boost.MP11</a>, deduced parameter definitions tend to be more verbose:</p>
  6564. <pre class="literal-block">
  6565. struct predicate
  6566. {
  6567. template &lt;typename T, typename Args&gt;
  6568. struct apply
  6569. : <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a>&lt;
  6570. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_convertible.html">boost::is_convertible</a>&lt;T,char const*&gt;
  6571. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Still have to convert to a
  6572. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // <a class="reference external" href="../../../mpl/doc/refmanual/integral-constant.html">Boolean Integral Constant</a>.
  6573. &gt;
  6574. {
  6575. };
  6576. };
  6577. <a class="reference internal" href="#boost-parameter-function"><tt class="docutils literal">BOOST_PARAMETER_FUNCTION</tt></a>((int), sfinae, tag,
  6578. (deduced
  6579. (optional
  6580. (x
  6581. , *(predicate)
  6582. , static_cast&lt;char const*&gt;(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
  6583. )
  6584. )
  6585. )
  6586. )
  6587. {
  6588. return 1;
  6589. }
  6590. </pre>
  6591. <p>Either way, the following assertions will succeed:</p>
  6592. <pre class="literal-block">
  6593. assert(1 == sfinae());
  6594. assert(1 == sfinae(&quot;foo&quot;));
  6595. assert(0 == sfinae(1));
  6596. </pre>
  6597. <p>As another example, given the following declarations and definitions:</p>
  6598. <pre class="literal-block">
  6599. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(x)
  6600. <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(y)
  6601. template &lt;typename E, typename Args&gt;
  6602. void check0(E const&amp; e, Args const&amp; args);
  6603. template &lt;typename P, typename E, typename ...Args&gt;
  6604. void check(E const&amp; e, Args const&amp;... args)
  6605. {
  6606. check0(e, P()(args...));
  6607. }
  6608. </pre>
  6609. <p>Argument packs qualify as <a class="reference external" href="../../../mp11/doc/html/mp11.html">Boost.MP11</a>-style lists containing
  6610. <a class="reference internal" href="#keyword-tag-type">keyword tag type</a>s:</p>
  6611. <pre class="literal-block">
  6612. template &lt;typename Args&gt;
  6613. struct some_functor
  6614. {
  6615. template &lt;typename K&gt;
  6616. void operator()(K&amp;&amp;) const
  6617. {
  6618. // K is one of tag::x, tag::y, etc.
  6619. }
  6620. };
  6621. template &lt;typename E, typename Args&gt;
  6622. void check0(E const&amp; e, Args const&amp; args)
  6623. {
  6624. boost::mp11::mp_for_each&lt;E&gt;(some_functor&lt;Args&gt;());
  6625. }
  6626. </pre>
  6627. <p>The first check determines whether or not the argument type of <tt class="docutils literal">_y</tt> is the
  6628. same as the reference type of <tt class="docutils literal">_x</tt>, while the second check determines
  6629. whether or not the argument type of <tt class="docutils literal">_y</tt> is convertible to the value type of
  6630. <tt class="docutils literal">_x</tt>. Here, it's possible to access the reference and value result types of
  6631. indexing an argument pack a little more directly:</p>
  6632. <pre class="literal-block">
  6633. // Use mp_bind on tag::x::binding_fn to access the reference type of _x.
  6634. check&lt;
  6635. <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  6636. tag::x
  6637. , <a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a>&lt;
  6638. <a class="reference internal" href="#deduced"><tt class="docutils literal">deduced</tt></a>&lt;tag::y&gt;
  6639. , <a class="reference external" href="../../../mp11/doc/html/mp11.html#mp_bindf_t">boost::mp11::mp_bind</a>&lt;
  6640. <a class="reference external" href="http://en.cppreference.com/w/cpp/types/is_same">std::is_same</a> // <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>, standard version.
  6641. , <a class="reference external" href="../../../mp11/doc/html/mp11.html#1_9">boost::mp11::_1</a> // will be bound to the argument type of _y.
  6642. , <a class="reference external" href="../../../mp11/doc/html/mp11.html#mp_bindf_t">boost::mp11::mp_bind</a>&lt;
  6643. tag::x::binding_fn
  6644. , <a class="reference external" href="../../../mp11/doc/html/mp11.html#1_9">boost::mp11::_2</a> // will be bound to the argument pack type.
  6645. &gt;
  6646. &gt;
  6647. &gt;
  6648. &gt;
  6649. &gt;((_x = 0, _y = 1), 0, 1);
  6650. // Use mp_bind_q on tag::x to access the value type of _x.
  6651. check&lt;
  6652. <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  6653. tag::x
  6654. , <a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a>&lt;
  6655. <a class="reference internal" href="#deduced"><tt class="docutils literal">deduced</tt></a>&lt;tag::y&gt;
  6656. , <a class="reference external" href="../../../mp11/doc/html/mp11.html#mp_bindf_t">boost::mp11::mp_bind</a>&lt;
  6657. <a class="reference external" href="http://en.cppreference.com/w/cpp/types/is_convertible">std::is_convertible</a> // <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_convertible.html">boost::is_convertible</a>, standard version.
  6658. , <a class="reference external" href="../../../mp11/doc/html/mp11.html#1_9">boost::mp11::_1</a> // will be bound to the argument type of _y.
  6659. , <a class="reference external" href="../../../mp11/doc/html/mp11.html#mp_bind_qq_t">boost::mp11::mp_bind_q</a>&lt;
  6660. tag::x
  6661. , <a class="reference external" href="../../../mp11/doc/html/mp11.html#1_9">boost::mp11::_2</a> // will be bound to the argument pack type.
  6662. &gt;
  6663. &gt;
  6664. &gt;
  6665. &gt;
  6666. &gt;((_x = 0U, _y = 1U), 0U, 1U);
  6667. </pre>
  6668. <p>Argument packs still qualify as <a class="reference external" href="../../../mpl/doc/index.html">Boost.MPL</a>-style lists containing
  6669. <a class="reference internal" href="#keyword-tag-type">keyword tag type</a>s:</p>
  6670. <pre class="literal-block">
  6671. template &lt;typename Args&gt;
  6672. struct some_functor
  6673. {
  6674. template &lt;typename K&gt;
  6675. void operator()(K) const
  6676. {
  6677. // K is one of tag::x, tag::y, etc.
  6678. }
  6679. };
  6680. template &lt;typename E, typename Args&gt;
  6681. void check0(E const&amp; e, Args const&amp; args)
  6682. {
  6683. boost::mpl::for_each&lt;E&gt;(some_functor&lt;Args&gt;());
  6684. }
  6685. </pre>
  6686. <p>However, without <a class="reference external" href="../../../mp11/doc/html/mp11.html">Boost.MP11</a>, the corresponding checks become a little more
  6687. verbose:</p>
  6688. <pre class="literal-block">
  6689. check&lt;
  6690. <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  6691. tag::x
  6692. , <a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a>&lt;
  6693. <a class="reference internal" href="#deduced"><tt class="docutils literal">deduced</tt></a>&lt;tag::y&gt;
  6694. , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a>&lt;
  6695. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a>&lt;
  6696. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/add_lvalue_reference.html">boost::add_lvalue_reference</a>&lt;<a class="reference external" href="../../../mp11/doc/html/mp11.html#1_9">boost::mp11::_1</a>&gt;
  6697. , <a class="reference internal" href="#binding"><tt class="docutils literal">binding</tt></a>&lt;<a class="reference external" href="../../../mp11/doc/html/mp11.html#1_9">boost::mp11::_2</a>, tag::x&gt;
  6698. &gt;
  6699. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Still have to convert to a
  6700. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // <a class="reference external" href="../../../mpl/doc/refmanual/integral-constant.html">Boolean Integral Constant</a>.
  6701. &gt;
  6702. &gt;
  6703. &gt;
  6704. &gt;((_x = 0, _y = 1), 0, 1);
  6705. // Use tag::x::_ or tag::x::_1 to access the value type of _x.
  6706. check&lt;
  6707. <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a>&lt;
  6708. tag::x
  6709. , <a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a>&lt;
  6710. <a class="reference internal" href="#deduced"><tt class="docutils literal">deduced</tt></a>&lt;tag::y&gt;
  6711. , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a>&lt;
  6712. <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_convertible.html">boost::is_convertible</a>&lt;<a class="reference external" href="../../../mp11/doc/html/mp11.html#1_9">boost::mp11::_1</a>, tag::x::_1&gt;
  6713. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Still have to convert to a
  6714. , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // <a class="reference external" href="../../../mpl/doc/refmanual/integral-constant.html">Boolean Integral Constant</a>.
  6715. &gt;
  6716. &gt;
  6717. &gt;
  6718. &gt;((_x = 0U, _y = 1U), 0U, 1U);
  6719. </pre>
  6720. <p>The <a class="reference external" href="../../test/singular.cpp">singular.cpp</a>, <a class="reference external" href="../../test/compose.cpp">compose.cpp</a>, <a class="reference external" href="../../test/optional_deduced_sfinae.cpp">optional_deduced_sfinae.cpp</a>, and
  6721. <a class="reference external" href="../../test/deduced_dependent_predicate.cpp">deduced_dependent_predicate.cpp</a> test programs demonstrate proper usage of this
  6722. macro.</p>
  6723. </div>
  6724. <div class="section" id="id24">
  6725. <span id="boost-parameter-disable-mp11-usage"></span><h2><a class="toc-backref" href="#id85">8.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_DISABLE_MP11_USAGE</tt></a></h2>
  6726. <p>It may be necessary to disable usage of <a class="reference external" href="../../../mp11/doc/html/mp11.html">Boost.MP11</a> for compilers that
  6727. cannot support it. Users can <tt class="docutils literal">#define</tt> this macro either in their project
  6728. settings or before including any library header files. Doing so will leave
  6729. <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> undefined.</p>
  6730. </div>
  6731. <div class="section" id="id25">
  6732. <span id="boost-parameter-variadic-mpl-sequence"></span><h2><a class="toc-backref" href="#id86">8.5&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE</tt></a></h2>
  6733. <p>If <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is <tt class="docutils literal">#defined</tt>, then determines
  6734. the <a class="reference external" href="../../../mpl/doc/refmanual/variadic-sequence.html">MPL Variadic Sequence</a> underlying the nested <tt class="docutils literal">parameter_spec</tt> type of
  6735. <tt class="docutils literal">parameters</tt>. If the user does not manually <tt class="docutils literal">#define</tt> this macro, then the
  6736. library will <tt class="docutils literal">#define</tt> it as <a class="reference external" href="../../../mp11/doc/html/mp11.html#mp_listt"><tt class="docutils literal"><span class="pre">boost::mp11::mp_list</span></tt></a> if
  6737. <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> is defined, <a class="reference external" href="../../../fusion/doc/html/fusion/container/list.html"><tt class="docutils literal"><span class="pre">boost::fusion::list</span></tt></a> if
  6738. <a class="reference external" href="../../../../boost/fusion/container/list/list_fwd.hpp"><tt class="docutils literal">BOOST_FUSION_HAS_VARIADIC_LIST</tt></a> is defined (by <a class="reference external" href="../../../fusion/doc/html/index.html">Boost.Fusion</a>),
  6739. <a class="reference external" href="../../../fusion/doc/html/fusion/container/deque.html"><tt class="docutils literal"><span class="pre">boost::fusion::deque</span></tt></a> if <a class="reference external" href="../../../../boost/fusion/container/deque/deque_fwd.hpp"><tt class="docutils literal">BOOST_FUSION_HAS_VARIADIC_DEQUE</tt></a> is defined
  6740. (by <a class="reference external" href="../../../fusion/doc/html/index.html">Boost.Fusion</a>), or <a class="reference external" href="../../../mpl/doc/refmanual/vector.html"><tt class="docutils literal"><span class="pre">boost::mpl::vector</span></tt></a> otherwise.</p>
  6741. <table class="docutils field-list" frame="void" rules="none">
  6742. <col class="field-name" />
  6743. <col class="field-body" />
  6744. <tbody valign="top">
  6745. <tr class="field"><th class="field-name">Example:</th><td class="field-body"></td>
  6746. </tr>
  6747. </tbody>
  6748. </table>
  6749. <pre class="literal-block">
  6750. #define BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE <a class="reference external" href="../../../fusion/doc/html/fusion/container/vector.html"><tt class="docutils literal"><span class="pre">boost::fusion::vector</span></tt></a>
  6751. </pre>
  6752. <table class="docutils field-list" frame="void" rules="none">
  6753. <col class="field-name" />
  6754. <col class="field-body" />
  6755. <tbody valign="top">
  6756. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/parameters.hpp">boost/parameter/parameters.hpp</a></td>
  6757. </tr>
  6758. </tbody>
  6759. </table>
  6760. </div>
  6761. <div class="section" id="id26">
  6762. <span id="boost-parameter-max-arity"></span><h2><a class="toc-backref" href="#id87">8.6&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_MAX_ARITY</tt></a></h2>
  6763. <p>If <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is <tt class="docutils literal">#defined</tt>, then:</p>
  6764. <ul class="simple">
  6765. <li>If the <a class="reference external" href="../../../mpl/doc/refmanual/variadic-sequence.html">MPL Variadic Sequence</a> underlying the nested <tt class="docutils literal">parameter_spec</tt>
  6766. type of <tt class="docutils literal">parameters</tt> does not have a size limit--which is the case with
  6767. <a class="reference external" href="../../../mp11/doc/html/mp11.html#mp_listt"><tt class="docutils literal"><span class="pre">boost::mp11::mp_list</span></tt></a>, <a class="reference external" href="../../../fusion/doc/html/fusion/container/list.html"><tt class="docutils literal"><span class="pre">boost::fusion::list</span></tt></a>, and <a class="reference external" href="../../../fusion/doc/html/fusion/container/deque.html"><tt class="docutils literal"><span class="pre">boost::fusion::deque</span></tt></a>, but not
  6768. <a class="reference external" href="../../../mpl/doc/refmanual/vector.html"><tt class="docutils literal"><span class="pre">boost::mpl::vector</span></tt></a>--then this macro can be safely ignored. User code that
  6769. manually defines <a class="reference internal" href="#boost-parameter-variadic-mpl-sequence"><tt class="docutils literal">BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE</tt></a> should also
  6770. manually define this macro to the size limit of the sequence if it has
  6771. one.</li>
  6772. </ul>
  6773. <p>If <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is <strong>not</strong> <tt class="docutils literal">#defined</tt>, then:</p>
  6774. <ul class="simple">
  6775. <li>Mutable references must be wrapped by <a class="reference external" href="../../../core/doc/html/core/ref.html"><tt class="docutils literal"><span class="pre">boost::ref</span></tt></a> or <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/functional/ref"><tt class="docutils literal"><span class="pre">std::ref</span></tt></a> if passed
  6776. by position to Boost.Parameter-enabled functions with arity greater than
  6777. or equal to <a class="reference internal" href="#boost-parameter-exponential-overload-threshold-arity"><tt class="docutils literal">BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY</tt></a>.</li>
  6778. </ul>
  6779. <table class="docutils field-list" frame="void" rules="none">
  6780. <col class="field-name" />
  6781. <col class="field-body" />
  6782. <tbody valign="top">
  6783. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/config.hpp">boost/parameter/config.hpp</a></td>
  6784. </tr>
  6785. <tr class="field"><th class="field-name">Default Value:</th><td class="field-body"><a class="reference external" href="../../../mpl/doc/refmanual/limit-vector-size.html"><tt class="docutils literal">BOOST_MPL_LIMIT_VECTOR_SIZE</tt></a> (defined by <a class="reference external" href="../../../mpl/doc/index.html">Boost.MPL</a>) if
  6786. perfect forwarding is supported, <tt class="docutils literal">8</tt> otherwise.</td>
  6787. </tr>
  6788. <tr class="field"><th class="field-name">Minimum Value:</th><td class="field-body"><tt class="docutils literal">2</tt></td>
  6789. </tr>
  6790. <tr class="field"><th class="field-name">Maximum Value:</th><td class="field-body"><a class="reference internal" href="#boost-parameter-compose-max-arity"><tt class="docutils literal">BOOST_PARAMETER_COMPOSE_MAX_ARITY</tt></a></td>
  6791. </tr>
  6792. </tbody>
  6793. </table>
  6794. </div>
  6795. <div class="section" id="id27">
  6796. <span id="boost-parameter-compose-max-arity"></span><h2><a class="toc-backref" href="#id88">8.7&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_COMPOSE_MAX_ARITY</tt></a></h2>
  6797. <p>If <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is <strong>not</strong> <tt class="docutils literal">#defined</tt>, then
  6798. determines the maximum number of arguments supported by the <tt class="docutils literal">compose</tt> function
  6799. and by the <a class="reference internal" href="#boost-parameter-no-spec-function"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_FUNCTION</tt></a>,
  6800. <a class="reference internal" href="#boost-parameter-no-spec-member-function"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION</tt></a>,
  6801. <a class="reference internal" href="#boost-parameter-no-spec-const-member-function"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION</tt></a>,
  6802. <a class="reference internal" href="#boost-parameter-no-spec-function-call-operator"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR</tt></a>,
  6803. <a class="reference internal" href="#boost-parameter-no-spec-const-function-call-operator"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR</tt></a>,
  6804. <a class="reference internal" href="#boost-parameter-no-spec-constructor"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR</tt></a>, and
  6805. <a class="reference internal" href="#boost-parameter-no-spec-no-base-constructor"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR</tt></a> code generation macros.</p>
  6806. <table class="docutils field-list" frame="void" rules="none">
  6807. <col class="field-name" />
  6808. <col class="field-body" />
  6809. <tbody valign="top">
  6810. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/config.hpp">boost/parameter/config.hpp</a></td>
  6811. </tr>
  6812. <tr class="field"><th class="field-name">Default Value:</th><td class="field-body"><tt class="docutils literal">20</tt> for a few older compilers, <tt class="docutils literal">64</tt> otherwise</td>
  6813. </tr>
  6814. <tr class="field"><th class="field-name">Minimum Value:</th><td class="field-body"><tt class="docutils literal">2</tt></td>
  6815. </tr>
  6816. </tbody>
  6817. </table>
  6818. </div>
  6819. <div class="section" id="id28">
  6820. <span id="boost-parameter-exponential-overload-threshold-arity"></span><h2><a class="toc-backref" href="#id89">8.8&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY</tt></a></h2>
  6821. <p>If this library does <strong>not</strong> support perfect forwarding, determines the number
  6822. of arguments less than which <tt class="docutils literal">parameters</tt> generates an exponential number of
  6823. function call operator overloads, and greater than or equal to which
  6824. <tt class="docutils literal">parameters</tt> does not. Will only be <tt class="docutils literal">#defined</tt> by the library if it is
  6825. not already <tt class="docutils literal">#defined</tt> and <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is
  6826. <strong>not</strong> <tt class="docutils literal">#defined</tt>.</p>
  6827. <table class="docutils field-list" frame="void" rules="none">
  6828. <col class="field-name" />
  6829. <col class="field-body" />
  6830. <tbody valign="top">
  6831. <tr class="field"><th class="field-name">Defined in:</th><td class="field-body"><a class="reference external" href="../../../../boost/parameter/config.hpp">boost/parameter/config.hpp</a></td>
  6832. </tr>
  6833. <tr class="field"><th class="field-name">Default Value:</th><td class="field-body"><tt class="docutils literal">0</tt></td>
  6834. </tr>
  6835. <tr class="field"><th class="field-name">Minimum Value:</th><td class="field-body"><tt class="docutils literal">0</tt></td>
  6836. </tr>
  6837. </tbody>
  6838. </table>
  6839. </div>
  6840. <div class="section" id="outside-of-this-library">
  6841. <h2><a class="toc-backref" href="#id90">8.9&nbsp;&nbsp;&nbsp;...Outside Of This Library</a></h2>
  6842. <ol class="arabic simple">
  6843. <li>If <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a> defines the macro
  6844. <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__03_defects"><tt class="docutils literal">BOOST_NO_FUNCTION_TEMPLATE_ORDERING</tt></a>, then the macros
  6845. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> and
  6846. <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> will be left undefined; otherwise, the
  6847. code generation macros would not work correctly.</li>
  6848. <li>If <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a> defines the macro <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__03_defects"><tt class="docutils literal">BOOST_NO_SFINAE</tt></a>, then the macros
  6849. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> and
  6850. <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> will be left undefined; otherwise, keyword
  6851. types generated by <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a> and
  6852. <a class="reference internal" href="#boost-parameter-nested-keyword"><tt class="docutils literal">BOOST_PARAMETER_NESTED_KEYWORD</tt></a> would not work correctly.</li>
  6853. <li>If <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a> defines the macro
  6854. <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_RVALUE_REFERENCES</tt></a>, then the macros
  6855. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> and
  6856. <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> will be left undefined.</li>
  6857. <li>If <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a> defines the macro <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_VARIADIC_TEMPLATES</tt></a>,
  6858. then the macros <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> and
  6859. <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> will be left undefined.</li>
  6860. <li>If <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a> defines the macro
  6861. <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS</tt></a>, then the macros
  6862. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> and
  6863. <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> will be left undefined.</li>
  6864. <li>If <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a> defines the macro <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_CONSTEXPR</tt></a>, then the
  6865. macro <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> will be left undefined.</li>
  6866. <li>If <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a> defines the macro <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_DECLTYPE_N3276</tt></a>,
  6867. then the macro <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> will be left undefined.</li>
  6868. <li>If <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a> defines the macro <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_AUTO_DECLARATIONS</tt></a>,
  6869. then the macro <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> will be left undefined.</li>
  6870. <li>If <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a> defines the macro <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_TEMPLATE_ALIASES</tt></a>,
  6871. then the macro <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> will be left undefined.</li>
  6872. <li>If <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a> defines the macro <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_STATIC_ASSERT</tt></a>, then
  6873. the macro <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> will be left undefined.</li>
  6874. <li>If <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a> defines the macro <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_HDR_TYPE_TRAITS</tt></a>,
  6875. then the macro <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> will be left undefined.</li>
  6876. <li>If <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a> defines the macro
  6877. <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_HDR_INITIALIZER_LIST</tt></a>, then the macro
  6878. <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> will be left undefined.</li>
  6879. <li>If <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a> defines the macro <a class="reference external" href="../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported"><tt class="docutils literal">BOOST_NO_CXX11_HDR_TUPLE</tt></a>, then the
  6880. macro <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> will be left undefined.</li>
  6881. <li>If <a class="reference external" href="../../../fusion/doc/html/index.html">Boost.Fusion</a> defines the macro <a class="reference external" href="../../../../boost/fusion/container/list/list_fwd.hpp"><tt class="docutils literal">BOOST_FUSION_HAS_VARIADIC_LIST</tt></a>,
  6882. if this library defines the macro
  6883. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a>, and if
  6884. <a class="reference internal" href="#boost-parameter-variadic-mpl-sequence"><tt class="docutils literal">BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE</tt></a> is left undefined, then the
  6885. <a class="reference external" href="../../../mpl/doc/refmanual/variadic-sequence.html">MPL Variadic Sequence</a> underlying the nested <tt class="docutils literal">parameter_spec</tt> type of
  6886. <tt class="docutils literal">parameters</tt> will be <a class="reference external" href="../../../fusion/doc/html/fusion/container/list.html"><tt class="docutils literal"><span class="pre">boost::fusion::list</span></tt></a>.</li>
  6887. <li>If <a class="reference external" href="../../../fusion/doc/html/index.html">Boost.Fusion</a> defines the macro <a class="reference external" href="../../../../boost/fusion/container/deque/deque_fwd.hpp"><tt class="docutils literal">BOOST_FUSION_HAS_VARIADIC_DEQUE</tt></a>,
  6888. if this library defines the macro
  6889. <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a>, and if
  6890. <a class="reference internal" href="#boost-parameter-variadic-mpl-sequence"><tt class="docutils literal">BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE</tt></a> is left undefined, then the
  6891. <a class="reference external" href="../../../mpl/doc/refmanual/variadic-sequence.html">MPL Variadic Sequence</a> underlying the nested <tt class="docutils literal">parameter_spec</tt> type of
  6892. <tt class="docutils literal">parameters</tt> will be <a class="reference external" href="../../../fusion/doc/html/fusion/container/deque.html"><tt class="docutils literal"><span class="pre">boost::fusion::deque</span></tt></a>.</li>
  6893. <li>The value that <a class="reference external" href="../../../mpl/doc/index.html">Boost.MPL</a> defines the macro
  6894. <a class="reference external" href="../../../mpl/doc/refmanual/limit-vector-size.html"><tt class="docutils literal">BOOST_MPL_LIMIT_VECTOR_SIZE</tt></a> as will be the value that this library
  6895. defines the macro <a class="reference internal" href="#boost-parameter-max-arity"><tt class="docutils literal">BOOST_PARAMETER_MAX_ARITY</tt></a> as if this library defines
  6896. the macro <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a>.</li>
  6897. </ol>
  6898. </div>
  6899. </div>
  6900. <div class="section" id="tutorial">
  6901. <h1><a class="toc-backref" href="#id91">9&nbsp;&nbsp;&nbsp;Tutorial</a></h1>
  6902. <p>Follow <a class="reference external" href="index.html#tutorial">this link</a> to the Boost.Parameter tutorial documentation.</p>
  6903. <hr class="docutils" />
  6904. <table class="docutils footnote" frame="void" id="thread" rules="none">
  6905. <colgroup><col class="label" /><col /></colgroup>
  6906. <tbody valign="top">
  6907. <tr><td class="label"><a class="fn-backref" href="#id2">[1]</a></td><td>References to tag objects may be initialized multiple
  6908. times. This scenario can only occur in the presence of
  6909. threading. Because the C++ standard doesn't consider threading,
  6910. it doesn't explicitly allow or forbid multiple initialization of
  6911. references. That said, it's hard to imagine an implementation
  6912. where it could make a difference.</td></tr>
  6913. </tbody>
  6914. </table>
  6915. <table class="docutils footnote" frame="void" id="no-result-of" rules="none">
  6916. <colgroup><col class="label" /><col /></colgroup>
  6917. <tbody valign="top">
  6918. <tr><td class="label">[2]</td><td><em>(<a class="fn-backref" href="#id6">1</a>, <a class="fn-backref" href="#id12">2</a>, <a class="fn-backref" href="#id15">3</a>)</em> Where <a class="reference external" href="../../../utility/utility.htm#BOOST_NO_RESULT_OF"><tt class="docutils literal">BOOST_NO_RESULT_OF</tt></a> is <tt class="docutils literal">#defined</tt>,
  6919. <a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal"><span class="pre">boost::result_of</span></tt></a><tt class="docutils literal"><span class="pre">&lt;F()&gt;::type</span></tt> is replaced by <tt class="docutils literal"><span class="pre">F::result_type</span></tt>.</td></tr>
  6920. </tbody>
  6921. </table>
  6922. </div>
  6923. </div>
  6924. <div class="footer">
  6925. <hr class="footer" />
  6926. Generated on: 2019-12-10 00:22 UTC.
  6927. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
  6928. </div>
  6929. </body>
  6930. </html>