123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314 |
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="generator" content="Docutils 0.12: http://docutils.sourceforge.net/" />
- <title>The Boost Parameter Library Reference Documentation</title>
- <meta name="authors" content="David Abrahams Daniel Wallin" />
- <meta name="organization" content="BoostPro Computing" />
- <meta name="date" content="2005-07-17" />
- <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)" />
- <link rel="stylesheet" href="rst.css" type="text/css" />
- </head>
- <body>
- <div class="document" id="the-boost-parameter-library-reference-documentation">
- <h1 class="title">The Boost Parameter Library Reference Documentation</h1>
- <table class="docinfo" frame="void" rules="none">
- <col class="docinfo-name" />
- <col class="docinfo-content" />
- <tbody valign="top">
- <tr><th class="docinfo-name">Authors:</th>
- <td>David Abrahams
- <br />Daniel Wallin</td></tr>
- <tr><th class="docinfo-name">Contact:</th>
- <td><a class="first reference external" href="mailto:dave@boost-consulting.com">dave@boost-consulting.com</a>, <a class="last reference external" href="mailto:daniel@boostpro.com">daniel@boostpro.com</a></td></tr>
- <tr><th class="docinfo-name">Organization:</th>
- <td><a class="first last reference external" href="http://www.boostpro.com">BoostPro Computing</a></td></tr>
- <tr><th class="docinfo-name">Date:</th>
- <td>2005-07-17</td></tr>
- <tr><th class="docinfo-name">Copyright:</th>
- <td>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 <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</td></tr>
- </tbody>
- </table>
- <p><a class="reference external" href="../../../../index.htm"><img alt="Boost" src="../../../../boost.png" /></a></p>
- <hr class="docutils" />
- <div class="contents topic" id="contents">
- <p class="topic-title first">Contents</p>
- <ul class="auto-toc simple">
- <li><a class="reference internal" href="#preliminaries" id="id31">1 Preliminaries</a><ul class="auto-toc">
- <li><a class="reference internal" href="#namespaces" id="id32">1.1 Namespaces</a></li>
- <li><a class="reference internal" href="#exceptions" id="id33">1.2 Exceptions</a></li>
- <li><a class="reference internal" href="#thread-safety" id="id34">1.3 Thread Safety</a></li>
- <li><a class="reference internal" href="#typography" id="id35">1.4 Typography</a></li>
- </ul>
- </li>
- <li><a class="reference internal" href="#terminology" id="id36">2 Terminology</a></li>
- <li><a class="reference internal" href="#concepts" id="id37">3 Concepts</a><ul class="auto-toc">
- <li><a class="reference internal" href="#argumentpack" id="id38">3.1 <span class="concept">ArgumentPack</span></a></li>
- <li><a class="reference internal" href="#id3" id="id39">3.2 <span class="concept">ParameterSpec</span></a></li>
- </ul>
- </li>
- <li><a class="reference internal" href="#class-templates" id="id40">4 Class Templates</a><ul class="auto-toc">
- <li><a class="reference internal" href="#id5" id="id41">4.1 <tt class="docutils literal">keyword</tt></a></li>
- <li><a class="reference internal" href="#id7" id="id42">4.2 <tt class="docutils literal">template_keyword</tt></a></li>
- <li><a class="reference internal" href="#id8" id="id43">4.3 <tt class="docutils literal">parameters</tt></a></li>
- <li><a class="reference internal" href="#optional-required" id="id44">4.4 <tt class="docutils literal">optional</tt>, <tt class="docutils literal">required</tt></a></li>
- <li><a class="reference internal" href="#id9" id="id45">4.5 <tt class="docutils literal">deduced</tt></a></li>
- </ul>
- </li>
- <li><a class="reference internal" href="#metafunctions" id="id46">5 Metafunctions</a><ul class="auto-toc">
- <li><a class="reference internal" href="#id10" id="id47">5.1 <tt class="docutils literal">binding</tt></a></li>
- <li><a class="reference internal" href="#id11" id="id48">5.2 <tt class="docutils literal">lazy_binding</tt></a></li>
- <li><a class="reference internal" href="#id13" id="id49">5.3 <tt class="docutils literal">value_type</tt></a></li>
- <li><a class="reference internal" href="#id14" id="id50">5.4 <tt class="docutils literal">lazy_value_type</tt></a></li>
- <li><a class="reference internal" href="#id16" id="id51">5.5 <tt class="docutils literal">are_tagged_arguments</tt></a></li>
- <li><a class="reference internal" href="#id17" id="id52">5.6 <tt class="docutils literal">is_argument_pack</tt></a></li>
- <li><a class="reference internal" href="#id18" id="id53">5.7 <tt class="docutils literal"><span class="pre">result_of::compose</span></tt></a></li>
- </ul>
- </li>
- <li><a class="reference internal" href="#function-templates" id="id54">6 Function Templates</a><ul class="auto-toc">
- <li><a class="reference internal" href="#id19" id="id55">6.1 <tt class="docutils literal">compose</tt></a></li>
- </ul>
- </li>
- <li><a class="reference internal" href="#code-generation-macros" id="id56">7 Code Generation Macros</a><ul class="auto-toc">
- <li><a class="reference internal" href="#boost-parameter-function-result-name-tag-namespace-arguments" id="id57">7.1 <tt class="docutils literal">BOOST_PARAMETER_FUNCTION(result, name, tag_namespace, arguments)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-member-function-result-name-tag-namespace-arguments" id="id58">7.2 <tt class="docutils literal">BOOST_PARAMETER_MEMBER_FUNCTION(result, name, tag_namespace, arguments)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-const-member-function-result-name-tag-ns-arguments" id="id59">7.3 <tt class="docutils literal">BOOST_PARAMETER_CONST_MEMBER_FUNCTION(result, name, tag_ns, arguments)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-function-call-operator-result-tag-namespace-arguments" id="id60">7.4 <tt class="docutils literal">BOOST_PARAMETER_FUNCTION_CALL_OPERATOR(result, tag_namespace, arguments)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-const-function-call-operator-result-tag-ns-arguments" id="id61">7.5 <tt class="docutils literal">BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, arguments)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-constructor-cls-impl-tag-namespace-arguments" id="id62">7.6 <tt class="docutils literal">BOOST_PARAMETER_CONSTRUCTOR(cls, impl, tag_namespace, arguments)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-basic-function-result-name-tag-namespace-arguments" id="id63">7.7 <tt class="docutils literal">BOOST_PARAMETER_BASIC_FUNCTION(result, name, tag_namespace, arguments)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-basic-member-function-result-name-tag-ns-arguments" id="id64">7.8 <tt class="docutils literal">BOOST_PARAMETER_BASIC_MEMBER_FUNCTION(result, name, tag_ns, arguments)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-basic-const-member-function-result-name-tag-ns-args" id="id65">7.9 <tt class="docutils literal">BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION(result, name, tag_ns, args)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-basic-function-call-operator-result-tag-ns-arguments" id="id66">7.10 <tt class="docutils literal">BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR(result, tag_ns, arguments)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-basic-const-function-call-operator-result-tag-ns-args" id="id67">7.11 <tt class="docutils literal">BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, args)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-no-spec-function-result-name" id="id68">7.12 <tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_FUNCTION(result, name)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-no-spec-member-function-result-name" id="id69">7.13 <tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION(result, name)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-no-spec-const-member-function-result-name" id="id70">7.14 <tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION(result, name)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-no-spec-function-call-operator-result" id="id71">7.15 <tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR(result)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-no-spec-const-function-call-operator-result" id="id72">7.16 <tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR(result)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-no-spec-constructor-cls-impl" id="id73">7.17 <tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(cls, impl)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-no-spec-no-base-constructor-cls-impl" id="id74">7.18 <tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(cls, impl)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-name-name" id="id75">7.19 <tt class="docutils literal">BOOST_PARAMETER_NAME(name)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-nested-keyword-tag-namespace-name-alias" id="id76">7.20 <tt class="docutils literal">BOOST_PARAMETER_NESTED_KEYWORD(tag_namespace, name, alias)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-template-keyword-name" id="id77">7.21 <tt class="docutils literal">BOOST_PARAMETER_TEMPLATE_KEYWORD(name)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-fun-r-n-l-h-p" id="id78">7.22 <tt class="docutils literal">BOOST_PARAMETER_FUN(r, n, l, h, p)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-keyword-n-k" id="id79">7.23 <tt class="docutils literal">BOOST_PARAMETER_KEYWORD(n, k)</tt></a></li>
- <li><a class="reference internal" href="#boost-parameter-match-p-a-x" id="id80">7.24 <tt class="docutils literal">BOOST_PARAMETER_MATCH(p, a, x)</tt></a></li>
- </ul>
- </li>
- <li><a class="reference internal" href="#configuration-macros" id="id81">8 Configuration Macros</a><ul class="auto-toc">
- <li><a class="reference internal" href="#id21" id="id82">8.1 <tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a></li>
- <li><a class="reference internal" href="#id22" id="id83">8.2 <tt class="docutils literal">BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING</tt></a></li>
- <li><a class="reference internal" href="#id23" id="id84">8.3 <tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a></li>
- <li><a class="reference internal" href="#id24" id="id85">8.4 <tt class="docutils literal">BOOST_PARAMETER_DISABLE_MP11_USAGE</tt></a></li>
- <li><a class="reference internal" href="#id25" id="id86">8.5 <tt class="docutils literal">BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE</tt></a></li>
- <li><a class="reference internal" href="#id26" id="id87">8.6 <tt class="docutils literal">BOOST_PARAMETER_MAX_ARITY</tt></a></li>
- <li><a class="reference internal" href="#id27" id="id88">8.7 <tt class="docutils literal">BOOST_PARAMETER_COMPOSE_MAX_ARITY</tt></a></li>
- <li><a class="reference internal" href="#id28" id="id89">8.8 <tt class="docutils literal">BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY</tt></a></li>
- <li><a class="reference internal" href="#outside-of-this-library" id="id90">8.9 ...Outside Of This Library</a></li>
- </ul>
- </li>
- <li><a class="reference internal" href="#tutorial" id="id91">9 Tutorial</a></li>
- </ul>
- </div>
- <hr class="docutils" />
- <div class="section" id="preliminaries">
- <h1><a class="toc-backref" href="#id31">1 Preliminaries</a></h1>
- <p>This section covers some basic information you'll need to know in order to
- understand this reference.</p>
- <div class="section" id="namespaces">
- <h2><a class="toc-backref" href="#id32">1.1 Namespaces</a></h2>
- <p>In this document, all unqualified identifiers should be assumed to be defined
- in namespace <tt class="docutils literal"><span class="pre">boost::parameter</span></tt> unless otherwise specified.</p>
- </div>
- <div class="section" id="exceptions">
- <h2><a class="toc-backref" href="#id33">1.2 Exceptions</a></h2>
- <p>No operation described in this document throws an exception unless otherwise
- specified.</p>
- </div>
- <div class="section" id="thread-safety">
- <h2><a class="toc-backref" href="#id34">1.3 Thread Safety</a></h2>
- <p>All components of this library can be used safely from multiple threads
- without synchronization.<a class="footnote-reference" href="#thread" id="id2"><sup>1</sup></a></p>
- </div>
- <div class="section" id="typography">
- <h2><a class="toc-backref" href="#id35">1.4 Typography</a></h2>
- <p>Names written in <span class="concept">sans serif type</span> represent <a class="reference internal" href="#concepts">concepts</a>.</p>
- <p>In code blocks, <em>italic type</em> represents unspecified text that satisfies the
- requirements given in the detailed description that follows the code block.</p>
- <p>In a specification of the tokens generated by a macro, <strong>bold type</strong> is used
- to highlight the position of the expanded macro argument in the result.</p>
- <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>
- </div>
- </div>
- <hr class="docutils" />
- <div class="section" id="terminology">
- <h1><a class="toc-backref" href="#id36">2 Terminology</a></h1>
- <dl class="docutils" id="kw">
- <dt>keyword</dt>
- <dd>The name of a function parameter.</dd>
- </dl>
- <span class="target" id="keyword-tag-type"></span><dl class="docutils">
- <dt>keyword tag type</dt>
- <dd>A type used to uniquely identify a function parameter. Typically its name
- will be the same as that of the parameter.</dd>
- </dl>
- <span class="target" id="positional"></span><dl class="docutils">
- <dt>positional argument</dt>
- <dd>An argument passed with no explicit keyword. Its parameter is determined
- in the usual C++ way: by position with respect to a parameter list.</dd>
- </dl>
- <span class="target" id="tag-type"></span><dl class="docutils">
- <dt>tag type</dt>
- <dd>Shorthand for “<a class="reference internal" href="#keyword-tag-type">keyword tag type</a>.”</dd>
- </dl>
- <span class="target" id="keyword-object"></span><dl class="docutils">
- <dt>keyword object</dt>
- <dd>An instance of <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><tt class="docutils literal"><T></tt> for some <a class="reference internal" href="#tag-type">tag type</a> <tt class="docutils literal">T</tt>.</dd>
- </dl>
- <span class="target" id="tagged-reference"></span><dl class="docutils">
- <dt>tagged reference</dt>
- <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
- <em>keyword</em>), and that holds a reference (to the object's <em>value</em>).</p>
- <p class="last">As a shorthand, a “tagged reference to <tt class="docutils literal">x</tt>” means a tagged reference
- whose <em>value</em> is <tt class="docutils literal">x</tt>.</p>
- </dd>
- </dl>
- <span class="target" id="tagged-default"></span><dl class="docutils">
- <dt>tagged default</dt>
- <dd>A <a class="reference internal" href="#tagged-reference">tagged reference</a> whose <em>value</em> represents the value of a
- default argument.</dd>
- </dl>
- <span class="target" id="tagged-lazy-default"></span><dl class="docutils">
- <dt>tagged lazy default</dt>
- <dd>A <a class="reference internal" href="#tagged-reference">tagged reference</a> whose <em>value</em>, when invoked with no arguments,
- computes a default argument value.</dd>
- </dl>
- <span class="target" id="intended-argument-type"></span><dl class="docutils">
- <dt>intended argument type</dt>
- <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
- type of its element's <em>value</em>. The intended argument type of any other
- type <tt class="docutils literal">X</tt> is <tt class="docutils literal">X</tt> itself.</dd>
- </dl>
- <div class="note">
- <p class="first admonition-title">Note</p>
- <p class="last">In this reference, we will use concept names (and other names) to describe
- both types and objects, depending on context. So for example, “an
- <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>
- <em>or</em> an object of such a type.</p>
- </div>
- </div>
- <hr class="docutils" />
- <div class="section" id="concepts">
- <h1><a class="toc-backref" href="#id37">3 Concepts</a></h1>
- <p>This section describes the generic type concepts used by the Parameter
- library.</p>
- <div class="section" id="argumentpack">
- <h2><a class="toc-backref" href="#id38">3.1 <span class="concept">ArgumentPack</span></a></h2>
- <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
- 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
- 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>
- 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
- 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
- <a class="reference external" href="../../test/mpl.cpp">mpl.cpp</a> test programs demonstrate this functionality.</p>
- <div class="section" id="requirements">
- <h3>Requirements</h3>
- <p>In the table below,</p>
- <ul class="simple">
- <li><tt class="docutils literal">A</tt> is a model of <span class="concept">ArgumentPack</span></li>
- <li><tt class="docutils literal">x</tt> is an instance of <tt class="docutils literal">A</tt></li>
- <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>
- <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>
- <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>
- <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"><…>::operator=</span></tt>)</li>
- </ul>
- <p>Any exceptions thrown from the invocation of <tt class="docutils literal">w</tt>'s <em>value</em>
- will be propagated to the caller.</p>
- <table border="1" class="docutils">
- <caption><span class="concept">ArgumentPack</span> requirements</caption>
- <colgroup>
- <col width="14%" />
- <col width="40%" />
- <col width="19%" />
- <col width="27%" />
- </colgroup>
- <thead valign="bottom">
- <tr><th class="head">Expression</th>
- <th class="head">Type</th>
- <th class="head">Requirements</th>
- <th class="head">Semantics/Notes</th>
- </tr>
- </thead>
- <tbody valign="top">
- <tr><td><tt class="docutils literal">x[u]</tt></td>
- <td><tt class="docutils literal">binding<A, <span class="pre">K>::type</span></tt></td>
- <td><tt class="docutils literal">x</tt> contains
- an element <em>b</em>
- whose <a class="reference internal" href="#kw">keyword</a> is
- <tt class="docutils literal">K</tt></td>
- <td>Returns <em>b</em>'s
- <em>value</em> (by
- reference).</td>
- </tr>
- <tr><td><tt class="docutils literal">x[u]</tt></td>
- <td><tt class="docutils literal">binding<A, L, <span class="pre">D>::type</span></tt></td>
- <td><em>none</em></td>
- <td>If <tt class="docutils literal">x</tt> contains an
- element <em>b</em> whose
- <a class="reference internal" href="#kw">keyword</a> is the same as
- <tt class="docutils literal">u</tt>'s, returns
- <em>b</em>'s <em>value</em> (by
- reference).
- Otherwise, returns
- <tt class="docutils literal">u</tt>'s <em>value</em>.</td>
- </tr>
- <tr><td><tt class="docutils literal">x[w]</tt></td>
- <td><tt class="docutils literal">lazy_binding<A, M, <span class="pre">E>::type</span></tt></td>
- <td><em>none</em></td>
- <td>If <tt class="docutils literal">x</tt> contains an
- element <em>b</em> whose
- <a class="reference internal" href="#kw">keyword</a> is the same as
- <tt class="docutils literal">w</tt>'s, returns
- <em>b</em>'s <em>value</em> (by
- reference).
- Otherwise, invokes
- <tt class="docutils literal">w</tt>'s <em>value</em>
- and returns the
- result.</td>
- </tr>
- <tr><td><tt class="docutils literal">x, z</tt></td>
- <td>Model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a></td>
- <td><em>none</em></td>
- <td>Returns an
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>
- containing all the
- elements of both
- <tt class="docutils literal">x</tt> and <tt class="docutils literal">z</tt>.</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div class="section" id="id3">
- <span id="parameterspec"></span><h2><a class="toc-backref" href="#id39">3.2 <span class="concept">ParameterSpec</span></a></h2>
- <p>A <span class="concept">ParameterSpec</span> describes the type requirements for arguments corresponding
- to a given <a class="reference internal" href="#kw">keyword</a> and indicates whether the argument is optional or
- required. The table below details the allowed forms and describes their
- condition for satisfaction by an actual argument type. In each row,</p>
- <ul class="simple" id="conditions">
- <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>
- <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>
- <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>
- <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>
- </ul>
- <table border="1" class="docutils">
- <caption><span class="concept">ParameterSpec</span> allowed forms and conditions of satisfaction</caption>
- <colgroup>
- <col width="32%" />
- <col width="14%" />
- <col width="54%" />
- </colgroup>
- <thead valign="bottom">
- <tr><th class="head">Type</th>
- <th class="head"><tt class="docutils literal">A</tt>
- required</th>
- <th class="head">Condition <tt class="docutils literal">A</tt> must satisfy</th>
- </tr>
- </thead>
- <tbody valign="top">
- <tr><td><tt class="docutils literal">K</tt></td>
- <td>no</td>
- <td><em>n/a</em></td>
- </tr>
- <tr><td><a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a><tt class="docutils literal"><K,F></tt></td>
- <td>no</td>
- <td><tt class="docutils literal"><span class="pre">mpl::apply2<F,A,P>::type::value</span></tt> is
- <tt class="docutils literal">true</tt>.</td>
- </tr>
- <tr><td><a class="reference internal" href="#required"><tt class="docutils literal">required</tt></a><tt class="docutils literal"><K,F></tt></td>
- <td>yes</td>
- <td><tt class="docutils literal"><span class="pre">mpl::apply2<F,A,P>::type::value</span></tt> is
- <tt class="docutils literal">true</tt>.</td>
- </tr>
- </tbody>
- </table>
- <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
- will be matched by <a class="reference external" href="index.html#forwarding-functions">forwarding functions</a>.</p>
- </div>
- </div>
- <hr class="docutils" />
- <div class="section" id="class-templates">
- <h1><a class="toc-backref" href="#id40">4 Class Templates</a></h1>
- <div class="section" id="id5">
- <span id="keyword"></span><h2><a class="toc-backref" href="#id41">4.1 <tt class="docutils literal">keyword</tt></a></h2>
- <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>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename Tag>
- struct keyword
- {
- typedef Tag tag;
- template <typename T>
- constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_scalar.html">boost::is_scalar</a><T>
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for scalar types.
- , <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::in_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for "in" references.
- , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::forward_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for "forward" references.
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for all other reference categories.
- >
- >
- >::type
- , <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>
- >::type
- <a class="reference internal" href="#assignment-operator"><tt class="docutils literal">operator=</tt></a>(T const& value) const;
- template <typename T>
- constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::out_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // The reference category is "out".
- , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::forward_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // The reference category is "forward".
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // The reference category is neither "out" nor "forward".
- >
- >::type
- , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_const.html">boost::is_const</a><T>
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for reference-to-const types.
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for referece-to-mutable types.
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for references neither "out" nor "forward".
- >::type
- , <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>
- >::type
- <a class="reference internal" href="#assignment-operator"><tt class="docutils literal">operator=</tt></a>(T& value) const;
- template <typename T>
- constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_scalar.html">boost::is_scalar</a><T>
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for scalar types.
- , <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::in_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for "in" references.
- , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::forward_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for "forward" references.
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for all other reference categories.
- >
- >
- >::type
- , <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>
- >::type
- <a class="reference internal" href="#assignment-operator"><tt class="docutils literal">operator=</tt></a>(T const&& value) const;
- template <typename T>
- constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_scalar.html">boost::is_scalar</a><T>
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for scalar types.
- , <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::consume_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for "consume" references.
- , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::forward_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for "forward" references.
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for all other reference categories.
- >
- >
- >::type
- , <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>
- >::type
- <a class="reference internal" href="#assignment-operator"><tt class="docutils literal">operator=</tt></a>(T&& value) const;
- template <typename T>
- constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_scalar.html">boost::is_scalar</a><T>
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for scalar types.
- , <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::in_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for "in" references.
- , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::forward_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for "forward" references.
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for all other reference categories.
- >
- >
- >::type
- , <em>tagged default</em>
- >::type
- <a class="reference internal" href="#bitwise-or-operator"><tt class="docutils literal">operator|</tt></a>(T const& x) const;
- template <typename T>
- constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::out_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // The reference category is "out".
- , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::forward_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // The reference category is "forward".
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // The reference category is neither "out" nor "forward".
- >
- >::type
- , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_const.html">boost::is_const</a><T>
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for reference-to-const types.
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for referece-to-mutable types.
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for references neither "out" nor "forward".
- >::type
- , <em>tagged default</em>
- >::type
- <a class="reference internal" href="#bitwise-or-operator"><tt class="docutils literal">operator|</tt></a>(T& x) const;
- template <typename T>
- constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_scalar.html">boost::is_scalar</a><T>
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for scalar types.
- , <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::in_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for "in" references.
- , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::forward_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for "forward" references.
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for all other reference categories.
- >
- >
- >::type
- , <em>tagged default</em>
- >::type
- <a class="reference internal" href="#bitwise-or-operator"><tt class="docutils literal">operator|</tt></a>(T const&& x) const;
- template <typename T>
- constexpr typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- typename <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_scalar.html">boost::is_scalar</a><T>
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for scalar types.
- , <a class="reference external" href="../../../mpl/doc/refmanual/eval-if.html">boost::mpl::eval_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::consume_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for "consume" references.
- , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- typename Tag::qualifier
- , boost::parameter::forward_reference
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Enable this overload for "forward" references.
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> // Disable this overload for all other reference categories.
- >
- >
- >::type
- , <em>tagged default</em>
- >::type constexpr
- <a class="reference internal" href="#bitwise-or-operator"><tt class="docutils literal">operator|</tt></a>(T&& value) const;
- template <typename F>
- constexpr <em>tagged lazy default</em> <a class="reference internal" href="#logical-or-operator"><tt class="docutils literal">operator||</tt></a>(F const&) const;
- template <typename F>
- constexpr <em>tagged lazy default</em> <a class="reference internal" href="#logical-or-operator"><tt class="docutils literal">operator||</tt></a>(F&) const;
- static keyword<Tag> const& instance;
- static keyword<Tag>& <a class="reference internal" href="#get">get</a>();
- };
- </pre>
- <p id="assignment-operator"><tt class="docutils literal">operator=</tt></p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Synopsis:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename T>
- constexpr <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T const& value) const;
- template <typename T>
- constexpr <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T& value) const;
- template <typename T>
- constexpr <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T const&& value) const;
- template <typename T>
- constexpr <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T&& value) const;
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Requires:</th><td class="field-body">one of the following:</td>
- </tr>
- </tbody>
- </table>
- <ul class="simple">
- <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>
- <li>To use the <tt class="docutils literal">const</tt> lvalue reference overload, <tt class="docutils literal">T</tt> must be scalar, or
- 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>
- <li>To use the mutable lvalue reference overload, the nested <tt class="docutils literal">qualifier</tt>
- 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
- <tt class="docutils literal">T</tt> must not be <tt class="docutils literal">const</tt>-qualified.</li>
- <li>To use the <tt class="docutils literal">const</tt> rvalue reference overload for non-scalar <tt class="docutils literal">T</tt>, 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>
- <li>To use the mutable rvalue reference overload for non-scalar <tt class="docutils literal">T</tt>, the
- 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
- <tt class="docutils literal">move_from_reference</tt>.</li>
- </ul>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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
- <tt class="docutils literal">value</tt> with <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal">Tag</tt></td>
- </tr>
- </tbody>
- </table>
- <p id="bitwise-or-operator"><tt class="docutils literal">operator|</tt></p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Synopsis:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename T>
- constexpr <em>tagged default</em> operator|(T const& x) const;
- template <typename T>
- constexpr <em>tagged default</em> operator|(T& x) const;
- template <typename T>
- constexpr <em>tagged default</em> operator|(T const&& x) const;
- template <typename T>
- constexpr <em>tagged default</em> operator|(T&& x) const;
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Requires:</th><td class="field-body">one of the following:</td>
- </tr>
- </tbody>
- </table>
- <ul class="simple">
- <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>
- <li>To use the <tt class="docutils literal">const</tt> lvalue reference overload, <tt class="docutils literal">T</tt> must be scalar, or
- 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>
- <li>To use the mutable lvalue reference overload, the nested <tt class="docutils literal">qualifier</tt>
- 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
- <tt class="docutils literal">T</tt> must not be <tt class="docutils literal">const</tt>-qualified.</li>
- <li>To use the <tt class="docutils literal">const</tt> rvalue reference overload for non-scalar <tt class="docutils literal">T</tt>, 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>
- <li>To use the mutable rvalue reference overload for non-scalar <tt class="docutils literal">T</tt>, the
- 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
- <tt class="docutils literal">move_from_reference</tt>.</li>
- </ul>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p id="logical-or-operator"><tt class="docutils literal">operator||</tt></p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Synopsis:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename F>
- constexpr <em>tagged lazy default</em> operator||(F const& g) const;
- template <typename F>
- constexpr <em>tagged lazy default</em> operator||(F& g) const;
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">g()</tt> must be valid, with type
- <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"><F()>::type</span></tt>.<a class="footnote-reference" href="#no-result-of" id="id6"><sup>2</sup></a></td>
- </tr>
- <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>
- </tr>
- </tbody>
- </table>
- <p id="instance"><tt class="docutils literal">instance</tt></p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Synopsis:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- static keyword<Tag> const& instance;
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Returns:</th><td class="field-body">a “singleton instance”: the same object will be returned on each
- invocation of <tt class="docutils literal">instance</tt>.</td>
- </tr>
- <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>
- </tr>
- </tbody>
- </table>
- <p id="get"><tt class="docutils literal">get</tt></p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Synopsis:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- static keyword<Tag>& get();
- </pre>
- <div class="admonition-deprecated admonition">
- <p class="first admonition-title">Deprecated</p>
- <p class="last">This function has been deprecated in favor of <tt class="docutils literal">instance</tt>.</p>
- </div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Returns:</th><td class="field-body">a “singleton instance”: the same object will be returned on each
- invocation of <tt class="docutils literal">get()</tt>.</td>
- </tr>
- <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>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="section" id="id7">
- <span id="template-keyword"></span><h2><a class="toc-backref" href="#id42">4.2 <tt class="docutils literal">template_keyword</tt></a></h2>
- <p>This class template encapsulates a named template parameter. Every type
- 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
- of <tt class="docutils literal">template_keyword</tt>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename Tag, typename T>
- struct template_keyword
- {
- typedef Tag key_type;
- typedef T value_type;
- typedef <em>implementation defined</em> reference;
- };
- </pre>
- <p>The <a class="reference external" href="../../test/ntp.cpp">test/ntp.cpp</a> test program demonstrates proper usage of this class template.</p>
- </div>
- <div class="section" id="id8">
- <span id="parameters"></span><h2><a class="toc-backref" href="#id43">4.3 <tt class="docutils literal">parameters</tt></a></h2>
- <p>Provides an interface for assembling the actual arguments to a <cite>forwarding
- function</cite> into an <span class="concept">ArgumentPack</span>, in which any <a class="reference internal" href="#positional">positional</a> arguments will be
- tagged according to the corresponding template argument to <tt class="docutils literal">parameters</tt>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename ...PSpec>
- struct parameters
- {
- template <typename ...Args>
- struct <a class="reference internal" href="#match"><tt class="docutils literal">match</tt></a>
- {
- typedef … type;
- };
- template <typename ...Args>
- <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&&... args) const;
- };
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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
- <a class="reference internal" href="#parameterspec"><span class="concept">ParameterSpec</span></a>.</td>
- </tr>
- </tbody>
- </table>
- <div class="note">
- <p class="first admonition-title">Note</p>
- <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
- follows, for any argument type <tt class="docutils literal">A</tt> ## <em>i</em>:</p>
- <div class="last line-block">
- <div class="line">let <tt class="docutils literal">D0</tt> the set [d0, …, d ## <em>j</em>] of all <strong>deduced</strong></div>
- <div class="line"><em>parameter specs</em> in the <tt class="docutils literal">PSpec</tt> parameter pack</div>
- <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>
- <div class="line"><br /></div>
- <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<T>::</span></tt> <a class="reference internal" href="#assignment-operator"><tt class="docutils literal">operator=</tt></a></div>
- <div class="line">then</div>
- <div class="line-block">
- <div class="line"><tt class="docutils literal">K</tt> ## <em>i</em> is <tt class="docutils literal">T</tt></div>
- </div>
- <div class="line">else</div>
- <div class="line-block">
- <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>
- <div class="line"><tt class="docutils literal"><span class="pre">keyword<T>::</span></tt> <a class="reference internal" href="#assignment-operator"><tt class="docutils literal">operator=</tt></a></div>
- <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>
- <div class="line">then</div>
- <div class="line-block">
- <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>
- <div class="line">matches <tt class="docutils literal">A</tt> ## <em>i</em></div>
- <div class="line">then</div>
- <div class="line-block">
- <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>
- <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>
- </div>
- </div>
- <div class="line">else</div>
- <div class="line-block">
- <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>
- </div>
- </div>
- </div>
- </div>
- <dl class="docutils" id="match">
- <dt><tt class="docutils literal">match</tt></dt>
- <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
- resolution.</dd>
- </dl>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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
- <tt class="docutils literal"><span class="pre">parameters<Params...></span></tt>. Otherwise, <tt class="docutils literal"><span class="pre">match<Args...>::type</span></tt> is not
- defined.</td>
- </tr>
- </tbody>
- </table>
- <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>
- <ul>
- <li><p class="first"><tt class="docutils literal">P</tt> is the <em>unspecified</em> default</p>
- </li>
- <li><p class="first"><strong>or</strong>, <tt class="docutils literal">P</tt> is a <em>keyword tag type</em></p>
- </li>
- <li><dl class="first docutils">
- <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"><X,F></tt> and either</dt>
- <dd><ul class="first last">
- <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>
- </li>
- <li><dl class="first docutils">
- <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<F,R</span></tt> ## <em>i</em></dt>
- <dd><p class="first last"><tt class="docutils literal"><span class="pre">>::type::value</span></tt> is <tt class="docutils literal">true</tt></p>
- </dd>
- </dl>
- </li>
- </ul>
- </dd>
- </dl>
- </li>
- <li><dl class="first docutils">
- <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"><X,F></tt>, and</dt>
- <dd><ul class="first last simple">
- <li><tt class="docutils literal">X</tt> is some <tt class="docutils literal">K</tt> ## <em>i</em>, <strong>and</strong></li>
- <li><tt class="docutils literal"><span class="pre">mpl::apply<F,R</span></tt> ## <em>i</em> <tt class="docutils literal"><span class="pre">>::type::value</span></tt> is <tt class="docutils literal">true</tt></li>
- </ul>
- </dd>
- </dl>
- </li>
- </ul>
- <p id="function-call-operator"><tt class="docutils literal">operator()</tt></p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Synopsis:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename ...Args>
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator()(Args&&... args) const;
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- <ul class="last">
- <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>
- </li>
- <li><dl class="first docutils">
- <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>
- <dd><p class="first last"><tt class="docutils literal">a</tt> ## <em>i</em></p>
- </dd>
- </dl>
- </li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="section" id="optional-required">
- <span id="required"></span><span id="optional"></span><h2><a class="toc-backref" href="#id44">4.4 <tt class="docutils literal">optional</tt>, <tt class="docutils literal">required</tt></a></h2>
- <p>These templates describe the requirements on a function parameter.</p>
- <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>
- <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>
- <p>Both headers are included by: <a class="reference external" href="../../../../boost/parameter/preprocessor.hpp">boost/parameter/preprocessor.hpp</a></p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name" colspan="2">Specializations model:</th></tr>
- <tr class="field"><td> </td><td class="field-body"><a class="reference internal" href="#parameterspec"><span class="concept">ParameterSpec</span></a></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename Tag, typename Predicate = <em>unspecified</em>>
- struct optional;
- template <typename Tag, typename Predicate = <em>unspecified</em>>
- struct required;
- </pre>
- <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
- Class</a> that returns <tt class="docutils literal"><span class="pre">mpl::true_</span></tt> for any argument. If
- <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
- <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
- <tt class="docutils literal"><span class="pre">mp11::mp_true</span></tt> for any argument.</p>
- </div>
- <div class="section" id="id9">
- <span id="deduced"></span><h2><a class="toc-backref" href="#id45">4.5 <tt class="docutils literal">deduced</tt></a></h2>
- <p>This template is used to wrap the <em>keyword tag</em> argument to
- <tt class="docutils literal">optional</tt> or <tt class="docutils literal">required</tt>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <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>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename Tag>
- struct deduced;
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Requires:</th><td class="field-body">nothing</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <hr class="docutils" />
- <div class="section" id="metafunctions">
- <h1><a class="toc-backref" href="#id46">5 Metafunctions</a></h1>
- <p>A <a class="reference external" href="../../../mpl/doc/refmanual/metafunction.html">Metafunction</a> is conceptually a function that operates on, and returns,
- C++ types.</p>
- <div class="section" id="id10">
- <span id="binding"></span><h2><a class="toc-backref" href="#id47">5.1 <tt class="docutils literal">binding</tt></a></h2>
- <p>Returns the result type of indexing an argument pack with a
- <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>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename A, typename K, typename D = void_>
- struct binding
- {
- typedef … type;
- };
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <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
- <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,
- returns <tt class="docutils literal">D</tt>.</td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="section" id="id11">
- <span id="lazy-binding"></span><h2><a class="toc-backref" href="#id48">5.2 <tt class="docutils literal">lazy_binding</tt></a></h2>
- <p>Returns the result type of indexing an argument pack with a
- <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename A, typename K, typename F>
- struct lazy_binding
- {
- typedef … type;
- };
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <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
- <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,
- 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"><F()>::type</span></tt>.<a class="footnote-reference" href="#no-result-of" id="id12"><sup>2</sup></a></td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="section" id="id13">
- <span id="value-type"></span><h2><a class="toc-backref" href="#id49">5.3 <tt class="docutils literal">value_type</tt></a></h2>
- <p>Returns the result type of indexing an argument pack with a
- <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>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename A, typename K, typename D = void_>
- struct value_type
- {
- typedef … type;
- };
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </td>
- </tr>
- <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
- <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
- <a class="reference internal" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal">D</tt>. Equivalent to:</p>
- <pre class="literal-block">
- typename <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/remove_reference.html">boost::remove_reference</a><
- typename <a class="reference internal" href="#binding"><tt class="docutils literal">binding</tt></a><A, K, D>::type
- >::type
- </pre>
- <p class="last">… when <tt class="docutils literal">D</tt> is not a reference type.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="section" id="id14">
- <span id="lazy-value-type"></span><h2><a class="toc-backref" href="#id50">5.4 <tt class="docutils literal">lazy_value_type</tt></a></h2>
- <p>Returns the result type of indexing an argument pack with a
- <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename A, typename K, typename F>
- struct lazy_value_type
- {
- typedef … type;
- };
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <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
- <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
- <a class="reference internal" href="#tagged-reference">tagged reference</a> exists, 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"><F()>::type</span></tt>.<a class="footnote-reference" href="#no-result-of" id="id15"><sup>2</sup></a></td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="section" id="id16">
- <span id="are-tagged-arguments"></span><h2><a class="toc-backref" href="#id51">5.5 <tt class="docutils literal">are_tagged_arguments</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename T0, typename ...Pack>
- struct are_tagged_arguments
- // : <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> if T0 and all elements in Pack are
- // tagged reference types, <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> otherwise.
- {
- };
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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
- <a class="reference internal" href="#tagged-reference">tagged reference</a> types, <tt class="docutils literal"><span class="pre">mpl::false_</span></tt> otherwise.</td>
- </tr>
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>When implementing a Boost.Parameter-enabled constructor for a container that
- conforms to the C++ standard, one needs to remember that the standard requires
- the presence of other constructors that are typically defined as templates,
- such as range constructors. To avoid overload ambiguities between the two
- constructors, use this metafunction in conjunction with <tt class="docutils literal">disable_if</tt> to
- define the range constructor.</p>
- <pre class="literal-block">
- template <typename B>
- class frontend : public B
- {
- struct _enabler
- {
- };
- public:
- <a class="reference internal" href="#boost-parameter-no-spec-constructor"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR</tt></a>(frontend, (B))
- template <typename Iterator>
- frontend(
- Iterator itr
- , Iterator itr_end
- , typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::disable_if</a><
- are_tagged_arguments<Iterator>
- , _enabler
- >::type = _enabler()
- ) : B(itr, itr_end)
- {
- }
- };
- </pre>
- </div>
- <div class="section" id="id17">
- <span id="is-argument-pack"></span><h2><a class="toc-backref" href="#id52">5.6 <tt class="docutils literal">is_argument_pack</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename T>
- struct is_argument_pack
- // : <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>,
- // <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::false_</a> otherwise.
- {
- };
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- otherwise.</td>
- </tr>
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>To avoid overload ambiguities between a constructor that takes in an
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> and a templated conversion constructor, use this
- metafunction in conjunction with <tt class="docutils literal">enable_if</tt>.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a0)
- template <typename T>
- class backend0
- {
- struct _enabler
- {
- };
- T a0;
- public:
- template <typename ArgPack>
- explicit backend0(
- ArgPack const& args
- , typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- is_argument_pack<ArgPack>
- , _enabler
- >::type = _enabler()
- ) : a0(args[_a0])
- {
- }
- template <typename U>
- backend0(
- backend0<U> const& copy
- , typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_convertible.html">boost::is_convertible</a><U,T>
- , _enabler
- >::type = _enabler()
- ) : a0(copy.get_a0())
- {
- }
- T const& get_a0() const
- {
- return this->a0;
- }
- };
- </pre>
- </div>
- <div class="section" id="id18">
- <span id="result-of-compose"></span><h2><a class="toc-backref" href="#id53">5.7 <tt class="docutils literal"><span class="pre">result_of::compose</span></tt></a></h2>
- <p>Returns the result type of the <a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a> function.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename ...TaggedArgs>
- struct compose
- : <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a><T0,Pack...>
- , <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>
- >
- {
- };
- template <>
- struct compose<>
- {
- typedef <em>empty</em> <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> type;
- };
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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
- specified.</td>
- </tr>
- <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>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <hr class="docutils" />
- <div class="section" id="function-templates">
- <h1><a class="toc-backref" href="#id54">6 Function Templates</a></h1>
- <div class="section" id="id19">
- <span id="compose"></span><h2><a class="toc-backref" href="#id55">6.1 <tt class="docutils literal">compose</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename ...Pack>
- constexpr typename <a class="reference internal" href="#result-of-compose"><tt class="docutils literal"><span class="pre">result_of::compose</span></tt></a><Pack...>::type
- compose(Pack const&... args);
- </pre>
- <p>This function facilitates easier variadic argument composition. It is used by
- the <a class="reference internal" href="#boost-parameter-no-spec-function"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_FUNCTION</tt></a>,
- <a class="reference internal" href="#boost-parameter-no-spec-member-function"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION</tt></a>,
- <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>,
- <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>,
- <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>,
- <a class="reference internal" href="#boost-parameter-no-spec-constructor"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR</tt></a>, and
- <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
- can use it to write your own code generation macros if the ones provided by
- this library do not suffice.</p>
- <p>Unlike the <a class="reference internal" href="#tagged-reference">tagged reference</a> comma operator, the <tt class="docutils literal">compose()</tt> function is
- variadic, as mentioned before. However, the <a class="reference internal" href="#tagged-reference">tagged reference</a> comma operator
- can be invoked indefinitely and therefore does not limit the size of the
- resulting <span class="concept">ArgumentPack</span>, while the <tt class="docutils literal">compose()</tt> function cannot take in more
- 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
- support perfect forwarding.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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
- specified.</td>
- </tr>
- <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
- specified; an empty <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> otherwise.</td>
- </tr>
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- BOOST_PARAMETER_NAME(index)
- BOOST_PARAMETER_NAME(name)
- template <typename ArgumentPack>
- int print_name_and_index(ArgumentPack const& args)
- {
- std::cout << "index = " << args[_index];
- std::cout << "name = " << args[_name];
- std::cout << "; " << std::endl;
- return 0;
- }
- int y = print_name_and_index(compose(_index = 3, _name = "jones"));
- </pre>
- <p>The <a class="reference external" href="../../test/compose.cpp">compose.cpp</a> test program shows more examples using this function.</p>
- </div>
- </div>
- <hr class="docutils" />
- <div class="section" id="code-generation-macros">
- <h1><a class="toc-backref" href="#id56">7 Code Generation Macros</a></h1>
- <p>Macros in this section can be used to ease the writing of code
- using the Parameter library by eliminating repetitive boilerplate.</p>
- <div class="section" id="boost-parameter-function-result-name-tag-namespace-arguments">
- <span id="boost-parameter-function"></span><h2><a class="toc-backref" href="#id57">7.1 <tt class="docutils literal">BOOST_PARAMETER_FUNCTION(result, name, tag_namespace, arguments)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a function that can take in positional arguments, composed
- arguments, named arguments, and deduced arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>The return type of each of the following function templates falls under a
- different value category.</p>
- <pre class="literal-block">
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> rvalue_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const rvalue_const_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>& lvalue_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return lset;
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const& lvalue_const_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return clset;
- }
- </pre>
- <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
- <pre class="literal-block">
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- </pre>
- <p>Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
- underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
- </pre>
- <p>Use the macro as a substitute for a normal function header. Enclose the
- return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter, also enclose the
- expected value type in parentheses. Since the value types are mutually
- exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. Also, just as with a normal
- function, optional parameters have default values, whereas required parameters
- do not. Within the function body, either simply use the parameter name or
- pass the matching identifier with the leading underscore to the bracket
- operator of <tt class="docutils literal">args</tt> to extract the corresponding argument. Note that the
- second method doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to preserve value categories.</p>
- <pre class="literal-block">
- BOOST_PARAMETER_FUNCTION((bool), evaluate, kw,
- (deduced
- (required
- (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><1>))
- (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><2>))
- )
- (optional
- (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><3>), rvalue_const_bitset<2>())
- (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><4>), rvalue_bitset<3>())
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(lrc)
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(lr)
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><rrc0_type>(rrc0))
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(args[_rr0])
- );
- return true;
- }
- </pre>
- <p>The following function calls are legal.</p>
- <pre class="literal-block">
- evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- evaluate(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- evaluate( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- evaluate( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- </pre>
- <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
- function calls are also legal.</p>
- <pre class="literal-block">
- evaluate( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- evaluate( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- </pre>
- <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
- <a class="reference external" href="../../test/preprocessor_eval_category.cpp">preprocessor_eval_category.cpp</a> test programs demonstrate proper usage of this
- macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
- <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
- generated forwarding functions.</li>
- <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
- function resides.</li>
- <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
- <em>argument-specifiers</em>, as defined below.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <pre class="literal-block">
- argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
- specifier-group0 ::= <em>specifier-group1</em> |
- (
- '<strong>(</strong>' '<strong>deduced</strong>'
- <em>specifier-group1</em> {<em>specifier-group1</em>}
- '<strong>)</strong>'
- )
- specifier-group1 ::=
- (
- '<strong>(</strong>' '<strong>optional</strong>'
- <em>optional-specifier</em> {<em>optional-specifier</em>}
- '<strong>)</strong>'
- ) | (
- '<strong>(</strong>' '<strong>required</strong>'
- <em>required-specifier</em> {<em>required-specifier</em>}
- '<strong>)</strong>'
- )
- optional-specifier ::=
- '<strong>(</strong>'
- <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> '<strong>,</strong>' <em>default-value</em>
- ')'
- required-specifier ::=
- '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
- restriction ::=
- ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
- ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
- '<strong>*</strong>'
- </pre>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
- <li><tt class="docutils literal"><span class="pre">default-value</span></tt> is any valid C++ expression; if necessary, user code can
- 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>
- 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
- <tt class="docutils literal"><span class="pre">specifier-group1</span></tt>. <em>This expression will be invoked exactly once.</em></li>
- <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
- be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
- 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
- Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
- of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
- <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
- Metafunction Class</a> whose first argument will be the type of the
- corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>. If
- <tt class="docutils literal">restriction</tt> uses this form, then the type of the generated name
- <tt class="docutils literal"><span class="pre">argument-name</span> ## _type</tt> will be computed in terms of the <strong>target
- type</strong>, and the generated reference <tt class="docutils literal"><span class="pre">argument-name</span></tt> (but not its
- corresponding entry in <tt class="docutils literal">args</tt>) will be cast to that type.</li>
- </ul>
- <p><strong>Approximate expansion:</strong></p>
- <p>Where:</p>
- <ul class="simple">
- <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- </ul>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename Args>
- using boost_param_result_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename Args>
- struct boost_param_result_ ## __LINE__ ## <strong>name</strong>
- {
- typedef <strong>result</strong> type;
- };
- struct boost_param_params_ ## __LINE__ ## <strong>name</strong>
- : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- <em>list of parameter specifications, based on arguments</em>
- >
- {
- };
- typedef boost_param_params_ ## __LINE__ ## <strong>name</strong>
- boost_param_parameters_ ## __LINE__ ## <strong>name</strong>;
- template <typename Args>
- typename boost_param_result_ ## __LINE__ ## <strong>name</strong><Args>::type
- boost_param_impl ## __LINE__ ## <strong>name</strong>(Args const&);
- template <typename A0, …, typename A ## <strong>n</strong>>
- <strong>result</strong> <strong>name</strong>(
- A0&& a0, …, A ## <strong>n</strong>&& a ## <strong>n</strong>
- , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
- ::match<A0, …, A ## <strong>n</strong>>::type
- = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
- )
- {
- return boost_param_impl ## __LINE__ ## <strong>name</strong>(
- boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>n</strong>>(a ## <strong>n</strong>)
- )
- );
- }
- <span class="vellipsis">⋮</span>
- template <typename A0, …, typename A ## <strong>m</strong>>
- <strong>result</strong> <strong>name</strong>(
- A0&& a0, …, A ## <strong>m</strong>&& a ## <strong>m</strong>
- , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
- ::match<A0, …, A ## <strong>m</strong>>::type
- = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
- )
- {
- return boost_param_impl ## __LINE__ ## <strong>name</strong>(
- boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>m</strong>>(a ## <strong>m</strong>)
- )
- );
- }
- template <
- typename ResultType
- , typename Args
- , typename <em>argument name</em> ## <strong>0</strong> ## _type
- , …
- , typename <em>argument name</em> ## <strong>n</strong> ## _type
- >
- ResultType
- boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
- (ResultType(*)())
- , Args const& args
- , <em>argument name</em> ## <strong>0</strong> ## _type&& <em>argument name</em> ## <strong>0</strong>
- , …
- , <em>argument name</em> ## <strong>n</strong> ## _type&& <em>argument name</em> ## <strong>m</strong>
- );
- <span class="vellipsis">⋮</span>
- template <
- typename ResultType
- , typename Args
- , typename <em>argument name</em> ## <strong>0</strong> ## _type
- , …
- , typename <em>argument name</em> ## <strong>m</strong> ## _type
- >
- ResultType
- boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
- (ResultType(*)())
- , Args const& args
- , <em>argument name</em> ## <strong>0</strong> ## _type&& <em>argument name</em> ## <strong>0</strong>
- , …
- , <em>argument name</em> ## <strong>m</strong> ## _type&& <em>argument name</em> ## <strong>m</strong>
- );
- template <typename Args>
- typename boost_param_result_ ## __LINE__ ## <strong>name</strong><Args>::type
- boost_param_impl ## __LINE__ ## <strong>name</strong>(Args const& args)
- {
- return boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
- static_cast<
- typename boost_param_result_ ## __LINE__ ## <strong>name</strong><
- Args
- >::type(*)()
- >(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , args
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of required parameter</em> ## <strong>0</strong>
- >::type
- >(args[ <em>keyword object of required parameter</em> ## <strong>0</strong>])
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of required parameter</em> ## <strong>n</strong>
- >::type
- >(args[ <em>keyword object of required parameter</em> ## <strong>n</strong>])
- );
- }
- template <
- typename ResultType
- , typename Args
- , typename <em>argument name</em> ## <strong>0</strong> ## _type
- , …
- , typename <em>argument name</em> ## <strong>n</strong> ## _type
- >
- ResultType
- boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
- (ResultType(*)())
- , Args const& args
- , <em>argument name</em> ## <strong>0</strong> ## _type&& <em>argument name</em> ## <strong>0</strong>
- , …
- , <em>argument name</em> ## <strong>n</strong> ## _type&& <em>argument name</em> ## <strong>n</strong>
- )
- {
- return boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
- static_cast<ResultType(*)()>(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , (args, <em>keyword object of optional parameter</em> ## <strong>n + 1</strong> =
- <em>default value of optional parameter</em> ## <strong>n + 1</strong>
- )
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><<em>argument name</em> ## <strong>0</strong> ## _type>(
- <em>argument name</em> ## <strong>0</strong>
- )
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><<em>argument name</em> ## <strong>n</strong> ## _type>(
- <em>argument name</em> ## <strong>n</strong>
- )
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of optional parameter</em> ## <strong>n + 1</strong>
- >::type
- >(<em>default value of optional parameter</em> ## <strong>n + 1</strong>)
- );
- }
- <span class="vellipsis">⋮</span>
- template <
- typename ResultType
- , typename Args
- , typename <em>argument name</em> ## <strong>0</strong> ## _type
- , …
- , typename <em>argument name</em> ## <strong>m</strong> ## _type
- >
- ResultType
- boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
- (ResultType(*)())
- , Args const& args
- , <em>argument name</em> ## <strong>0</strong> ## _type&& <em>argument name</em> ## <strong>0</strong>
- , …
- , <em>argument name</em> ## <strong>m</strong> ## _type&& <em>argument name</em> ## <strong>m</strong>
- )
- </pre>
- </div>
- <div class="section" id="boost-parameter-member-function-result-name-tag-namespace-arguments">
- <span id="boost-parameter-member-function"></span><h2><a class="toc-backref" href="#id58">7.2 <tt class="docutils literal">BOOST_PARAMETER_MEMBER_FUNCTION(result, name, tag_namespace, arguments)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a member function that can take in positional arguments, composed
- arguments, named arguments, and deduced arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>The return type of each of the following function templates falls under a
- different value category.</p>
- <pre class="literal-block">
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> rvalue_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const rvalue_const_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>& lvalue_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return lset;
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const& lvalue_const_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return clset;
- }
- </pre>
- <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
- <pre class="literal-block">
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- </pre>
- <p>Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
- underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
- </pre>
- <p>Use the macro as a substitute for a normal <tt class="docutils literal">static</tt> member function
- header. Enclose the return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter,
- also enclose the expected value type in parentheses. Since the value types
- are mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. Also, just as with a normal
- function, optional parameters have default values, whereas required parameters
- do not. Within the function body, either simply use the parameter name or
- pass the matching identifier with the leading underscore to the bracket
- operator of <tt class="docutils literal">args</tt> to extract the corresponding argument. Note that the
- second method doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to preserve value categories.</p>
- <pre class="literal-block">
- struct B
- {
- BOOST_PARAMETER_MEMBER_FUNCTION((bool), static evaluate, kw,
- (deduced
- (required
- (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><1>))
- (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><2>))
- )
- (optional
- (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><3>), rvalue_const_bitset<2>())
- (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><4>), rvalue_bitset<3>())
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(lrc)
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(lr)
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><rrc0_type>(rrc0))
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(args[_rr0])
- );
- return true;
- }
- };
- </pre>
- <p>The following function calls are legal.</p>
- <pre class="literal-block">
- B::evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- B::evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- B::evaluate(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- B::evaluate( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- B::evaluate( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- </pre>
- <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
- function calls are also legal.</p>
- <pre class="literal-block">
- B::evaluate( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- B::evaluate( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- </pre>
- <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
- demonstrate proper usage of this macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
- <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
- generated forwarding functions. <tt class="docutils literal">name</tt> may be qualified by the
- <tt class="docutils literal">static</tt> keyword to declare the member function and its helpers as not
- associated with any object of the enclosing type.</li>
- <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
- function resides.</li>
- <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
- <em>argument-specifiers</em>, as defined below.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <pre class="literal-block">
- argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
- specifier-group0 ::= <em>specifier-group1</em> |
- (
- '<strong>(</strong>' '<strong>deduced</strong>'
- <em>specifier-group1</em> {<em>specifier-group1</em>}
- '<strong>)</strong>'
- )
- specifier-group1 ::=
- (
- '<strong>(</strong>' '<strong>optional</strong>'
- <em>optional-specifier</em> {<em>optional-specifier</em>}
- '<strong>)</strong>'
- ) | (
- '<strong>(</strong>' '<strong>required</strong>'
- <em>required-specifier</em> {<em>required-specifier</em>}
- '<strong>)</strong>'
- )
- optional-specifier ::=
- '<strong>(</strong>'
- <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> '<strong>,</strong>' <em>default-value</em>
- ')'
- required-specifier ::=
- '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
- restriction ::=
- ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
- ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
- '<strong>*</strong>'
- </pre>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
- <li><tt class="docutils literal"><span class="pre">default-value</span></tt> is any valid C++ expression; if necessary, user code can
- 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>
- 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
- <tt class="docutils literal"><span class="pre">specifier-group1</span></tt>. <em>This expression will be invoked exactly once.</em></li>
- <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
- be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
- 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
- Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
- of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
- <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
- Metafunction Class</a> whose first argument will be the type of the
- corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>. If
- <tt class="docutils literal">restriction</tt> uses this form, then the type of the generated name
- <tt class="docutils literal"><span class="pre">argument-name</span> ## _type</tt> will be computed in terms of the <strong>target
- type</strong>, and the generated reference <tt class="docutils literal"><span class="pre">argument-name</span></tt> (but not its
- corresponding entry in <tt class="docutils literal">args</tt>) will be cast to that type.</li>
- </ul>
- <p><strong>Approximate expansion:</strong></p>
- <p>Where:</p>
- <ul class="simple">
- <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- </ul>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename Args>
- using boost_param_result_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename Args>
- struct boost_param_result_ ## __LINE__ ## <strong>name</strong>
- {
- typedef <strong>result</strong> type;
- };
- struct boost_param_params_ ## __LINE__ ## <strong>name</strong>
- : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- <em>list of parameter specifications, based on arguments</em>
- >
- {
- };
- typedef boost_param_params_ ## __LINE__ ## <strong>name</strong>
- boost_param_parameters_ ## __LINE__ ## <strong>name</strong>;
- template <typename A0, …, typename A ## <strong>n</strong>>
- <strong>result</strong> <strong>name</strong>(
- A0&& a0, …, A ## <strong>n</strong>&& a ## <strong>n</strong>
- , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
- ::match<A0, …, A ## <strong>n</strong>>::type
- = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
- )
- {
- return this->boost_param_impl ## __LINE__ ## <strong>name</strong>(
- boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>n</strong>>(a ## <strong>n</strong>)
- )
- );
- }
- <span class="vellipsis">⋮</span>
- template <typename A0, …, typename A ## <strong>m</strong>>
- <strong>result</strong> <strong>name</strong>(
- A0&& a0, …, A ## <strong>m</strong>&& a ## <strong>m</strong>
- , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
- ::match<A0, …, A ## <strong>m</strong>>::type
- = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
- )
- {
- return this->boost_param_impl ## __LINE__ ## <strong>name</strong>(
- boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>m</strong>>(a ## <strong>m</strong>)
- )
- );
- }
- template <typename Args>
- typename boost_param_result_ ## __LINE__ ## <strong>name</strong><Args>::type
- boost_param_impl ## __LINE__ ## <strong>name</strong>(Args const& args)
- {
- return this->boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
- static_cast<
- typename boost_param_result_ ## __LINE__ ## <strong>name</strong><
- Args
- >::type(*)()
- >(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , args
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of required parameter</em> ## <strong>0</strong>
- >::type
- >(args[ <em>keyword object of required parameter</em> ## <strong>0</strong>])
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of required parameter</em> ## <strong>n</strong>
- >::type
- >(args[ <em>keyword object of required parameter</em> ## <strong>n</strong>])
- );
- }
- template <
- typename ResultType
- , typename Args
- , typename <em>argument name</em> ## <strong>0</strong> ## _type
- , …
- , typename <em>argument name</em> ## <strong>n</strong> ## _type
- >
- ResultType
- boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
- (ResultType(*)())
- , Args const& args
- , <em>argument name</em> ## <strong>0</strong> ## _type&& <em>argument name</em> ## <strong>0</strong>
- , …
- , <em>argument name</em> ## <strong>n</strong> ## _type&& <em>argument name</em> ## <strong>n</strong>
- )
- {
- return this->boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
- static_cast<ResultType(*)()>(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , (args, <em>keyword object of optional parameter</em> ## <strong>n + 1</strong> =
- <em>default value of optional parameter</em> ## <strong>n + 1</strong>
- )
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><<em>argument name</em> ## <strong>0</strong> ## _type>(
- <em>argument name</em> ## <strong>0</strong>
- )
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><<em>argument name</em> ## <strong>n</strong> ## _type>(
- <em>argument name</em> ## <strong>n</strong>
- )
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of optional parameter</em> ## <strong>n + 1</strong>
- >::type
- >(<em>default value of optional parameter</em> ## <strong>n + 1</strong>)
- );
- }
- <span class="vellipsis">⋮</span>
- template <
- typename ResultType
- , typename Args
- , typename <em>argument name</em> ## <strong>0</strong> ## _type
- , …
- , typename <em>argument name</em> ## <strong>m</strong> ## _type
- >
- ResultType
- boost_param_dispatch_0boost_ ## __LINE__ ## <strong>name</strong>(
- (ResultType(*)())
- , Args const& args
- , <em>argument name</em> ## <strong>0</strong> ## _type&& <em>argument name</em> ## <strong>0</strong>
- , …
- , <em>argument name</em> ## <strong>m</strong> ## _type&& <em>argument name</em> ## <strong>m</strong>
- )
- </pre>
- </div>
- <div class="section" id="boost-parameter-const-member-function-result-name-tag-ns-arguments">
- <span id="boost-parameter-const-member-function"></span><h2><a class="toc-backref" href="#id59">7.3 <tt class="docutils literal">BOOST_PARAMETER_CONST_MEMBER_FUNCTION(result, name, tag_ns, arguments)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a member function that can take in positional arguments, composed
- arguments, named arguments, and deduced arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>The return type of each of the following function templates falls under a
- different value category.</p>
- <pre class="literal-block">
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> rvalue_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const rvalue_const_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>& lvalue_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return lset;
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const& lvalue_const_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return clset;
- }
- </pre>
- <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
- <pre class="literal-block">
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- </pre>
- <p>Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
- underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
- </pre>
- <p>Use the macro as a substitute for a normal <tt class="docutils literal">const</tt> member function
- header. Enclose the return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter,
- also enclose the expected value type in parentheses. Since the value types
- are mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. Also, just as with a normal
- function, optional parameters have default values, whereas required parameters
- do not. Within the function body, either simply use the parameter name or
- pass the matching identifier with the leading underscore to the bracket
- operator of <tt class="docutils literal">args</tt> to extract the corresponding argument. Note that the
- second method doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to preserve value categories.</p>
- <pre class="literal-block">
- struct B
- {
- B()
- {
- }
- BOOST_PARAMETER_CONST_MEMBER_FUNCTION((bool), evaluate, kw,
- (deduced
- (required
- (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><1>))
- (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><2>))
- )
- (optional
- (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><3>), rvalue_const_bitset<2>())
- (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><4>), rvalue_bitset<3>())
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(lrc)
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(lr)
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><rrc0_type>(rrc0))
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(args[_rr0])
- );
- return true;
- }
- };
- </pre>
- <p>The following function calls are legal.</p>
- <pre class="literal-block">
- B const b = B();
- b.evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- b.evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- b.evaluate(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- b.evaluate( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- b.evaluate( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- </pre>
- <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
- function calls are also legal.</p>
- <pre class="literal-block">
- b.evaluate( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- b.evaluate( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- </pre>
- <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> test program demonstrates proper usage of this macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
- <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
- generated forwarding functions.</li>
- <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
- function resides.</li>
- <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
- <em>argument-specifiers</em>, as defined below.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <pre class="literal-block">
- argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
- specifier-group0 ::= <em>specifier-group1</em> |
- (
- '<strong>(</strong>' '<strong>deduced</strong>'
- <em>specifier-group1</em> {<em>specifier-group1</em>}
- '<strong>)</strong>'
- )
- specifier-group1 ::=
- (
- '<strong>(</strong>' '<strong>optional</strong>'
- <em>optional-specifier</em> {<em>optional-specifier</em>}
- '<strong>)</strong>'
- ) | (
- '<strong>(</strong>' '<strong>required</strong>'
- <em>required-specifier</em> {<em>required-specifier</em>}
- '<strong>)</strong>'
- )
- optional-specifier ::=
- '<strong>(</strong>'
- <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> '<strong>,</strong>' <em>default-value</em>
- ')'
- required-specifier ::=
- '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
- restriction ::=
- ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
- ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
- '<strong>*</strong>'
- </pre>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
- <li><tt class="docutils literal"><span class="pre">default-value</span></tt> is any valid C++ expression; if necessary, user code can
- 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>
- 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
- <tt class="docutils literal"><span class="pre">specifier-group1</span></tt>. <em>This expression will be invoked exactly once.</em></li>
- <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
- be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
- 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
- Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
- of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
- <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
- Metafunction Class</a> whose first argument will be the type of the
- corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>. If
- <tt class="docutils literal">restriction</tt> uses this form, then the type of the generated name
- <tt class="docutils literal"><span class="pre">argument-name</span> ## _type</tt> will be computed in terms of the <strong>target
- type</strong>, and the generated reference <tt class="docutils literal"><span class="pre">argument-name</span></tt> (but not its
- corresponding entry in <tt class="docutils literal">args</tt>) will be cast to that type.</li>
- </ul>
- <p><strong>Approximate expansion:</strong></p>
- <p>Where:</p>
- <ul class="simple">
- <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- </ul>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename Args>
- using boost_param_result_const_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename Args>
- struct boost_param_result_const_ ## __LINE__ ## <strong>name</strong>
- {
- typedef <strong>result</strong> type;
- };
- struct boost_param_params_const_ ## __LINE__ ## <strong>name</strong>
- : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- <em>list of parameter specifications, based on arguments</em>
- >
- {
- };
- typedef boost_param_params_const_ ## __LINE__ ## <strong>name</strong>
- boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>;
- template <typename A0, …, typename A ## <strong>n</strong>>
- <strong>result</strong> <strong>name</strong>(
- A0&& a0, …, A ## <strong>n</strong>&& a ## <strong>n</strong>
- , typename boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>
- ::match<A0, …, A ## <strong>n</strong>>::type
- = boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## <strong>name</strong>(
- boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>n</strong>>(a ## <strong>n</strong>)
- )
- );
- }
- <span class="vellipsis">⋮</span>
- template <typename A0, …, typename A ## <strong>m</strong>>
- <strong>result</strong> <strong>name</strong>(
- A0&& a0, …, A ## <strong>m</strong>&& a ## <strong>m</strong>
- , typename boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>
- ::match<A0, …, A ## <strong>m</strong>>::type
- = boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## <strong>name</strong>(
- boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>m</strong>>(a ## <strong>m</strong>)
- )
- );
- }
- template <typename Args>
- typename boost_param_result_const_ ## __LINE__ ## <strong>name</strong><Args>::type
- boost_param_impl_const ## __LINE__ ## <strong>name</strong>(Args const& args) const
- {
- return this->
- boost_param_dispatch_const_0boost_ ## __LINE__ ## <strong>name</strong>(
- static_cast<
- typename boost_param_result_const_ ## __LINE__ ## <strong>name</strong><
- Args
- >::type(*)()
- >(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , args
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of required parameter</em> ## <strong>0</strong>
- >::type
- >(args[ <em>keyword object of required parameter</em> ## <strong>0</strong>])
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of required parameter</em> ## <strong>n</strong>
- >::type
- >(args[ <em>keyword object of required parameter</em> ## <strong>n</strong>])
- );
- }
- template <
- typename ResultType
- , typename Args
- , typename <em>argument name</em> ## <strong>0</strong> ## _type
- , …
- , typename <em>argument name</em> ## <strong>n</strong> ## _type
- >
- ResultType
- boost_param_dispatch_const_0boost_ ## __LINE__ ## <strong>name</strong>(
- (ResultType(*)())
- , Args const& args
- , <em>argument name</em> ## <strong>0</strong> ## _type&& <em>argument name</em> ## <strong>0</strong>
- , …
- , <em>argument name</em> ## <strong>n</strong> ## _type&& <em>argument name</em> ## <strong>n</strong>
- ) const
- {
- return this->
- boost_param_dispatch_const_0boost_ ## __LINE__ ## <strong>name</strong>(
- static_cast<ResultType(*)()>(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , (args, <em>keyword object of optional parameter</em> ## <strong>n + 1</strong> =
- <em>default value of optional parameter</em> ## <strong>n + 1</strong>
- )
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><<em>argument name</em> ## <strong>0</strong> ## _type>(
- <em>argument name</em> ## <strong>0</strong>
- )
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><<em>argument name</em> ## <strong>n</strong> ## _type>(
- <em>argument name</em> ## <strong>n</strong>
- )
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of optional parameter</em> ## <strong>n + 1</strong>
- >::type
- >(<em>default value of optional parameter</em> ## <strong>n + 1</strong>)
- );
- }
- <span class="vellipsis">⋮</span>
- template <
- typename ResultType
- , typename Args
- , typename <em>argument name</em> ## <strong>0</strong> ## _type
- , …
- , typename <em>argument name</em> ## <strong>m</strong> ## _type
- >
- ResultType
- boost_param_dispatch_const_0boost_ ## __LINE__ ## <strong>name</strong>(
- (ResultType(*)())
- , Args const& args
- , <em>argument name</em> ## <strong>0</strong> ## _type&& <em>argument name</em> ## <strong>0</strong>
- , …
- , <em>argument name</em> ## <strong>m</strong> ## _type&& <em>argument name</em> ## <strong>m</strong>
- ) const
- </pre>
- </div>
- <div class="section" id="boost-parameter-function-call-operator-result-tag-namespace-arguments">
- <span id="boost-parameter-function-call-operator"></span><h2><a class="toc-backref" href="#id60">7.4 <tt class="docutils literal">BOOST_PARAMETER_FUNCTION_CALL_OPERATOR(result, tag_namespace, arguments)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a function call operator that can take in positional arguments,
- composed arguments, named arguments, and deduced arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is <tt class="docutils literal">tag</tt> by default.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(y)
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(z)
- </pre>
- <p>Use the macro as a substitute for a normal function call operator
- header. Enclose the return type in parentheses. For each parameter, also
- enclose the expected value type in parentheses. Since the value types are
- mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
- clause. This is especially useful when implementing multiple
- Boost.Parameter-enabled function call operator overloads.</p>
- <pre class="literal-block">
- class char_reader
- {
- int index;
- char const* key;
- public:
- explicit char_reader(char const* k) : index(0), key(k)
- {
- }
- BOOST_PARAMETER_FUNCTION_CALL_OPERATOR((void), tag,
- (deduced
- (required
- (y, (int))
- (z, (char const*))
- )
- )
- )
- {
- this->index = y;
- this->key = z;
- }
- <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,
- (deduced
- (required
- (y, (bool))
- (z, (<a class="reference external" href="http://en.cppreference.com/w/cpp/container/map">std::map</a><char const*, <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>>))
- )
- )
- )
- {
- return y ? (
- (z.find(this->key)->second)[this->index]
- ) : this->key[this->index];
- }
- };
- </pre>
- <p>As with regular argument-dependent lookup, the value types of the arguments
- passed in determine which function call operator overload gets invoked.</p>
- <pre class="literal-block">
- char const* keys[] = {"foo", "bar", "baz"};
- <a class="reference external" href="http://en.cppreference.com/w/cpp/container/map">std::map</a><char const*, <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>> k2s;
- k2s[keys[0]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>("qux");
- k2s[keys[1]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>("wmb");
- k2s[keys[2]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>("zxc");
- char_reader r(keys[0]);
- // positional arguments
- BOOST_TEST_EQ('q', (r(true, k2s)));
- BOOST_TEST_EQ('f', (r(false, k2s)));
- // named arguments
- r(_z = keys[1], _y = 1);
- BOOST_TEST_EQ('m', (r(_z = k2s, _y = true)));
- BOOST_TEST_EQ('a', (r(_z = k2s, _y = false)));
- // deduced arguments
- r(keys[2], 2);
- BOOST_TEST_EQ('c', (r(k2s, true)));
- BOOST_TEST_EQ('z', (r(k2s, false)));
- </pre>
- <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
- demonstrate proper usage of this macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function call operator.</li>
- <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
- function call operator resides.</li>
- <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
- <em>argument-specifiers</em>, as defined below.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <pre class="literal-block">
- argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
- specifier-group0 ::= <em>specifier-group1</em> |
- (
- '<strong>(</strong>' '<strong>deduced</strong>'
- <em>specifier-group1</em> {<em>specifier-group1</em>}
- '<strong>)</strong>'
- )
- specifier-group1 ::=
- (
- '<strong>(</strong>' '<strong>optional</strong>'
- <em>optional-specifier</em> {<em>optional-specifier</em>}
- '<strong>)</strong>'
- ) | (
- '<strong>(</strong>' '<strong>required</strong>'
- <em>required-specifier</em> {<em>required-specifier</em>}
- '<strong>)</strong>'
- )
- optional-specifier ::=
- '<strong>(</strong>'
- <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> '<strong>,</strong>' <em>default-value</em>
- ')'
- required-specifier ::=
- '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
- restriction ::=
- ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
- ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
- '<strong>*</strong>'
- </pre>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
- <li><tt class="docutils literal"><span class="pre">default-value</span></tt> is any valid C++ expression; if necessary, user code can
- 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>
- 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
- <tt class="docutils literal"><span class="pre">specifier-group1</span></tt>. <em>This expression will be invoked exactly once.</em></li>
- <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
- be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
- 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
- Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
- of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
- <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
- Metafunction Class</a> whose first argument will be the type of the
- corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>. If
- <tt class="docutils literal">restriction</tt> uses this form, then the type of the generated name
- <tt class="docutils literal"><span class="pre">argument-name</span> ## _type</tt> will be computed in terms of the <strong>target
- type</strong>, and the generated reference <tt class="docutils literal"><span class="pre">argument-name</span></tt> (but not its
- corresponding entry in <tt class="docutils literal">args</tt>) will be cast to that type.</li>
- </ul>
- <p><strong>Approximate expansion:</strong></p>
- <p>Where:</p>
- <ul class="simple">
- <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- </ul>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename Args>
- using boost_param_result_ ## __LINE__ ## operator = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename Args>
- struct boost_param_result_ ## __LINE__ ## operator
- {
- typedef <strong>result</strong> type;
- };
- struct boost_param_params_ ## __LINE__ ## operator
- : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- <em>list of parameter specifications, based on arguments</em>
- >
- {
- };
- typedef boost_param_params_ ## __LINE__ ## operator
- boost_param_parameters_ ## __LINE__ ## operator;
- template <typename A0, …, typename A ## <strong>n</strong>>
- <strong>result</strong> operator()(
- A0&& a0, …, A ## <strong>n</strong>&& a ## <strong>n</strong>
- , typename boost_param_parameters_ ## __LINE__ ## operator::match<
- A0, …, A ## <strong>n</strong>
- >::type = boost_param_parameters_ ## __LINE__ ## operator()
- )
- {
- return this->boost_param_impl ## __LINE__ ## operator(
- boost_param_parameters_ ## __LINE__ ## operator()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>n</strong>>(a ## <strong>n</strong>)
- )
- );
- }
- <span class="vellipsis">⋮</span>
- template <typename A0, …, typename A ## <strong>m</strong>>
- <strong>result</strong> operator()(
- A0&& a0, …, A ## <strong>m</strong>&& a ## <strong>m</strong>
- , typename boost_param_parameters_ ## __LINE__ ## operator::match<
- A0, …, A ## <strong>m</strong>
- >::type = boost_param_parameters_ ## __LINE__ ## operator()
- )
- {
- return this->boost_param_impl ## __LINE__ ## operator(
- boost_param_parameters_ ## __LINE__ ## operator()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>m</strong>>(a ## <strong>m</strong>)
- )
- );
- }
- template <typename Args>
- typename boost_param_result_ ## __LINE__ ## operator<Args>::type
- boost_param_impl ## __LINE__ ## operator(Args const& args)
- {
- return this->boost_param_dispatch_0boost_ ## __LINE__ ## operator(
- static_cast<
- typename boost_param_result_ ## __LINE__ ## operator<
- Args
- >::type(*)()
- >(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , args
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of required parameter</em> ## <strong>0</strong>
- >::type
- >(args[ <em>keyword object of required parameter</em> ## <strong>0</strong>])
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of required parameter</em> ## <strong>n</strong>
- >::type
- >(args[ <em>keyword object of required parameter</em> ## <strong>n</strong>])
- );
- }
- template <
- typename ResultType
- , typename Args
- , typename <em>argument name</em> ## <strong>0</strong> ## _type
- , …
- , typename <em>argument name</em> ## <strong>n</strong> ## _type
- >
- ResultType
- boost_param_dispatch_0boost_ ## __LINE__ ## operator(
- (ResultType(*)())
- , Args const& args
- , <em>argument name</em> ## <strong>0</strong> ## _type&& <em>argument name</em> ## <strong>0</strong>
- , …
- , <em>argument name</em> ## <strong>n</strong> ## _type&& <em>argument name</em> ## <strong>n</strong>
- )
- {
- return this->boost_param_dispatch_0boost_ ## __LINE__ ## operator(
- static_cast<ResultType(*)()>(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , (args, <em>keyword object of optional parameter</em> ## <strong>n + 1</strong> =
- <em>default value of optional parameter</em> ## <strong>n + 1</strong>
- )
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><<em>argument name</em> ## <strong>0</strong> ## _type>(
- <em>argument name</em> ## <strong>0</strong>
- )
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><<em>argument name</em> ## <strong>n</strong> ## _type>(
- <em>argument name</em> ## <strong>n</strong>
- )
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of optional parameter</em> ## <strong>n + 1</strong>
- >::type
- >(<em>default value of optional parameter</em> ## <strong>n + 1</strong>)
- );
- }
- <span class="vellipsis">⋮</span>
- template <
- typename ResultType
- , typename Args
- , typename <em>argument name</em> ## <strong>0</strong> ## _type
- , …
- , typename <em>argument name</em> ## <strong>m</strong> ## _type
- >
- ResultType
- boost_param_dispatch_0boost_ ## __LINE__ ## operator(
- (ResultType(*)())
- , Args const& args
- , <em>argument name</em> ## <strong>0</strong> ## _type&& <em>argument name</em> ## <strong>0</strong>
- , …
- , <em>argument name</em> ## <strong>m</strong> ## _type&& <em>argument name</em> ## <strong>m</strong>
- )
- </pre>
- </div>
- <div class="section" id="boost-parameter-const-function-call-operator-result-tag-ns-arguments">
- <span id="boost-parameter-const-function-call-operator"></span><h2><a class="toc-backref" href="#id61">7.5 <tt class="docutils literal">BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, arguments)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a function call operator that can take in positional arguments,
- composed arguments, named arguments, and deduced arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>The return type of each of the following function templates falls under a
- different value category.</p>
- <pre class="literal-block">
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> rvalue_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const rvalue_const_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>& lvalue_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return lset;
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const& lvalue_const_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return clset;
- }
- </pre>
- <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
- <pre class="literal-block">
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- </pre>
- <p>Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
- underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
- </pre>
- <p>Use the macro as a substitute for a normal <tt class="docutils literal">const</tt> function call operator
- header. Enclose the return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter,
- also enclose the expected value type in parentheses. Since the value types
- are mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. Also, just as with a normal
- function, optional parameters have default values, whereas required parameters
- do not. Within the function body, either simply use the parameter name or
- pass the matching identifier with the leading underscore to the bracket
- operator of <tt class="docutils literal">args</tt> to extract the corresponding argument. Note that the
- second method doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to preserve value categories.</p>
- <pre class="literal-block">
- struct B
- {
- B()
- {
- }
- BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR((bool), kw,
- (deduced
- (required
- (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><1>))
- (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><2>))
- )
- (optional
- (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><3>), rvalue_const_bitset<2>())
- (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><4>), rvalue_bitset<3>())
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(lrc)
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(lr)
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><rrc0_type>(rrc0))
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(args[_rr0])
- );
- return true;
- }
- };
- </pre>
- <p>The following function calls are legal.</p>
- <pre class="literal-block">
- B const b = B();
- b( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- b( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- b(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- b( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- b( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- </pre>
- <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
- function calls are also legal.</p>
- <pre class="literal-block">
- b( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- b( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- </pre>
- <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
- <a class="reference external" href="../../test/preprocessor_eval_cat_8.cpp">preprocessor_eval_cat_8.cpp</a> test programs demonstrate proper usage of this
- macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function call operator.</li>
- <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
- function call operator resides.</li>
- <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
- <em>argument-specifiers</em>, as defined below.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <pre class="literal-block">
- argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
- specifier-group0 ::= <em>specifier-group1</em> |
- (
- '<strong>(</strong>' '<strong>deduced</strong>'
- <em>specifier-group1</em> {<em>specifier-group1</em>}
- '<strong>)</strong>'
- )
- specifier-group1 ::=
- (
- '<strong>(</strong>' '<strong>optional</strong>'
- <em>optional-specifier</em> {<em>optional-specifier</em>}
- '<strong>)</strong>'
- ) | (
- '<strong>(</strong>' '<strong>required</strong>'
- <em>required-specifier</em> {<em>required-specifier</em>}
- '<strong>)</strong>'
- )
- optional-specifier ::=
- '<strong>(</strong>'
- <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> '<strong>,</strong>' <em>default-value</em>
- ')'
- required-specifier ::=
- '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
- restriction ::=
- ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
- ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
- '<strong>*</strong>'
- </pre>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
- <li><tt class="docutils literal"><span class="pre">default-value</span></tt> is any valid C++ expression; if necessary, user code can
- 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>
- 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
- <tt class="docutils literal"><span class="pre">specifier-group1</span></tt>. <em>This expression will be invoked exactly once.</em></li>
- <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
- be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
- 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
- Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
- of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
- <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
- Metafunction Class</a> whose first argument will be the type of the
- corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>. If
- <tt class="docutils literal">restriction</tt> uses this form, then the type of the generated name
- <tt class="docutils literal"><span class="pre">argument-name</span> ## _type</tt> will be computed in terms of the <strong>target
- type</strong>, and the generated reference <tt class="docutils literal"><span class="pre">argument-name</span></tt> (but not its
- corresponding entry in <tt class="docutils literal">args</tt>) will be cast to that type.</li>
- </ul>
- <p><strong>Approximate expansion:</strong></p>
- <p>Where:</p>
- <ul class="simple">
- <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- </ul>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename Args>
- using boost_param_result_const_ ## __LINE__ ## operator = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename Args>
- struct boost_param_result_const_ ## __LINE__ ## operator
- {
- typedef <strong>result</strong> type;
- };
- struct boost_param_params_const_ ## __LINE__ ## operator
- : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- <em>list of parameter specifications, based on arguments</em>
- >
- {
- };
- typedef boost_param_params_const_ ## __LINE__ ## operator
- boost_param_parameters_const_ ## __LINE__ ## operator;
- template <typename A0, …, typename A ## <strong>n</strong>>
- <strong>result</strong> operator()(
- A0&& a0, …, A ## <strong>n</strong>&& a ## <strong>n</strong>
- , typename boost_param_parameters_const_ ## __LINE__ ## operator
- ::match<A0, …, A ## <strong>n</strong>>::type
- = boost_param_parameters_const_ ## __LINE__ ## operator()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## operator(
- boost_param_parameters_const_ ## __LINE__ ## operator()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>n</strong>>(a ## <strong>n</strong>)
- )
- );
- }
- <span class="vellipsis">⋮</span>
- template <typename A0, …, typename A ## <strong>m</strong>>
- <strong>result</strong> operator()(
- A0&& a0, …, A ## <strong>m</strong>&& a ## <strong>m</strong>
- , typename boost_param_parameters_const_ ## __LINE__ ## operator
- ::match<A0, …, A ## <strong>m</strong>>::type
- = boost_param_parameters_const_ ## __LINE__ ## operator()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## operator(
- boost_param_parameters_const_ ## __LINE__ ## operator()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>m</strong>>(a ## <strong>m</strong>)
- )
- );
- }
- template <typename Args>
- typename boost_param_result_const_ ## __LINE__ ## operator<Args>::type
- boost_param_impl_const ## __LINE__ ## operator(Args const& args) const
- {
- return this->
- boost_param_dispatch_const_0boost_ ## __LINE__ ## operator(
- static_cast<
- typename boost_param_result_const_ ## __LINE__ ## operator<
- Args
- >::type(*)()
- >(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , args
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of required parameter</em> ## <strong>0</strong>
- >::type
- >(args[ <em>keyword object of required parameter</em> ## <strong>0</strong>])
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of required parameter</em> ## <strong>n</strong>
- >::type
- >(args[ <em>keyword object of required parameter</em> ## <strong>n</strong>])
- );
- }
- template <
- typename ResultType
- , typename Args
- , typename <em>argument name</em> ## <strong>0</strong> ## _type
- , …
- , typename <em>argument name</em> ## <strong>n</strong> ## _type
- >
- ResultType
- boost_param_dispatch_const_0boost_ ## __LINE__ ## operator(
- (ResultType(*)())
- , Args const& args
- , <em>argument name</em> ## <strong>0</strong> ## _type&& <em>argument name</em> ## <strong>0</strong>
- , …
- , <em>argument name</em> ## <strong>n</strong> ## _type&& <em>argument name</em> ## <strong>n</strong>
- ) const
- {
- return this->
- boost_param_dispatch_const_0boost_ ## __LINE__ ## operator(
- static_cast<ResultType(*)()>(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , (args, <em>keyword object of optional parameter</em> ## <strong>n + 1</strong> =
- <em>default value of optional parameter</em> ## <strong>n + 1</strong>
- )
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><<em>argument name</em> ## <strong>0</strong> ## _type>(
- <em>argument name</em> ## <strong>0</strong>
- )
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><<em>argument name</em> ## <strong>n</strong> ## _type>(
- <em>argument name</em> ## <strong>n</strong>
- )
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><
- typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><
- Args
- , <em>keyword tag type of optional parameter</em> ## <strong>n + 1</strong>
- >::type
- >(<em>default value of optional parameter</em> ## <strong>n + 1</strong>)
- );
- }
- <span class="vellipsis">⋮</span>
- template <
- typename ResultType
- , typename Args
- , typename <em>argument name</em> ## <strong>0</strong> ## _type
- , …
- , typename <em>argument name</em> ## <strong>m</strong> ## _type
- >
- ResultType
- boost_param_dispatch_const_0boost_ ## __LINE__ ## operator(
- (ResultType(*)())
- , Args const& args
- , <em>argument name</em> ## <strong>0</strong> ## _type&& <em>argument name</em> ## <strong>0</strong>
- , …
- , <em>argument name</em> ## <strong>m</strong> ## _type&& <em>argument name</em> ## <strong>m</strong>
- ) const
- </pre>
- </div>
- <div class="section" id="boost-parameter-constructor-cls-impl-tag-namespace-arguments">
- <span id="boost-parameter-constructor"></span><h2><a class="toc-backref" href="#id62">7.6 <tt class="docutils literal">BOOST_PARAMETER_CONSTRUCTOR(cls, impl, tag_namespace, arguments)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a constructor that can take in positional arguments, composed
- arguments, named arguments, and deduced arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is <tt class="docutils literal">tag</tt> by default.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(y)
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(z)
- </pre>
- <p>In the base class, implement a delegate constructor template that takes in an
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>. You must pass the identifiers with leading underscores to
- <tt class="docutils literal">args</tt> in order to extract the corresponding arguments.</p>
- <pre class="literal-block">
- class char_read_base
- {
- int index;
- char const* key;
- public:
- template <typename Args>
- explicit char_read_base(Args const& args)
- : index(args[_y]), key(args[_z])
- {
- }
- <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,
- (deduced
- (required
- (y, (bool))
- (z, (<a class="reference external" href="http://en.cppreference.com/w/cpp/container/map">std::map</a><char const*, <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>>))
- )
- )
- )
- {
- return y ? (
- (z.find(this->key)->second)[this->index]
- ) : this->key[this->index];
- }
- };
- </pre>
- <p>Use the macro as a substitute for a normal constructor definition. Note the
- lack of an explicit body. Enclose the base type in parentheses. For each
- parameter, also enclose the expected value type in parentheses. Since the
- value types are mutually exclusive, you can wrap the parameters in a
- <tt class="docutils literal">(deduced …)</tt> clause.</p>
- <pre class="literal-block">
- struct char_reader : public char_read_base
- {
- BOOST_PARAMETER_CONSTRUCTOR(char_reader, (char_read_base), tag,
- (deduced
- (required
- (y, (int))
- (z, (char const*))
- )
- )
- )
- };
- </pre>
- <p>The following <tt class="docutils literal">char_reader</tt> constructor calls are legal.</p>
- <pre class="literal-block">
- char const* keys[] = {"foo", "bar", "baz"};
- <a class="reference external" href="http://en.cppreference.com/w/cpp/container/map">std::map</a><char const*, <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>> k2s;
- k2s[keys[0]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>("qux");
- k2s[keys[1]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>("wmb");
- k2s[keys[2]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>("zxc");
- // positional arguments
- char_reader r0(0, keys[0]);
- BOOST_TEST_EQ('q', (r0(true, k2s)));
- BOOST_TEST_EQ('f', (r0(false, k2s)));
- // named arguments
- char_reader r1(_z = keys[1], _y = 1);
- BOOST_TEST_EQ('m', (r1(_z = k2s, _y = true)));
- BOOST_TEST_EQ('a', (r1(_z = k2s, _y = false)));
- // deduced arguments
- char_reader r2(keys[2], 2);
- BOOST_TEST_EQ('c', (r2(k2s, true)));
- BOOST_TEST_EQ('z', (r2(k2s, false)));
- </pre>
- <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
- demonstrate proper usage of this macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">cls</tt> is the name of the enclosing class.</li>
- <li><tt class="docutils literal">impl</tt> is the parenthesized implementation base class for <tt class="docutils literal">cls</tt>.</li>
- <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
- constructor resides.</li>
- <li><tt class="docutils literal">arguments</tt> is a list of <em>argument-specifiers</em>, as defined below.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <pre class="literal-block">
- argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
- specifier-group0 ::= <em>specifier-group1</em> |
- (
- '<strong>(</strong>' '<strong>deduced</strong>'
- <em>specifier-group1</em> {<em>specifier-group1</em>}
- '<strong>)</strong>'
- )
- specifier-group1 ::=
- (
- '<strong>(</strong>' '<strong>optional</strong>'
- <em>specifier</em> {<em>specifier</em>}
- '<strong>)</strong>'
- ) | (
- '<strong>(</strong>' '<strong>required</strong>'
- <em>specifier</em> {<em>specifier</em>}
- '<strong>)</strong>'
- )
- specifier ::=
- '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
- restriction ::=
- ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
- ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
- '<strong>*</strong>'
- </pre>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
- <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
- be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
- 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
- Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
- of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
- <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
- Metafunction Class</a> whose first argument will be the type of the
- corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>.</li>
- </ul>
- <p>Note that <em>specifier</em> does not include <em>default-value</em>. It is up to the
- delegate constructor in <tt class="docutils literal">impl</tt> to determine the default value of all
- optional arguments.</p>
- <p><strong>Approximate expansion:</strong></p>
- <p>Where:</p>
- <ul class="simple">
- <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- </ul>
- <pre class="literal-block">
- struct boost_param_params_ ## __LINE__ ## ctor
- : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- <em>list of parameter specifications, based on arguments</em>
- >
- {
- };
- typedef boost_param_params_ ## __LINE__ ## ctor
- constructor_parameters ## __LINE__;
- template <typename A0, …, typename A ## <strong>n</strong>>
- <strong>cls</strong>(A0&& a0, …, A ## <strong>n</strong> && a ## <strong>n</strong>)
- : <strong>impl</strong>(
- constructor_parameters ## __LINE__(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>n</strong>>(a ## <strong>n</strong>)
- )
- )
- {
- }
- <span class="vellipsis">⋮</span>
- template <typename A0, …, typename A ## <strong>m</strong>>
- <strong>cls</strong>(A0&& a0, …, A ## <strong>m</strong> && a ## <strong>m</strong>)
- : <strong>impl</strong>(
- constructor_parameters ## __LINE__(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>m</strong>>(a ## <strong>m</strong>)
- )
- )
- {
- }
- </pre>
- </div>
- <div class="section" id="boost-parameter-basic-function-result-name-tag-namespace-arguments">
- <span id="boost-parameter-basic-function"></span><h2><a class="toc-backref" href="#id63">7.7 <tt class="docutils literal">BOOST_PARAMETER_BASIC_FUNCTION(result, name, tag_namespace, arguments)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a function that can take in positional arguments, composed
- arguments, named arguments, and deduced arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>The return type of each of the following function templates falls under a
- different value category.</p>
- <pre class="literal-block">
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> rvalue_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const rvalue_const_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>& lvalue_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return lset;
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const& lvalue_const_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return clset;
- }
- </pre>
- <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
- <pre class="literal-block">
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- </pre>
- <p>Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
- underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
- </pre>
- <p>Use the macro as a substitute for a normal function header. Enclose the
- return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter, also enclose the
- expected value type in parentheses. Since the value types are mutually
- exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. However, unlike a normal
- function, default values must be specified within the function body. Also
- within the function body, you must pass the matching identifier with the
- leading underscore to the bracket operator of <tt class="docutils literal">args</tt> to extract the
- corresponding argument, but at least this doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to
- preserve value categories.</p>
- <pre class="literal-block">
- BOOST_PARAMETER_BASIC_FUNCTION((bool), evaluate, kw,
- (deduced
- (required
- (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><1>))
- (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><2>))
- )
- (optional
- (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><3>))
- (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><4>))
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc0 | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(args[_rr0 | rvalue_bitset<3>()])
- );
- return true;
- }
- </pre>
- <p>The following function calls are legal.</p>
- <pre class="literal-block">
- evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- evaluate(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- evaluate( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- evaluate( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- </pre>
- <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
- function calls are also legal.</p>
- <pre class="literal-block">
- evaluate( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- evaluate( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- </pre>
- <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> test program demonstrates proper usage of this macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
- <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
- generated forwarding functions.</li>
- <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
- function resides.</li>
- <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
- <em>argument-specifiers</em>, as defined below.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <pre class="literal-block">
- argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
- specifier-group0 ::= <em>specifier-group1</em> |
- (
- '<strong>(</strong>' '<strong>deduced</strong>'
- <em>specifier-group1</em> {<em>specifier-group1</em>}
- '<strong>)</strong>'
- )
- specifier-group1 ::=
- (
- '<strong>(</strong>' '<strong>optional</strong>'
- <em>specifier</em> {<em>specifier</em>}
- '<strong>)</strong>'
- ) | (
- '<strong>(</strong>' '<strong>required</strong>'
- <em>specifier</em> {<em>specifier</em>}
- '<strong>)</strong>'
- )
- specifier ::=
- '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
- restriction ::=
- ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
- ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
- '<strong>*</strong>'
- </pre>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
- <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
- be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
- 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
- Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
- of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
- <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
- Metafunction Class</a> whose first argument will be the type of the
- corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>.</li>
- </ul>
- <p>Note that <em>specifier</em> does not include <em>default-value</em>. It is up to the
- function body to determine the default value of all optional arguments.</p>
- <p><strong>Approximate expansion:</strong></p>
- <p>Where:</p>
- <ul class="simple">
- <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- </ul>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename Args>
- using boost_param_result_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename Args>
- struct boost_param_result_ ## __LINE__ ## <strong>name</strong>
- {
- typedef <strong>result</strong> type;
- };
- struct boost_param_params_ ## __LINE__ ## <strong>name</strong>
- : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- <em>list of parameter specifications, based on arguments</em>
- >
- {
- };
- typedef boost_param_params_ ## __LINE__ ## <strong>name</strong>
- boost_param_parameters_ ## __LINE__ ## <strong>name</strong>;
- template <typename Args>
- typename boost_param_result_ ## __LINE__ ## <strong>name</strong><Args>::type
- boost_param_impl ## <strong>name</strong>(Args const&);
- template <typename A0, …, typename A ## <strong>n</strong>>
- <strong>result</strong> <strong>name</strong>(
- A0&& a0, …, A ## <strong>n</strong>&& a ## <strong>n</strong>
- , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
- ::match<A0, …, A ## <strong>n</strong>>::type
- = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
- )
- {
- return boost_param_impl ## __LINE__ ## <strong>name</strong>(
- boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>n</strong>>(a ## <strong>n</strong>)
- )
- );
- }
- <span class="vellipsis">⋮</span>
- template <typename A0, …, typename A ## <strong>m</strong>>
- <strong>result</strong> <strong>name</strong>(
- A0&& a0, …, A ## <strong>m</strong>&& a ## <strong>m</strong>
- , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
- ::match<A0, …, A ## <strong>m</strong>>::type
- = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
- )
- {
- return boost_param_impl ## __LINE__ ## <strong>name</strong>(
- boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>m</strong>>(a ## <strong>m</strong>)
- )
- );
- }
- template <typename Args>
- typename boost_param_result_ ## __LINE__ ## <strong>name</strong><Args>::type
- boost_param_impl ## __LINE__ ## <strong>name</strong>(Args const& args)
- </pre>
- <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
- available for use within the function body.</p>
- </div>
- <div class="section" id="boost-parameter-basic-member-function-result-name-tag-ns-arguments">
- <span id="boost-parameter-basic-member-function"></span><h2><a class="toc-backref" href="#id64">7.8 <tt class="docutils literal">BOOST_PARAMETER_BASIC_MEMBER_FUNCTION(result, name, tag_ns, arguments)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a member function that can take in positional arguments, composed
- arguments, named arguments, and deduced arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>The return type of each of the following function templates falls under a
- different value category.</p>
- <pre class="literal-block">
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> rvalue_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const rvalue_const_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>& lvalue_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return lset;
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const& lvalue_const_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return clset;
- }
- </pre>
- <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
- <pre class="literal-block">
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- </pre>
- <p>Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
- underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
- </pre>
- <p>Use the macro as a substitute for a normal <tt class="docutils literal">static</tt> member function
- header. Enclose the return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter,
- also enclose the expected value type in parentheses. Since the value types
- are mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. However, unlike a normal
- function, default values must be specified within the function body. Also
- within the function body, you must pass the matching identifier with the
- leading underscore to the bracket operator of <tt class="docutils literal">args</tt> to extract the
- corresponding argument, but at least this doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to
- preserve value categories.</p>
- <pre class="literal-block">
- struct B
- {
- BOOST_PARAMETER_BASIC_MEMBER_FUNCTION((bool), static evaluate, kw,
- (deduced
- (required
- (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><1>))
- (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><2>))
- )
- (optional
- (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><3>))
- (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><4>))
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc0 | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(
- args[_rr0 | rvalue_bitset<3>()]
- )
- );
- return true;
- }
- };
- </pre>
- <p>The following function calls are legal.</p>
- <pre class="literal-block">
- B::evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- B::evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- B::evaluate(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- B::evaluate( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- B::evaluate( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- </pre>
- <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
- function calls are also legal.</p>
- <pre class="literal-block">
- B::evaluate( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- B::evaluate( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- </pre>
- <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> test program demonstrates proper usage of this macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
- <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
- generated forwarding functions. <tt class="docutils literal">name</tt> may be qualified by the
- <tt class="docutils literal">static</tt> keyword to declare the member function and its helpers as not
- associated with any object of the enclosing type.</li>
- <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
- function resides.</li>
- <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
- <em>argument-specifiers</em>, as defined below.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <pre class="literal-block">
- argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
- specifier-group0 ::= <em>specifier-group1</em> |
- (
- '<strong>(</strong>' '<strong>deduced</strong>'
- <em>specifier-group1</em> {<em>specifier-group1</em>}
- '<strong>)</strong>'
- )
- specifier-group1 ::=
- (
- '<strong>(</strong>' '<strong>optional</strong>'
- <em>specifier</em> {<em>specifier</em>}
- '<strong>)</strong>'
- ) | (
- '<strong>(</strong>' '<strong>required</strong>'
- <em>specifier</em> {<em>specifier</em>}
- '<strong>)</strong>'
- )
- specifier ::=
- '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
- restriction ::=
- ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
- ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
- '<strong>*</strong>'
- </pre>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
- <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
- be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
- 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
- Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
- of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
- <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
- Metafunction Class</a> whose first argument will be the type of the
- corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>.</li>
- </ul>
- <p>Note that <em>specifier</em> does not include <em>default-value</em>. It is up to the
- function body to determine the default value of all optional arguments.</p>
- <p><strong>Approximate expansion:</strong></p>
- <p>Where:</p>
- <ul class="simple">
- <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- </ul>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename Args>
- using boost_param_result_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename Args>
- struct boost_param_result_ ## __LINE__ ## <strong>name</strong>
- {
- typedef <strong>result</strong> type;
- };
- struct boost_param_params_ ## __LINE__ ## <strong>name</strong>
- : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- <em>list of parameter specifications, based on arguments</em>
- >
- {
- };
- typedef boost_param_params_ ## __LINE__ ## <strong>name</strong>
- boost_param_parameters_ ## __LINE__ ## <strong>name</strong>;
- template <typename A0, …, typename A ## <strong>n</strong>>
- <strong>result</strong> <strong>name</strong>(
- A0&& a0, …, A ## <strong>n</strong>&& a ## <strong>n</strong>
- , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
- ::match<A0, …, A ## <strong>n</strong>>::type
- = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
- )
- {
- return this->boost_param_impl ## <strong>name</strong>(
- boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>n</strong>>(a ## <strong>n</strong>)
- )
- );
- }
- <span class="vellipsis">⋮</span>
- template <typename A0, …, typename A ## <strong>m</strong>>
- <strong>result</strong> <strong>name</strong>(
- A0&& a0, …, A ## <strong>m</strong>&& a ## <strong>m</strong>
- , typename boost_param_parameters_ ## __LINE__ ## <strong>name</strong>
- ::match<A0, …, A ## <strong>m</strong>>::type
- = boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()
- )
- {
- return this->boost_param_impl ## <strong>name</strong>(
- boost_param_parameters_ ## __LINE__ ## <strong>name</strong>()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>m</strong>>(a ## <strong>m</strong>)
- )
- );
- }
- template <typename Args>
- typename boost_param_result_ ## __LINE__ ## <strong>name</strong><Args>::type
- boost_param_impl ## <strong>name</strong>(Args const& args)
- </pre>
- <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
- available for use within the function body.</p>
- </div>
- <div class="section" id="boost-parameter-basic-const-member-function-result-name-tag-ns-args">
- <span id="boost-parameter-basic-const-member-function"></span><h2><a class="toc-backref" href="#id65">7.9 <tt class="docutils literal">BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION(result, name, tag_ns, args)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a member function that can take in positional arguments, composed
- arguments, named arguments, and deduced arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>The return type of each of the following function templates falls under a
- different value category.</p>
- <pre class="literal-block">
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> rvalue_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const rvalue_const_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>& lvalue_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return lset;
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const& lvalue_const_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return clset;
- }
- </pre>
- <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
- <pre class="literal-block">
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- </pre>
- <p>Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
- underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
- </pre>
- <p>Use the macro as a substitute for a normal <tt class="docutils literal">const</tt> member function
- header. Enclose the return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter,
- also enclose the expected value type in parentheses. Since the value types
- are mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. However, unlike a normal
- function, default values must be specified within the function body. Also
- within the function body, you must pass the matching identifier with the
- leading underscore to the bracket operator of <tt class="docutils literal">args</tt> to extract the
- corresponding argument, but at least this doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to
- preserve value categories.</p>
- <pre class="literal-block">
- struct B
- {
- B()
- {
- }
- BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION((bool), evaluate, kw,
- (deduced
- (required
- (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><1>))
- (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><2>))
- )
- (optional
- (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><3>))
- (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><4>))
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc0 | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(
- args[_rr0 | rvalue_bitset<3>()]
- )
- );
- return true;
- }
- };
- </pre>
- <p>The following function calls are legal.</p>
- <pre class="literal-block">
- B const b = B();
- b.evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- b.evaluate( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- b.evaluate(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- b.evaluate( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- b.evaluate( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- </pre>
- <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
- function calls are also legal.</p>
- <pre class="literal-block">
- b.evaluate( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- b.evaluate( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- </pre>
- <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> test program demonstrates proper usage of this macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
- <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
- generated forwarding functions.</li>
- <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
- function resides.</li>
- <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
- <em>argument-specifiers</em>, as defined below.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <pre class="literal-block">
- argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
- specifier-group0 ::= <em>specifier-group1</em> |
- (
- '<strong>(</strong>' '<strong>deduced</strong>'
- <em>specifier-group1</em> {<em>specifier-group1</em>}
- '<strong>)</strong>'
- )
- specifier-group1 ::=
- (
- '<strong>(</strong>' '<strong>optional</strong>'
- <em>specifier</em> {<em>specifier</em>}
- '<strong>)</strong>'
- ) | (
- '<strong>(</strong>' '<strong>required</strong>'
- <em>specifier</em> {<em>specifier</em>}
- '<strong>)</strong>'
- )
- specifier ::=
- '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
- restriction ::=
- ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
- ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
- '<strong>*</strong>'
- </pre>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
- <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
- be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
- 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
- Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
- of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
- <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
- Metafunction Class</a> whose first argument will be the type of the
- corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>.</li>
- </ul>
- <p>Note that <em>specifier</em> does not include <em>default-value</em>. It is up to the
- function body to determine the default value of all optional arguments.</p>
- <p><strong>Approximate expansion:</strong></p>
- <p>Where:</p>
- <ul class="simple">
- <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- </ul>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename Args>
- using boost_param_result_const_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename Args>
- struct boost_param_result_const_ ## __LINE__ ## <strong>name</strong>
- {
- typedef <strong>result</strong> type;
- };
- struct boost_param_params_const_ ## __LINE__ ## <strong>name</strong>
- : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- <em>list of parameter specifications, based on arguments</em>
- >
- {
- };
- typedef boost_param_params_const_ ## __LINE__ ## <strong>name</strong>
- boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>;
- template <typename A0, …, typename A ## <strong>n</strong>>
- <strong>result</strong> <strong>name</strong>(
- A0&& a0, …, A ## <strong>n</strong>&& a ## <strong>n</strong>
- , typename boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>
- ::match<A0, …, A ## <strong>n</strong>>::type
- = boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## <strong>name</strong>(
- boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>n</strong>>(a ## <strong>n</strong>)
- )
- );
- }
- <span class="vellipsis">⋮</span>
- template <typename A0, …, typename A ## <strong>m</strong>>
- <strong>result</strong> <strong>name</strong>(
- A0&& a0, …, A ## <strong>m</strong>&& a ## <strong>m</strong>
- , typename boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>
- ::match<A0, …, A ## <strong>m</strong>>::type
- = boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## <strong>name</strong>(
- boost_param_parameters_const_ ## __LINE__ ## <strong>name</strong>()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>m</strong>>(a ## <strong>m</strong>)
- )
- );
- }
- template <typename Args>
- typename boost_param_result_const_ ## __LINE__ ## <strong>name</strong><Args>::type
- boost_param_impl_const ## __LINE__ ## <strong>name</strong>(Args const& args) const
- </pre>
- <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
- available for use within the function body.</p>
- </div>
- <div class="section" id="boost-parameter-basic-function-call-operator-result-tag-ns-arguments">
- <span id="boost-parameter-basic-function-call-operator"></span><h2><a class="toc-backref" href="#id66">7.10 <tt class="docutils literal">BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR(result, tag_ns, arguments)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a function call operator that can take in positional arguments,
- composed arguments, named arguments, and deduced arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is <tt class="docutils literal">tag</tt> by default.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(y)
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(z)
- </pre>
- <p>Use the macro as a substitute for a normal function call operator
- header. Enclose the return type in parentheses. For each parameter, also
- enclose the expected value type in parentheses. Since the value types are
- mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
- clause. This is especially useful when implementing multiple
- Boost.Parameter-enabled function call operator overloads.</p>
- <pre class="literal-block">
- class char_reader
- {
- int index;
- char const* key;
- public:
- explicit char_reader(char const* k) : index(0), key(k)
- {
- }
- BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR((void), tag,
- (deduced
- (required
- (y, (int))
- (z, (char const*))
- )
- )
- )
- {
- this->index = args[_y];
- this->key = args[_z];
- }
- <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,
- (deduced
- (required
- (y, (bool))
- (z, (<a class="reference external" href="http://en.cppreference.com/w/cpp/container/map">std::map</a><char const*, <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>>))
- )
- )
- )
- {
- return args[_y] ? (
- (args[_z].find(this->key)->second)[this->index]
- ) : this->key[this->index];
- }
- };
- </pre>
- <p>As with regular argument-dependent lookup, the value types of the arguments
- passed in determine which function call operator overload gets invoked.</p>
- <pre class="literal-block">
- char const* keys[] = {"foo", "bar", "baz"};
- <a class="reference external" href="http://en.cppreference.com/w/cpp/container/map">std::map</a><char const*, <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>> k2s;
- k2s[keys[0]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>("qux");
- k2s[keys[1]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>("wmb");
- k2s[keys[2]] = <a class="reference external" href="http://en.cppreference.com/w/cpp/string/basic_string">std::string</a>("zxc");
- char_reader r(keys[0]);
- // positional arguments
- BOOST_TEST_EQ('q', (r(true, k2s)));
- BOOST_TEST_EQ('f', (r(false, k2s)));
- // named arguments
- r(_z = keys[1], _y = 1);
- BOOST_TEST_EQ('m', (r(_z = k2s, _y = true)));
- BOOST_TEST_EQ('a', (r(_z = k2s, _y = false)));
- // deduced arguments
- r(keys[2], 2);
- BOOST_TEST_EQ('c', (r(k2s, true)));
- BOOST_TEST_EQ('z', (r(k2s, false)));
- </pre>
- <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> test program demonstrates proper usage of this macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function call operator.</li>
- <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
- function call operator resides.</li>
- <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
- <em>argument-specifiers</em>, as defined below.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <pre class="literal-block">
- argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
- specifier-group0 ::= <em>specifier-group1</em> |
- (
- '<strong>(</strong>' '<strong>deduced</strong>'
- <em>specifier-group1</em> {<em>specifier-group1</em>}
- '<strong>)</strong>'
- )
- specifier-group1 ::=
- (
- '<strong>(</strong>' '<strong>optional</strong>'
- <em>specifier</em> {<em>specifier</em>}
- '<strong>)</strong>'
- ) | (
- '<strong>(</strong>' '<strong>required</strong>'
- <em>specifier</em> {<em>specifier</em>}
- '<strong>)</strong>'
- )
- specifier ::=
- '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
- restriction ::=
- ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
- ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
- '<strong>*</strong>'
- </pre>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
- <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
- be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
- 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
- Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
- of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
- <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
- Metafunction Class</a> whose first argument will be the type of the
- corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>.</li>
- </ul>
- <p>Note that <em>specifier</em> does not include <em>default-value</em>. It is up to the
- function body to determine the default value of all optional arguments.</p>
- <p><strong>Approximate expansion:</strong></p>
- <p>Where:</p>
- <ul class="simple">
- <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- </ul>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename Args>
- using boost_param_result_ ## __LINE__ ## operator = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename Args>
- struct boost_param_result_ ## __LINE__ ## operator
- {
- typedef <strong>result</strong> type;
- };
- struct boost_param_params_ ## __LINE__ ## operator
- : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- <em>list of parameter specifications, based on arguments</em>
- >
- {
- };
- typedef boost_param_params_ ## __LINE__ ## operator
- boost_param_parameters_ ## __LINE__ ## operator;
- template <typename A0, …, typename A ## <strong>n</strong>>
- <strong>result</strong> operator()(
- A0&& a0, …, A ## <strong>n</strong>&& a ## <strong>n</strong>
- , typename boost_param_parameters_ ## __LINE__ ## operator::match<
- A0, …, A ## <strong>n</strong>
- >::type = boost_param_parameters_ ## __LINE__ ## operator()
- )
- {
- return this->boost_param_impl ## __LINE__ ## operator(
- boost_param_parameters_ ## __LINE__ ## operator()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>n</strong>>(a ## <strong>n</strong>)
- )
- );
- }
- <span class="vellipsis">⋮</span>
- template <typename A0, …, typename A ## <strong>m</strong>>
- <strong>result</strong> operator()(
- A0&& a0, …, A ## <strong>m</strong>&& a ## <strong>m</strong>
- , typename boost_param_parameters_ ## __LINE__ ## operator::match<
- A0, …, A ## <strong>m</strong>
- >::type = boost_param_parameters_ ## __LINE__ ## operator()
- )
- {
- return this->boost_param_impl ## __LINE__ ## operator(
- boost_param_parameters_ ## __LINE__ ## operator()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>m</strong>>(a ## <strong>m</strong>)
- )
- );
- }
- template <typename Args>
- typename boost_param_result_ ## __LINE__ ## operator<Args>::type
- boost_param_impl ## __LINE__ ## operator(Args const& args)
- </pre>
- <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
- available for use within the function call operator body.</p>
- </div>
- <div class="section" id="boost-parameter-basic-const-function-call-operator-result-tag-ns-args">
- <span id="boost-parameter-basic-const-function-call-operator"></span><h2><a class="toc-backref" href="#id67">7.11 <tt class="docutils literal">BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, args)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a function call operator that can take in positional arguments,
- composed arguments, named arguments, and deduced arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>The return type of each of the following function templates falls under a
- different value category.</p>
- <pre class="literal-block">
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> rvalue_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const rvalue_const_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>& lvalue_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return lset;
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const& lvalue_const_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return clset;
- }
- </pre>
- <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
- <pre class="literal-block">
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- </pre>
- <p>Define the named parameters that will comprise the argument specification that
- this macro will use. Ensure that all their tag types are in the same
- namespace, which is <tt class="docutils literal">kw</tt> in this case. The identifiers with leading
- underscores can be passed to the bracket operator of <tt class="docutils literal">args</tt> to extract the
- same argument to which the corresponding named parameter (without underscores)
- is bound, as will be shown later.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw) in(lrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw) in_out(lr))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw) in(rrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw) consume(rr))
- </pre>
- <p>Use the macro as a substitute for a normal <tt class="docutils literal">const</tt> function call operator
- header. Enclose the return type <tt class="docutils literal">bool</tt> in parentheses. For each parameter,
- also enclose the expected value type in parentheses. Since the value types
- are mutually exclusive, you can wrap the parameters in a <tt class="docutils literal">(deduced …)</tt>
- clause. Otherwise, just as with a normal function, the order in which you
- specify the parameters determines their position. However, unlike a normal
- function, default values must be specified within the function body. Also
- within the function body, you must pass the matching identifier with the
- leading underscore to the bracket operator of <tt class="docutils literal">args</tt> to extract the
- corresponding argument, but at least this doesn't require <tt class="docutils literal"><span class="pre">std::forward</span></tt> to
- preserve value categories.</p>
- <pre class="literal-block">
- struct B
- {
- B()
- {
- }
- BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR((bool), kw,
- (deduced
- (required
- (lrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><1>))
- (lr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><2>))
- )
- (optional
- (rrc, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><3>))
- (rr, (<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><4>))
- )
- )
- )
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc0 | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(
- args[_rr0 | rvalue_bitset<3>()]
- )
- );
- return true;
- }
- };
- </pre>
- <p>The following function calls are legal.</p>
- <pre class="literal-block">
- B const b = B();
- b( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- , rvalue_bitset<3>()
- );
- b( // positional arguments
- lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- );
- b(( // composed arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- ));
- b( // named arguments
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- b( // named arguments
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- </pre>
- <p>Because the parameters were wrapped in a <tt class="docutils literal">(deduced …)</tt> clause, the following
- function calls are also legal.</p>
- <pre class="literal-block">
- b( // deduced arguments
- rvalue_bitset<3>()
- , lvalue_const_bitset<0>()
- , lvalue_bitset<1>()
- , rvalue_const_bitset<2>()
- );
- b( // deduced arguments
- lvalue_bitset<1>()
- , lvalue_const_bitset<0>()
- );
- </pre>
- <p>The <a class="reference external" href="../../test/preprocessor.cpp">preprocessor.cpp</a> test program demonstrates proper usage of this macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function call operator.</li>
- <li><tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords used by the
- function call operator resides.</li>
- <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
- <em>argument-specifiers</em>, as defined below.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <pre class="literal-block">
- argument-specifiers ::= <em>specifier-group0</em> {<em>specifier-group0</em>}
- specifier-group0 ::= <em>specifier-group1</em> |
- (
- '<strong>(</strong>' '<strong>deduced</strong>'
- <em>specifier-group1</em> {<em>specifier-group1</em>}
- '<strong>)</strong>'
- )
- specifier-group1 ::=
- (
- '<strong>(</strong>' '<strong>optional</strong>'
- <em>specifier</em> {<em>specifier</em>}
- '<strong>)</strong>'
- ) | (
- '<strong>(</strong>' '<strong>required</strong>'
- <em>specifier</em> {<em>specifier</em>}
- '<strong>)</strong>'
- )
- specifier ::=
- '<strong>(</strong>' <em>argument-name</em> '<strong>,</strong>' <em>restriction</em> ')'
- restriction ::=
- ( '<strong>*</strong>' '<strong>(</strong>' <em>mfc</em> '<strong>)</strong>' ) |
- ( '<strong>(</strong>' <em>type-name</em> '<strong>)</strong>' ) |
- '<strong>*</strong>'
- </pre>
- <ul class="simple">
- <li><tt class="docutils literal"><span class="pre">argument-name</span></tt> is any valid C++ identifier.</li>
- <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
- be the type of the corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument
- 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
- Integral Constant</a>; however, user code <em>cannot</em> compute <tt class="docutils literal">mfc</tt> in terms
- of <tt class="docutils literal"><span class="pre">previous-name</span> ## _type</tt>.</li>
- <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
- Metafunction Class</a> whose first argument will be the type of the
- corresponding <tt class="docutils literal"><span class="pre">argument-name</span></tt>, whose second argument will be the entire
- <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>, and whose return type is the <strong>target type</strong>.</li>
- </ul>
- <p>Note that <em>specifier</em> does not include <em>default-value</em>. It is up to the
- function body to determine the default value of all optional arguments.</p>
- <p><strong>Approximate expansion:</strong></p>
- <p>Where:</p>
- <ul class="simple">
- <li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- <li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
- </ul>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename Args>
- using boost_param_result_const_ ## __LINE__ ## operator = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename Args>
- struct boost_param_result_const_ ## __LINE__ ## operator
- {
- typedef <strong>result</strong> type;
- };
- struct boost_param_params_const_ ## __LINE__ ## operator
- : <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- <em>list of parameter specifications, based on arguments</em>
- >
- {
- };
- typedef boost_param_params_const_ ## __LINE__ ## operator
- boost_param_parameters_const_ ## __LINE__ ## operator;
- template <typename A0, …, typename A ## <strong>n</strong>>
- <strong>result</strong> operator()(
- A0&& a0, …, A ## <strong>n</strong>&& a ## <strong>n</strong>
- , typename boost_param_parameters_const_ ## __LINE__ ## operator
- ::match<A0, …, A ## <strong>n</strong>>::type
- = boost_param_parameters_const_ ## __LINE__ ## operator()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## operator(
- boost_param_parameters_const_ ## __LINE__ ## operator()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>n</strong>>(a ## <strong>n</strong>)
- )
- );
- }
- <span class="vellipsis">⋮</span>
- template <typename A0, …, typename A ## <strong>m</strong>>
- <strong>result</strong> operator()(
- A0&& a0, …, A ## <strong>m</strong>&& a ## <strong>m</strong>
- , typename boost_param_parameters_const_ ## __LINE__ ## operator
- ::match<A0, …, A ## <strong>m</strong>>::type
- = boost_param_parameters_const_ ## __LINE__ ## operator()
- ) const
- {
- return this->boost_param_impl_const ## __LINE__ ## operator(
- boost_param_parameters_const_ ## __LINE__ ## operator()(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A0>(a0)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>m</strong>>(a ## <strong>m</strong>)
- )
- );
- }
- template <typename Args>
- typename boost_param_result_const_ ## __LINE__ ## operator<Args>::type
- boost_param_impl_const ## __LINE__ ## operator(Args const& args) const
- </pre>
- <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
- available for use within the function call operator body.</p>
- </div>
- <div class="section" id="boost-parameter-no-spec-function-result-name">
- <span id="boost-parameter-no-spec-function"></span><h2><a class="toc-backref" href="#id68">7.12 <tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_FUNCTION(result, name)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a function that can take in named arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>The return type of each of the following function templates falls under a
- different value category.</p>
- <pre class="literal-block">
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> rvalue_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const rvalue_const_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>& lvalue_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return lset;
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const& lvalue_const_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return clset;
- }
- </pre>
- <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
- <pre class="literal-block">
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- </pre>
- <p>Named parameters are required when invoking the function; however, none of
- their tags need to be in the same namespace.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw0) in(lrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw1) in_out(lr))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw2) in(rrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw3) consume(rr))
- </pre>
- <p>Use the macro as a substitute for a variadic function header. Enclose the
- return type <tt class="docutils literal">bool</tt> in parentheses.</p>
- <pre class="literal-block">
- BOOST_PARAMETER_NO_SPEC_FUNCTION((bool), evaluate)
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(args[_rr | rvalue_bitset<3>()])
- );
- return true;
- }
- </pre>
- <p>To invoke the function, bind all its arguments to named parameters.</p>
- <pre class="literal-block">
- evaluate(
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- evaluate(
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- </pre>
- <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 macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
- <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
- generated implementation function.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <p>None.</p>
- <p><strong>Approximate expansion:</strong></p>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename TaggedArg0, typename ...TaggedArgs>
- using boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename TaggedArg0, typename ...TaggedArgs>
- struct boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong>
- {
- typedef <strong>result</strong> type;
- };
- template <typename ResultType, typename Args>
- ResultType
- boost_param_no_spec_impl ## __LINE__ ## <strong>name</strong>(
- (ResultType(*)())
- , Args const& args
- );
- template <typename TaggedArg0, typename ...TaggedArgs>
- inline typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a><
- <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a><TaggedArg0,TaggedArgs...>
- , boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong><
- TaggedArg0
- , TaggedArgs...
- >
- >::type
- <strong>name</strong>(TaggedArg0 const& arg0, TaggedArgs const&... args)
- {
- return boost_param_no_spec_impl ## __LINE__ ## <strong>name</strong>(
- static_cast<
- typename
- boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong><
- TaggedArg0
- , TaggedArgs...
- >::type(*)()
- >(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , <a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a>(arg0, args...)
- );
- }
- template <typename ResultType, typename Args>
- ResultType
- boost_param_no_spec_impl ## __LINE__ ## <strong>name</strong>(
- (ResultType(*)())
- , Args const& args
- )
- </pre>
- <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
- available for use within the function body.</p>
- </div>
- <div class="section" id="boost-parameter-no-spec-member-function-result-name">
- <span id="boost-parameter-no-spec-member-function"></span><h2><a class="toc-backref" href="#id69">7.13 <tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION(result, name)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a member function that can take in named arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>When designing a front-end class template whose back-end is configurable via
- parameterized inheritance, it can be useful to omit argument specifiers from
- a named-parameter member function so that the delegate member functions of the
- back-end classes can enforce their own specifications.</p>
- <pre class="literal-block">
- template <typename B>
- struct frontend : B
- {
- frontend() : B()
- {
- }
- BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION((void), initialize)
- {
- this->initialize_impl(args);
- }
- };
- </pre>
- <p>Named parameters are required when invoking the member function; however, none
- of their tags need to be in the same namespace.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a0)
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a1)
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a2)
- </pre>
- <p>For this example, each of the back-end class templates requires its own
- parameter to be present in the argument pack. In practice, such parameters
- should be optional, with default values.</p>
- <pre class="literal-block">
- template <typename T>
- class backend0
- {
- T a0;
- public:
- backend0() : a0()
- {
- }
- T const& get_a0() const
- {
- return this->a0;
- }
- protected:
- template <typename ArgPack>
- void initialize_impl(ArgPack const& args)
- {
- this->a0 = args[_a0];
- }
- };
- template <typename B, typename T>
- class backend1 : public B
- {
- T a1;
- public:
- backend1() : B(), a1()
- {
- }
- T const& get_a1() const
- {
- return this->a1;
- }
- protected:
- template <typename ArgPack>
- void initialize_impl(ArgPack const& args)
- {
- B::initialize_impl(args);
- this->a1 = args[_a1];
- }
- };
- template <typename B, typename T>
- class backend2 : public B
- {
- T a2;
- public:
- backend2() : B(), a2()
- {
- }
- T const& get_a2() const
- {
- return this->a2;
- }
- protected:
- template <typename ArgPack>
- void initialize_impl(ArgPack const& args)
- {
- B::initialize_impl(args);
- this->a2 = args[_a2];
- }
- };
- </pre>
- <p>This example shows that while <tt class="docutils literal">backend0</tt> must always be the root base class
- template and that <tt class="docutils literal">frontend</tt> must always be the most derived class template,
- the other back-ends can be chained together in different orders.</p>
- <pre class="literal-block">
- char const* p = "foo";
- frontend<
- backend2<backend1<backend0<char const*>, char>, int>
- > composed_obj0;
- frontend<
- backend1<backend2<backend0<char const*>, int>, char>
- > composed_obj1;
- composed_obj0.initialize(_a2 = 4, _a1 = ' ', _a0 = p);
- composed_obj1.initialize(_a0 = p, _a1 = ' ', _a2 = 4);
- BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
- BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
- BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
- </pre>
- <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
- programs demonstrate proper usage of this macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
- <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
- generated implementation function. <tt class="docutils literal">name</tt> may be qualified by the
- <tt class="docutils literal">static</tt> keyword to declare the member function and its helpers as not
- associated with any object of the enclosing type.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <p>None.</p>
- <p><strong>Approximate expansion:</strong></p>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename TaggedArg0, typename ...TaggedArgs>
- using boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename TaggedArg0, typename ...TaggedArgs>
- struct boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong>
- {
- typedef <strong>result</strong> type;
- };
- template <typename TaggedArg0, typename ...TaggedArgs>
- inline typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a><
- <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a><TaggedArg0,TaggedArgs...>
- , boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong><
- TaggedArg0
- , TaggedArgs...
- >
- >::type
- <strong>name</strong>(TaggedArg0 const& arg0, TaggedArgs const&... args)
- {
- return this->boost_param_no_spec_impl ## __LINE__ ## <strong>name</strong>(
- static_cast<
- typename
- boost_param_no_spec_result_ ## __LINE__ ## <strong>name</strong><
- TaggedArg0
- , TaggedArgs...
- >::type(*)()
- >(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , <a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a>(arg0, args...)
- );
- }
- template <typename ResultType, typename Args>
- ResultType
- boost_param_no_spec_impl ## __LINE__ ## <strong>name</strong>(
- (ResultType(*)())
- , Args const& args
- )
- </pre>
- <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
- available for use within the function body.</p>
- </div>
- <div class="section" id="boost-parameter-no-spec-const-member-function-result-name">
- <span id="boost-parameter-no-spec-const-member-function"></span><h2><a class="toc-backref" href="#id70">7.14 <tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION(result, name)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a member function that can take in named arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>The return type of each of the following function templates falls under a
- different value category.</p>
- <pre class="literal-block">
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> rvalue_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const rvalue_const_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>& lvalue_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return lset;
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const& lvalue_const_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return clset;
- }
- </pre>
- <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
- <pre class="literal-block">
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- </pre>
- <p>Named parameters are required when invoking the member function; however, none
- of their tags need to be in the same namespace.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw0) in(lrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw1) in_out(lr))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw2) in(rrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw3) consume(rr))
- </pre>
- <p>Use the macro as a substitute for a variadic function header. Enclose the
- return type <tt class="docutils literal">bool</tt> in parentheses. The macro will qualify the function with
- the <tt class="docutils literal">const</tt> keyword.</p>
- <pre class="literal-block">
- struct D
- {
- D()
- {
- }
- BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION((bool), evaluate_m)
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(
- args[_rr | rvalue_bitset<3>()]
- )
- );
- return true;
- }
- };
- </pre>
- <p>To invoke the member function, bind all its arguments to named parameters.</p>
- <pre class="literal-block">
- D const d = D();
- d.evaluate_m(
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- d.evaluate_m(
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- </pre>
- <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 macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function.</li>
- <li><tt class="docutils literal">name</tt> is the base name of the function; it determines the name of the
- generated implementation function.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <p>None.</p>
- <p><strong>Approximate expansion:</strong></p>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename TaggedArg0, typename ...TaggedArgs>
- using boost_param_no_spec_result_const_ ## __LINE__ ## <strong>name</strong> = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename TaggedArg0, typename ...TaggedArgs>
- struct boost_param_no_spec_result_const_ ## __LINE__ ## <strong>name</strong>
- {
- typedef <strong>result</strong> type;
- };
- template <typename TaggedArg0, typename ...TaggedArgs>
- inline typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a><
- <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a><TaggedArg0,TaggedArgs...>
- , boost_param_no_spec_result_const_ ## __LINE__ ## <strong>name</strong><
- TaggedArg0
- , TaggedArgs...
- >
- >::type
- <strong>name</strong>(TaggedArg0 const& arg0, TaggedArgs const&... args) const
- {
- return this->boost_param_no_spec_impl_const ## __LINE__ ## <strong>name</strong>(
- static_cast<
- typename
- boost_param_no_spec_result_const_ ## __LINE__ ## <strong>name</strong><
- TaggedArg0
- , TaggedArgs...
- >::type(*)()
- >(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , <a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a>(arg0, args...)
- );
- }
- template <typename ResultType, typename Args>
- ResultType
- boost_param_no_spec_impl_const ## __LINE__ ## <strong>name</strong>(
- (ResultType(*)())
- , Args const& args
- ) const
- </pre>
- <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
- available for use within the function body.</p>
- </div>
- <div class="section" id="boost-parameter-no-spec-function-call-operator-result">
- <span id="boost-parameter-no-spec-function-call-operator"></span><h2><a class="toc-backref" href="#id71">7.15 <tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR(result)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a function call operator that can take in named arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>When designing a front-end class template whose back-end is configurable via
- parameterized inheritance, it can be useful to omit argument specifiers from
- a named-parameter function call operator so that the delegate member functions
- of the back-end classes can enforce their own specifications.</p>
- <pre class="literal-block">
- template <typename B>
- struct frontend : B
- {
- frontend() : B()
- {
- }
- BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR((void))
- {
- this->initialize_impl(args);
- }
- };
- </pre>
- <p>Named parameters are required when invoking the function call operator;
- however, none of their tags need to be in the same namespace.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a0)
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a1)
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a2)
- </pre>
- <p>For this example, each of the back-end class templates requires its own
- parameter to be present in the argument pack. In practice, such parameters
- should be optional, with default values.</p>
- <pre class="literal-block">
- template <typename T>
- class backend0
- {
- T a0;
- public:
- backend0() : a0()
- {
- }
- T const& get_a0() const
- {
- return this->a0;
- }
- protected:
- template <typename ArgPack>
- void initialize_impl(ArgPack const& args)
- {
- this->a0 = args[_a0];
- }
- };
- template <typename B, typename T>
- class backend1 : public B
- {
- T a1;
- public:
- backend1() : B(), a1()
- {
- }
- T const& get_a1() const
- {
- return this->a1;
- }
- protected:
- template <typename ArgPack>
- void initialize_impl(ArgPack const& args)
- {
- B::initialize_impl(args);
- this->a1 = args[_a1];
- }
- };
- template <typename B, typename T>
- class backend2 : public B
- {
- T a2;
- public:
- backend2() : B(), a2()
- {
- }
- T const& get_a2() const
- {
- return this->a2;
- }
- protected:
- template <typename ArgPack>
- void initialize_impl(ArgPack const& args)
- {
- B::initialize_impl(args);
- this->a2 = args[_a2];
- }
- };
- </pre>
- <p>This example shows that while <tt class="docutils literal">backend0</tt> must always be the root base class
- template and that <tt class="docutils literal">frontend</tt> must always be the most derived class template,
- the other back-ends can be chained together in different orders.</p>
- <pre class="literal-block">
- char const* p = "foo";
- frontend<
- backend2<backend1<backend0<char const*>, char>, int>
- > composed_obj0;
- frontend<
- backend1<backend2<backend0<char const*>, int>, char>
- > composed_obj1;
- composed_obj0(_a2 = 4, _a1 = ' ', _a0 = p);
- composed_obj1(_a0 = p, _a1 = ' ', _a2 = 4);
- BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
- BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
- BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
- </pre>
- <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
- programs demonstrate proper usage of this macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function call operator.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <p>None.</p>
- <p><strong>Approximate expansion:</strong></p>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename TaggedArg0, typename ...TaggedArgs>
- using boost_param_no_spec_result_ ## __LINE__ ## operator = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename TaggedArg0, typename ...TaggedArgs>
- struct boost_param_no_spec_result_ ## __LINE__ ## operator
- {
- typedef <strong>result</strong> type;
- };
- template <typename TaggedArg0, typename ...TaggedArgs>
- inline typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a><
- <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a><TaggedArg0,TaggedArgs...>
- , boost_param_no_spec_result_ ## __LINE__ ## operator<
- TaggedArg0
- , TaggedArgs...
- >
- >::type
- operator()(TaggedArg0 const& arg0, TaggedArgs const&... args)
- {
- return this->boost_param_no_spec_impl ## __LINE__ ## operator(
- static_cast<
- typename
- boost_param_no_spec_result_ ## __LINE__ ## operator<
- TaggedArg0
- , TaggedArgs...
- >::type(*)()
- >(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , <a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a>(arg0, args...)
- );
- }
- template <typename ResultType, typename Args>
- ResultType
- boost_param_no_spec_impl ## __LINE__ ## operator(
- (ResultType(*)())
- , Args const& args
- )
- </pre>
- <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
- available for use within the function body.</p>
- </div>
- <div class="section" id="boost-parameter-no-spec-const-function-call-operator-result">
- <span id="boost-parameter-no-spec-const-function-call-operator"></span><h2><a class="toc-backref" href="#id72">7.16 <tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR(result)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a function call operator that can take in named arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>The return type of each of the following function templates falls under a
- different value category.</p>
- <pre class="literal-block">
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> rvalue_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const rvalue_const_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>& lvalue_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return lset;
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const& lvalue_const_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return clset;
- }
- </pre>
- <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
- <pre class="literal-block">
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- </pre>
- <p>Named parameters are required when invoking the function call operator;
- however, none of their tags need to be in the same namespace.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw0) in(lrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw1) in_out(lr))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw2) in(rrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw3) consume(rr))
- </pre>
- <p>Use the macro as a substitute for a variadic function call operator
- header. Enclose the return type <tt class="docutils literal">bool</tt> in parentheses. The macro will
- qualify the function with the <tt class="docutils literal">const</tt> keyword.</p>
- <pre class="literal-block">
- struct D
- {
- D()
- {
- }
- BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR((bool))
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(
- args[_rr | rvalue_bitset<3>()]
- )
- );
- return true;
- }
- };
- </pre>
- <p>To invoke the function call operator, bind all its arguments to named
- parameters.</p>
- <pre class="literal-block">
- D const d = D();
- d(
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- d(
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- </pre>
- <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
- macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">result</tt> is the parenthesized return type of the function call operator.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <p>None.</p>
- <p><strong>Approximate expansion:</strong></p>
- <pre class="literal-block">
- // 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>,
- // <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>,
- // <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>,
- // <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
- // <a class="reference external" href="http://en.cppreference.com/w/cpp/types/enable_if">std::enable_if</a>:
- template <typename TaggedArg0, typename ...TaggedArgs>
- using boost_param_no_spec_result_const_ ## __LINE__ ## operator = <strong>result</strong>;
- // If <strong>result</strong> is a simple return type:
- template <typename TaggedArg0, typename ...TaggedArgs>
- struct boost_param_no_spec_result_const_ ## __LINE__ ## operator
- {
- typedef <strong>result</strong> type;
- };
- template <typename TaggedArg0, typename ...TaggedArgs>
- inline typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::lazy_enable_if</a><
- <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a><TaggedArg0,TaggedArgs...>
- , boost_param_no_spec_result_const_ ## __LINE__ ## operator<
- TaggedArg0
- , TaggedArgs...
- >
- >::type
- operator()(
- TaggedArg0 const& arg0
- , TaggedArgs const&... args
- ) const
- {
- return this->boost_param_no_spec_impl_const ## __LINE__ ## operator(
- static_cast<
- typename
- boost_param_no_spec_result_const_ ## __LINE__ ## operator<
- TaggedArg0
- , TaggedArgs...
- >::type(*)()
- >(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- , <a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a>(arg0, args...)
- );
- }
- template <typename ResultType, typename Args>
- ResultType
- boost_param_no_spec_impl_const ## __LINE__ ## operator(
- (ResultType(*)())
- , Args const& args
- ) const
- </pre>
- <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
- available for use within the function body.</p>
- </div>
- <div class="section" id="boost-parameter-no-spec-constructor-cls-impl">
- <span id="boost-parameter-no-spec-constructor"></span><h2><a class="toc-backref" href="#id73">7.17 <tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(cls, impl)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a constructor that can take in named arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>When designing a front-end class template whose back-end is configurable via
- parameterized inheritance, it can be useful to omit argument specifiers from
- a named-parameter constructor so that the delegate constructors of the
- back-end classes can enforce their own specifications.</p>
- <pre class="literal-block">
- template <typename B>
- struct frontend : B
- {
- BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(frontend, (B))
- };
- </pre>
- <p>Named parameters are required when invoking the constructor; however, none of
- their tags need to be in the same namespace.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a0)
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a1)
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(a2)
- </pre>
- <p>For this example, each of the back-end class templates requires its own
- parameter to be present in the argument pack. In practice, such parameters
- should be optional, with default values.</p>
- <pre class="literal-block">
- struct _enabler
- {
- };
- template <typename T>
- class backend0
- {
- T a0;
- public:
- template <typename ArgPack>
- explicit backend0(
- ArgPack const& args
- , typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- <a class="reference internal" href="#is-argument-pack"><tt class="docutils literal">is_argument_pack</tt></a><ArgPack>
- , _enabler
- >::type = _enabler()
- ) : a0(args[_a0])
- {
- }
- T const& get_a0() const
- {
- return this->a0;
- }
- };
- template <typename B, typename T>
- class backend1 : public B
- {
- T a1;
- public:
- template <typename ArgPack>
- explicit backend1(
- ArgPack const& args
- , typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- <a class="reference internal" href="#is-argument-pack"><tt class="docutils literal">is_argument_pack</tt></a><ArgPack>
- , _enabler
- >::type = _enabler()
- ) : B(args), a1(args[_a1])
- {
- }
- T const& get_a1() const
- {
- return this->a1;
- }
- };
- template <typename B, typename T>
- class backend2 : public B
- {
- T a2;
- public:
- template <typename ArgPack>
- explicit backend2(
- ArgPack const& args
- , typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- <a class="reference internal" href="#is-argument-pack"><tt class="docutils literal">is_argument_pack</tt></a><ArgPack>
- , _enabler
- >::type = _enabler()
- ) : B(args), a2(args[_a2])
- {
- }
- T const& get_a2() const
- {
- return this->a2;
- }
- };
- </pre>
- <p>This example shows that while <tt class="docutils literal">backend0</tt> must always be the root base class
- template and that <tt class="docutils literal">frontend</tt> must always be the most derived class template,
- the other back-ends can be chained together in different orders.</p>
- <pre class="literal-block">
- char const* p = "foo";
- frontend<
- backend2<backend1<backend0<char const*>, char>, int>
- > composed_obj0(_a2 = 4, _a1 = ' ', _a0 = p);
- frontend<
- backend1<backend2<backend0<char const*>, int>, char>
- > composed_obj1(_a0 = p, _a1 = ' ', _a2 = 4);
- BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0());
- BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1());
- BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2());
- </pre>
- <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
- programs demonstrate proper usage of this macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">cls</tt> is the name of the enclosing class.</li>
- <li><tt class="docutils literal">impl</tt> is the parenthesized implementation base class for <tt class="docutils literal">cls</tt>.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <p>None.</p>
- <p><strong>Approximate expansion:</strong></p>
- <pre class="literal-block">
- template <
- typename TaggedArg0
- , typename ...TaggedArgs
- , typename = typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a><TaggedArg0,TaggedArgs...>
- >::type
- >
- inline explicit <strong>cls</strong>(
- TaggedArg0 const& arg0
- , TaggedArgs const&... args
- ) : <strong>impl</strong>(<a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a>(arg0, args...))
- {
- }
- </pre>
- </div>
- <div class="section" id="boost-parameter-no-spec-no-base-constructor-cls-impl">
- <span id="boost-parameter-no-spec-no-base-constructor"></span><h2><a class="toc-backref" href="#id74">7.18 <tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(cls, impl)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Generates a constructor that can take in named arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>The return type of each of the following function templates falls under a
- different value category.</p>
- <pre class="literal-block">
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> rvalue_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const rvalue_const_bitset()
- {
- return <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>& lvalue_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> lset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return lset;
- }
- template <std::size_t N>
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const& lvalue_const_bitset()
- {
- static <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const clset = <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>();
- return clset;
- }
- </pre>
- <p>The <tt class="docutils literal"><span class="pre">U::evaluate_category</span></tt> static member function template has a simple job:
- to return the correct value category when passed in an object returned by one
- of the functions defined above. Assume that
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> is defined.</p>
- <pre class="literal-block">
- enum invoked
- {
- passed_by_lvalue_reference_to_const
- , passed_by_lvalue_reference
- , passed_by_rvalue_reference_to_const
- , passed_by_rvalue_reference
- };
- struct U
- {
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&)
- {
- return passed_by_lvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&)
- {
- return passed_by_lvalue_reference;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1> const&&)
- {
- return passed_by_rvalue_reference_to_const;
- }
- template <std::size_t N>
- static invoked evaluate_category(<a class="reference external" href="http://en.cppreference.com/w/cpp/utility/bitset">std::bitset</a><N + 1>&&)
- {
- return passed_by_rvalue_reference;
- }
- };
- </pre>
- <p>Named parameters are required when invoking the constructor; however, none of
- their tags need to be in the same namespace.</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lrc, kw0) in(lrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_lr, kw1) in_out(lr))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rrc, kw2) in(rrc))
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>((_rr, kw3) consume(rr))
- </pre>
- <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
- base class, only a delegate function to which the generated constructor can
- pass its <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</p>
- <pre class="literal-block">
- struct D
- {
- BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(D, D::_evaluate)
- private:
- template <typename Args>
- static bool _evaluate(Args const& args)
- {
- BOOST_TEST_EQ(
- passed_by_lvalue_reference_to_const
- , U::evaluate_category<0>(args[_lrc])
- );
- BOOST_TEST_EQ(
- passed_by_lvalue_reference
- , U::evaluate_category<1>(args[_lr])
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference_to_const
- , U::evaluate_category<2>(
- args[_rrc | rvalue_const_bitset<2>()]
- )
- );
- BOOST_TEST_EQ(
- passed_by_rvalue_reference
- , U::evaluate_category<3>(
- args[_rr | rvalue_bitset<3>()]
- )
- );
- return true;
- }
- };
- </pre>
- <p>To invoke the constructor, bind all its arguments to named parameters.</p>
- <pre class="literal-block">
- D dp0(
- _rr0 = rvalue_bitset<3>()
- , _lrc0 = lvalue_const_bitset<0>()
- , _lr0 = lvalue_bitset<1>()
- , _rrc0 = rvalue_const_bitset<2>()
- );
- D dp1(
- _lr0 = lvalue_bitset<1>()
- , _lrc0 = lvalue_const_bitset<0>()
- );
- </pre>
- <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 macro.</p>
- <p><strong>Macro parameters:</strong></p>
- <ul class="simple">
- <li><tt class="docutils literal">cls</tt> is the name of the enclosing class.</li>
- <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
- generated constructor passes on.</li>
- </ul>
- <p><strong>Argument specifiers syntax:</strong></p>
- <p>None.</p>
- <p><strong>Approximate expansion:</strong></p>
- <pre class="literal-block">
- template <
- typename TaggedArg0
- , typename ...TaggedArgs
- , typename = typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><
- <a class="reference internal" href="#are-tagged-arguments"><tt class="docutils literal">are_tagged_arguments</tt></a><TaggedArg0,TaggedArgs...>
- >::type
- >
- inline explicit <strong>cls</strong>(
- TaggedArg0 const& arg0
- , TaggedArgs const&... args
- )
- {
- <strong>func</strong>(<a class="reference internal" href="#compose"><tt class="docutils literal">compose</tt></a>(arg0, args...));
- }
- </pre>
- </div>
- <div class="section" id="boost-parameter-name-name">
- <span id="boost-parameter-name"></span><h2><a class="toc-backref" href="#id75">7.19 <tt class="docutils literal">BOOST_PARAMETER_NAME(name)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Declares a tag-type and keyword object.</p>
- <p><strong>If</strong> <em>name</em> is of the form:</p>
- <pre class="literal-block">
- (<em>object-name</em>, <em>namespace-name</em>) <em>qualifier</em>(<em>tag-name</em>)
- </pre>
- <p><strong>then</strong></p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>,
- <tt class="docutils literal">move_from</tt>, or <tt class="docutils literal">forward</tt>.</td>
- </tr>
- <tr class="field"><th class="field-name">Expands to:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- namespace <em>namespace-name</em> {
- struct <em>tag-name</em>
- {
- static constexpr char const* keyword_name()
- {
- return ## <em>tag-name</em>;
- }
- typedef <em>unspecified</em> _;
- typedef <em>unspecified</em> _1;
- typedef boost::parameter::<em>qualifier</em> ## _reference qualifier;
- // The following definitions are available only when
- // <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> is defined.
- template <typename ArgumentPack>
- using binding_fn = typename <a class="reference internal" href="#binding"><tt class="docutils literal">binding</tt></a><
- ArgumentPack
- , <em>tag-name</em>
- >::type;
- template <typename ArgumentPack>
- using fn = typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><ArgumentPack, <em>tag-name</em>>::type;
- };
- }
- <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><<em>tag-namespace</em>::<em>tag-name</em>> const& <em>object-name</em>
- = <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><<em>tag-namespace</em>::<em>tag-name</em>>::instance;
- </pre>
- <p><strong>Else If</strong> <em>name</em> is of the form:</p>
- <pre class="literal-block">
- (<em>tag-name</em>, <em>namespace-name</em>) <em>object-name</em>
- </pre>
- <p><strong>then</strong></p>
- <p>Treats <em>name</em> as if it were of the form:</p>
- <pre class="literal-block">
- (forward(<em>tag-name</em>), <em>namespace-name</em>) <em>object-name</em>
- </pre>
- <p><strong>Else If</strong> <em>name</em> is of the form:</p>
- <pre class="literal-block">
- <em>qualifier</em>(<em>tag-name</em>)
- </pre>
- <p><strong>then</strong></p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>,
- <tt class="docutils literal">move_from</tt>, or <tt class="docutils literal">forward</tt>.</td>
- </tr>
- <tr class="field"><th class="field-name">Expands to:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- namespace tag {
- struct <em>tag-name</em>
- {
- static constexpr char const* keyword_name()
- {
- return ## <em>tag-name</em>;
- }
- typedef <em>unspecified</em> _;
- typedef <em>unspecified</em> _1;
- typedef boost::parameter::<em>qualifier</em> ## _reference qualifier;
- // The following definitions are available only when
- // <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> is defined.
- template <typename ArgumentPack>
- using binding_fn = typename <a class="reference internal" href="#binding"><tt class="docutils literal">binding</tt></a><
- ArgumentPack
- , <em>tag-name</em>
- >::type;
- template <typename ArgumentPack>
- using fn = typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><ArgumentPack, <em>tag-name</em>>::type;
- };
- }
- <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><tag::<em>tag-name</em>> const& _ ## <em>tag-name</em>
- = <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><tag::<em>tag-name</em>>::instance;
- </pre>
- <p><strong>Else</strong></p>
- <p>Treats <em>name</em> as if it were of the form:</p>
- <pre class="literal-block">
- forward(<em>tag-name</em>)
- </pre>
- </div>
- <div class="section" id="boost-parameter-nested-keyword-tag-namespace-name-alias">
- <span id="boost-parameter-nested-keyword"></span><h2><a class="toc-backref" href="#id76">7.20 <tt class="docutils literal">BOOST_PARAMETER_NESTED_KEYWORD(tag_namespace, name, alias)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- <p>Declares a tag-type, a keyword object, and an alias for that object nested in
- the tag-type.</p>
- <p><strong>If</strong> <em>name</em> is of the form:</p>
- <pre class="literal-block">
- <em>qualifier</em>(<em>tag-name</em>)
- </pre>
- <p><strong>then</strong></p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>,
- <tt class="docutils literal">move_from</tt>, or <tt class="docutils literal">forward</tt>.</td>
- </tr>
- <tr class="field"><th class="field-name">Expands to:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- namespace tag {
- struct <em>tag-name</em>
- {
- static constexpr char const* keyword_name()
- {
- return ## <em>tag-name</em> ## _;
- }
- typedef <em>unspecified</em> _;
- typedef <em>unspecified</em> _1;
- typedef boost::parameter::<em>qualifier</em> ## _reference qualifier;
- static <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><<em>tag-name</em>> const& <em>alias</em>;
- // The following definitions are available only when
- // <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> is defined.
- template <typename ArgumentPack>
- using binding_fn = typename <a class="reference internal" href="#binding"><tt class="docutils literal">binding</tt></a><
- ArgumentPack
- , <em>tag-name</em>
- >::type;
- template <typename ArgumentPack>
- using fn = typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><ArgumentPack, <em>tag-name</em>>::type;
- };
- <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><<em>tag-name</em>> const& tag::<em>tag-name</em>::<em>alias</em>
- = <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><<em>tag-name</em>>::instance;
- }
- <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><tag::<em>tag-name</em>> const& tag::<em>tag-name</em>::<em>name</em>
- = <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><tag::<em>tag-name</em>>::instance;
- </pre>
- <p><strong>Else</strong></p>
- <p>Treats <em>name</em> as if it were of the form:</p>
- <pre class="literal-block">
- forward(<em>tag-name</em>)
- </pre>
- </div>
- <div class="section" id="boost-parameter-template-keyword-name">
- <span id="boost-parameter-template-keyword"></span><h2><a class="toc-backref" href="#id77">7.21 <tt class="docutils literal">BOOST_PARAMETER_TEMPLATE_KEYWORD(name)</tt></a></h2>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <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>
- </tr>
- <tr class="field"><th class="field-name">Expands to:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- namespace tag {
- struct <em>name</em>;
- }
- template <typename T>
- struct <em>name</em> : <a class="reference internal" href="#template-keyword"><tt class="docutils literal">template_keyword</tt></a><tag:: <em>name</em>, T>
- {
- };
- </pre>
- <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
- this macro.</p>
- </div>
- <div class="section" id="boost-parameter-fun-r-n-l-h-p">
- <span id="boost-parameter-fun"></span><h2><a class="toc-backref" href="#id78">7.22 <tt class="docutils literal">BOOST_PARAMETER_FUN(r, n, l, h, p)</tt></a></h2>
- <div class="admonition-deprecated admonition">
- <p class="first admonition-title">Deprecated</p>
- <p class="last">This macro has been deprecated in favor of
- <tt class="docutils literal">BOOST_PARAMETER_FUNCTION</tt>.</p>
- </div>
- <p>Generates a sequence of <a class="reference external" href="index.html#forwarding-functions">forwarding function</a> templates named
- <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>,
- and using <tt class="docutils literal">p</tt> to control overload resolution and assign tags to
- positional arguments.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <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
- such that <tt class="docutils literal">l</tt> < <tt class="docutils literal">h</tt></td>
- </tr>
- <tr class="field"><th class="field-name">Expands to:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- template <typename A1, typename A2, …, typename A ## <strong>l</strong>>
- r
- name(
- A1 && a1, A2 && a2, …, A ## <strong>l</strong> && a ## <strong>l</strong>
- , typename <strong>p</strong>::match<A1, A2, …, A ## <strong>l</strong>>::type p = <strong>p</strong>()
- )
- {
- return <strong>name</strong>_with_named_params(
- <strong>p</strong>(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A1>(a1)
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A2>(a2)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>l</strong>>(a ## <strong>l</strong>)
- )
- );
- }
- template <
- typename A1
- , typename A2
- , …
- , typename A ## <strong>l</strong>
- , typename A ## <a class="reference external" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>)
- >
- r
- name(
- A1 && a1, A2 && a2, …, A ## <strong>l</strong> && a ## <strong>l</strong>
- , A ## <a class="reference external" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>) const& a ## <a class="reference external" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>)
- , typename <strong>p</strong>::match<
- A1, A2, …, A ## <strong>l</strong>, A ## <a class="reference external" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>)
- >::type p = <strong>p</strong>()
- )
- {
- return <strong>name</strong>_with_named_params(
- <strong>p</strong>(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A1>(a1)
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A2>(a2)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>l</strong>>(a ## <strong>l</strong>)
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <a class="reference external" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>)>(
- a ## <a class="reference external" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>)
- )
- )
- );
- }
- <span class="vellipsis">⋮</span>
- template <typename A1, typename A2, …, typename A ## <strong>h</strong>>
- r
- name(
- A1 && a1, A2 && a2, …, A ## <strong>h</strong> && x ## <strong>h</strong>
- , typename <strong>p</strong>::match<A1, A2, …, A ## <strong>h</strong>>::type p = <strong>p</strong>()
- )
- {
- return <strong>name</strong>_with_named_params(
- <strong>p</strong>(
- <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A1>(a1)
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A2>(a2)
- , …
- , <a class="reference external" href="http://en.cppreference.com/w/cpp/utility/forward">std::forward</a><A ## <strong>h</strong>>(a ## <strong>h</strong>)
- )
- );
- }
- </pre>
- <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
- usage of this macro.</p>
- </div>
- <div class="section" id="boost-parameter-keyword-n-k">
- <span id="boost-parameter-keyword"></span><h2><a class="toc-backref" href="#id79">7.23 <tt class="docutils literal">BOOST_PARAMETER_KEYWORD(n, k)</tt></a></h2>
- <div class="admonition-deprecated admonition">
- <p class="first admonition-title">Deprecated</p>
- <p class="last">This macro has been deprecated in favor of
- <tt class="docutils literal">BOOST_PARAMETER_NAME</tt>.</p>
- </div>
- <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
- namespace <tt class="docutils literal">n</tt> and a corresponding <a class="reference internal" href="#keyword-object">keyword object</a> definition in
- the enclosing namespace.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <tr class="field"><th class="field-name">Expands to:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- namespace <strong>n</strong> {
- struct <strong>k</strong>
- {
- static constexpr char const* keyword_name()
- {
- return ## <em>k</em>;
- }
- typedef <em>unspecified</em> _;
- typedef <em>unspecified</em> _1;
- typedef boost::parameter::forward_reference qualifier;
- // The following definitions are available only when
- // <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> is defined.
- template <typename ArgumentPack>
- using binding_fn = typename <a class="reference internal" href="#binding"><tt class="docutils literal">binding</tt></a><
- ArgumentPack
- , <em>k</em>
- >::type;
- template <typename ArgumentPack>
- using fn = typename <a class="reference internal" href="#value-type"><tt class="docutils literal">value_type</tt></a><ArgumentPack, <em>k</em>>::type;
- };
- }
- namespace {
- <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><<em>n</em>::<strong>k</strong>> const& <strong>k</strong>
- = <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><<em>n</em>::<strong>k</strong>>::instance;
- }
- </pre>
- </div>
- <div class="section" id="boost-parameter-match-p-a-x">
- <h2><a class="toc-backref" href="#id80">7.24 <tt class="docutils literal">BOOST_PARAMETER_MATCH(p, a, x)</tt></a></h2>
- <p>Generates a defaulted parameter declaration for a <a class="reference external" href="index.html#forwarding-functions">forwarding function</a>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <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>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- (A0)(A1)…(A ## <em>n</em>)
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Expands to:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- typename <strong>p</strong>::match<<strong>A0</strong>, <strong>A1</strong>, …, <strong>A</strong> ## <em>n</em>>::type
- <strong>x</strong> = <strong>p</strong>()
- </pre>
- </div>
- </div>
- <div class="section" id="configuration-macros">
- <h1><a class="toc-backref" href="#id81">8 Configuration Macros</a></h1>
- <div class="section" id="id21">
- <span id="boost-parameter-has-perfect-forwarding"></span><h2><a class="toc-backref" href="#id82">8.1 <tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a></h2>
- <p>Determines whether or not the library supports perfect forwarding, or the
- preservation of parameter value categories. Users can manually disable this
- 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>
- macro. Otherwise, the library will <tt class="docutils literal">#define</tt> this macro if and only if it
- is not already defined, and if the configuration macros
- <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>,
- <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
- <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
- <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="section" id="id22">
- <span id="boost-parameter-disable-perfect-forwarding"></span><h2><a class="toc-backref" href="#id83">8.2 <tt class="docutils literal">BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING</tt></a></h2>
- <p>It may be necessary to test user code in case perfect forwarding support is
- unavailable. Users can <tt class="docutils literal">#define</tt> this macro either in their project
- settings or before including any library header files. Doing so will leave
- both <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> and
- <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> undefined.</p>
- </div>
- <div class="section" id="id23">
- <span id="boost-parameter-can-use-mp11"></span><h2><a class="toc-backref" href="#id84">8.3 <tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a></h2>
- <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
- metaprogramming library. Users can manually disable this macro by
- <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
- <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
- will <tt class="docutils literal">#define</tt> this macro if and only if it is not already defined, if
- <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
- 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>,
- <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>,
- <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>,
- <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>
- are not already defined by <a class="reference external" href="../../../config/doc/html/index.html">Boost.Config</a>.</p>
- <div class="admonition-usage-note admonition">
- <p class="first admonition-title">Usage Note</p>
- <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
- perfectly acceptable to specify deduced parameters using both quoted
- metafunctions and metafunction classes, for example. See
- <a class="reference external" href="../../test/evaluate_category.cpp">evaluate_category.cpp</a>.</p>
- </div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <tr class="field"><th class="field-name">Example usage:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <p>Given the following definitions:</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(x)
- template <typename A0>
- typename <a class="reference external" href="../../../core/doc/html/core/enable_if.html">boost::enable_if</a><<a class="reference external" href="http://en.cppreference.com/w/cpp/types/is_same">std::is_same</a><int,A0>,int>::type
- sfinae(A0 const& a0)
- {
- return 0;
- }
- </pre>
- <p><a class="reference external" href="../../../mp11/doc/html/mp11.html">Boost.MP11</a> allows deduced parameters to be defined more succinctly:</p>
- <pre class="literal-block">
- template <typename T, typename Args>
- using predicate = <a class="reference external" href="http://en.cppreference.com/w/cpp/types/is_convertible">std::is_convertible</a><T,char const*>;
- <a class="reference internal" href="#boost-parameter-function"><tt class="docutils literal">BOOST_PARAMETER_FUNCTION</tt></a>((int), sfinae, tag,
- (deduced
- (optional
- (x
- , *(<a class="reference external" href="../../../mp11/doc/html/mp11.html#mp_quotef">boost::mp11::mp_quote</a><predicate>)
- , static_cast<char const*>(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- )
- )
- )
- )
- {
- return 1;
- }
- </pre>
- <p>Without <a class="reference external" href="../../../mp11/doc/html/mp11.html">Boost.MP11</a>, deduced parameter definitions tend to be more verbose:</p>
- <pre class="literal-block">
- struct predicate
- {
- template <typename T, typename Args>
- struct apply
- : <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_convertible.html">boost::is_convertible</a><T,char const*>
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Still have to convert to a
- , <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>.
- >
- {
- };
- };
- <a class="reference internal" href="#boost-parameter-function"><tt class="docutils literal">BOOST_PARAMETER_FUNCTION</tt></a>((int), sfinae, tag,
- (deduced
- (optional
- (x
- , *(predicate)
- , static_cast<char const*>(<a class="reference external" href="http://en.cppreference.com/w/cpp/language/nullptr">std::nullptr</a>)
- )
- )
- )
- )
- {
- return 1;
- }
- </pre>
- <p>Either way, the following assertions will succeed:</p>
- <pre class="literal-block">
- assert(1 == sfinae());
- assert(1 == sfinae("foo"));
- assert(0 == sfinae(1));
- </pre>
- <p>As another example, given the following declarations and definitions:</p>
- <pre class="literal-block">
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(x)
- <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a>(y)
- template <typename E, typename Args>
- void check0(E const& e, Args const& args);
- template <typename P, typename E, typename ...Args>
- void check(E const& e, Args const&... args)
- {
- check0(e, P()(args...));
- }
- </pre>
- <p>Argument packs qualify as <a class="reference external" href="../../../mp11/doc/html/mp11.html">Boost.MP11</a>-style lists containing
- <a class="reference internal" href="#keyword-tag-type">keyword tag type</a>s:</p>
- <pre class="literal-block">
- template <typename Args>
- struct some_functor
- {
- template <typename K>
- void operator()(K&&) const
- {
- // K is one of tag::x, tag::y, etc.
- }
- };
- template <typename E, typename Args>
- void check0(E const& e, Args const& args)
- {
- boost::mp11::mp_for_each<E>(some_functor<Args>());
- }
- </pre>
- <p>The first check determines whether or not the argument type of <tt class="docutils literal">_y</tt> is the
- same as the reference type of <tt class="docutils literal">_x</tt>, while the second check determines
- whether or not the argument type of <tt class="docutils literal">_y</tt> is convertible to the value type of
- <tt class="docutils literal">_x</tt>. Here, it's possible to access the reference and value result types of
- indexing an argument pack a little more directly:</p>
- <pre class="literal-block">
- // Use mp_bind on tag::x::binding_fn to access the reference type of _x.
- check<
- <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- tag::x
- , <a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a><
- <a class="reference internal" href="#deduced"><tt class="docutils literal">deduced</tt></a><tag::y>
- , <a class="reference external" href="../../../mp11/doc/html/mp11.html#mp_bindf_t">boost::mp11::mp_bind</a><
- <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.
- , <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.
- , <a class="reference external" href="../../../mp11/doc/html/mp11.html#mp_bindf_t">boost::mp11::mp_bind</a><
- tag::x::binding_fn
- , <a class="reference external" href="../../../mp11/doc/html/mp11.html#1_9">boost::mp11::_2</a> // will be bound to the argument pack type.
- >
- >
- >
- >
- >((_x = 0, _y = 1), 0, 1);
- // Use mp_bind_q on tag::x to access the value type of _x.
- check<
- <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- tag::x
- , <a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a><
- <a class="reference internal" href="#deduced"><tt class="docutils literal">deduced</tt></a><tag::y>
- , <a class="reference external" href="../../../mp11/doc/html/mp11.html#mp_bindf_t">boost::mp11::mp_bind</a><
- <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.
- , <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.
- , <a class="reference external" href="../../../mp11/doc/html/mp11.html#mp_bind_qq_t">boost::mp11::mp_bind_q</a><
- tag::x
- , <a class="reference external" href="../../../mp11/doc/html/mp11.html#1_9">boost::mp11::_2</a> // will be bound to the argument pack type.
- >
- >
- >
- >
- >((_x = 0U, _y = 1U), 0U, 1U);
- </pre>
- <p>Argument packs still qualify as <a class="reference external" href="../../../mpl/doc/index.html">Boost.MPL</a>-style lists containing
- <a class="reference internal" href="#keyword-tag-type">keyword tag type</a>s:</p>
- <pre class="literal-block">
- template <typename Args>
- struct some_functor
- {
- template <typename K>
- void operator()(K) const
- {
- // K is one of tag::x, tag::y, etc.
- }
- };
- template <typename E, typename Args>
- void check0(E const& e, Args const& args)
- {
- boost::mpl::for_each<E>(some_functor<Args>());
- }
- </pre>
- <p>However, without <a class="reference external" href="../../../mp11/doc/html/mp11.html">Boost.MP11</a>, the corresponding checks become a little more
- verbose:</p>
- <pre class="literal-block">
- check<
- <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- tag::x
- , <a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a><
- <a class="reference internal" href="#deduced"><tt class="docutils literal">deduced</tt></a><tag::y>
- , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_same.html">boost::is_same</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/add_lvalue_reference.html">boost::add_lvalue_reference</a><<a class="reference external" href="../../../mp11/doc/html/mp11.html#1_9">boost::mp11::_1</a>>
- , <a class="reference internal" href="#binding"><tt class="docutils literal">binding</tt></a><<a class="reference external" href="../../../mp11/doc/html/mp11.html#1_9">boost::mp11::_2</a>, tag::x>
- >
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Still have to convert to a
- , <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>.
- >
- >
- >
- >((_x = 0, _y = 1), 0, 1);
- // Use tag::x::_ or tag::x::_1 to access the value type of _x.
- check<
- <a class="reference internal" href="#parameters"><tt class="docutils literal">parameters</tt></a><
- tag::x
- , <a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a><
- <a class="reference internal" href="#deduced"><tt class="docutils literal">deduced</tt></a><tag::y>
- , <a class="reference external" href="../../../mpl/doc/refmanual/if.html">mpl::if_</a><
- <a class="reference external" href="../../../type_traits/doc/html/boost_typetraits/is_convertible.html">boost::is_convertible</a><<a class="reference external" href="../../../mp11/doc/html/mp11.html#1_9">boost::mp11::_1</a>, tag::x::_1>
- , <a class="reference external" href="../../../mpl/doc/refmanual/bool.html">mpl::true_</a> // Still have to convert to a
- , <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>.
- >
- >
- >
- >((_x = 0U, _y = 1U), 0U, 1U);
- </pre>
- <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
- <a class="reference external" href="../../test/deduced_dependent_predicate.cpp">deduced_dependent_predicate.cpp</a> test programs demonstrate proper usage of this
- macro.</p>
- </div>
- <div class="section" id="id24">
- <span id="boost-parameter-disable-mp11-usage"></span><h2><a class="toc-backref" href="#id85">8.4 <tt class="docutils literal">BOOST_PARAMETER_DISABLE_MP11_USAGE</tt></a></h2>
- <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
- cannot support it. Users can <tt class="docutils literal">#define</tt> this macro either in their project
- settings or before including any library header files. Doing so will leave
- <a class="reference internal" href="#boost-parameter-can-use-mp11"><tt class="docutils literal">BOOST_PARAMETER_CAN_USE_MP11</tt></a> undefined.</p>
- </div>
- <div class="section" id="id25">
- <span id="boost-parameter-variadic-mpl-sequence"></span><h2><a class="toc-backref" href="#id86">8.5 <tt class="docutils literal">BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE</tt></a></h2>
- <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
- 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
- <tt class="docutils literal">parameters</tt>. If the user does not manually <tt class="docutils literal">#define</tt> this macro, then the
- 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
- <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
- <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>),
- <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
- (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>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field"><th class="field-name">Example:</th><td class="field-body"></td>
- </tr>
- </tbody>
- </table>
- <pre class="literal-block">
- #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>
- </pre>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="section" id="id26">
- <span id="boost-parameter-max-arity"></span><h2><a class="toc-backref" href="#id87">8.6 <tt class="docutils literal">BOOST_PARAMETER_MAX_ARITY</tt></a></h2>
- <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>
- <ul class="simple">
- <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>
- type of <tt class="docutils literal">parameters</tt> does not have a size limit--which is the case with
- <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
- <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
- 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
- manually define this macro to the size limit of the sequence if it has
- one.</li>
- </ul>
- <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>
- <ul class="simple">
- <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
- by position to Boost.Parameter-enabled functions with arity greater than
- 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>
- </ul>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <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
- perfect forwarding is supported, <tt class="docutils literal">8</tt> otherwise.</td>
- </tr>
- <tr class="field"><th class="field-name">Minimum Value:</th><td class="field-body"><tt class="docutils literal">2</tt></td>
- </tr>
- <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>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="section" id="id27">
- <span id="boost-parameter-compose-max-arity"></span><h2><a class="toc-backref" href="#id88">8.7 <tt class="docutils literal">BOOST_PARAMETER_COMPOSE_MAX_ARITY</tt></a></h2>
- <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
- determines the maximum number of arguments supported by the <tt class="docutils literal">compose</tt> function
- and by the <a class="reference internal" href="#boost-parameter-no-spec-function"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_FUNCTION</tt></a>,
- <a class="reference internal" href="#boost-parameter-no-spec-member-function"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION</tt></a>,
- <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>,
- <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>,
- <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>,
- <a class="reference internal" href="#boost-parameter-no-spec-constructor"><tt class="docutils literal">BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR</tt></a>, and
- <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>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <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>
- </tr>
- <tr class="field"><th class="field-name">Minimum Value:</th><td class="field-body"><tt class="docutils literal">2</tt></td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="section" id="id28">
- <span id="boost-parameter-exponential-overload-threshold-arity"></span><h2><a class="toc-backref" href="#id89">8.8 <tt class="docutils literal">BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY</tt></a></h2>
- <p>If this library does <strong>not</strong> support perfect forwarding, determines the number
- of arguments less than which <tt class="docutils literal">parameters</tt> generates an exponential number of
- function call operator overloads, and greater than or equal to which
- <tt class="docutils literal">parameters</tt> does not. Will only be <tt class="docutils literal">#defined</tt> by the library if it is
- 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
- <strong>not</strong> <tt class="docutils literal">#defined</tt>.</p>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <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>
- </tr>
- <tr class="field"><th class="field-name">Default Value:</th><td class="field-body"><tt class="docutils literal">0</tt></td>
- </tr>
- <tr class="field"><th class="field-name">Minimum Value:</th><td class="field-body"><tt class="docutils literal">0</tt></td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="section" id="outside-of-this-library">
- <h2><a class="toc-backref" href="#id90">8.9 ...Outside Of This Library</a></h2>
- <ol class="arabic simple">
- <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_FUNCTION_TEMPLATE_ORDERING</tt></a>, 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
- <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
- code generation macros would not work correctly.</li>
- <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
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a> and
- <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
- types generated by <a class="reference internal" href="#boost-parameter-name"><tt class="docutils literal">BOOST_PARAMETER_NAME</tt></a> and
- <a class="reference internal" href="#boost-parameter-nested-keyword"><tt class="docutils literal">BOOST_PARAMETER_NESTED_KEYWORD</tt></a> would not work correctly.</li>
- <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_RVALUE_REFERENCES</tt></a>, 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
- <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>
- <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>,
- 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
- <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>
- <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_FUNCTION_TEMPLATE_DEFAULT_ARGS</tt></a>, 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
- <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>
- <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
- 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>
- <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>,
- 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>
- <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>,
- 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>
- <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>,
- 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>
- <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
- 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>
- <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>,
- 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>
- <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_INITIALIZER_LIST</tt></a>, 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>
- <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
- 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>
- <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>,
- if this library defines the macro
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a>, and if
- <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
- <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
- <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>
- <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>,
- if this library defines the macro
- <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a>, and if
- <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
- <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
- <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>
- <li>The value that <a class="reference external" href="../../../mpl/doc/index.html">Boost.MPL</a> defines the macro
- <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
- 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
- the macro <a class="reference internal" href="#boost-parameter-has-perfect-forwarding"><tt class="docutils literal">BOOST_PARAMETER_HAS_PERFECT_FORWARDING</tt></a>.</li>
- </ol>
- </div>
- </div>
- <div class="section" id="tutorial">
- <h1><a class="toc-backref" href="#id91">9 Tutorial</a></h1>
- <p>Follow <a class="reference external" href="index.html#tutorial">this link</a> to the Boost.Parameter tutorial documentation.</p>
- <hr class="docutils" />
- <table class="docutils footnote" frame="void" id="thread" rules="none">
- <colgroup><col class="label" /><col /></colgroup>
- <tbody valign="top">
- <tr><td class="label"><a class="fn-backref" href="#id2">[1]</a></td><td>References to tag objects may be initialized multiple
- times. This scenario can only occur in the presence of
- threading. Because the C++ standard doesn't consider threading,
- it doesn't explicitly allow or forbid multiple initialization of
- references. That said, it's hard to imagine an implementation
- where it could make a difference.</td></tr>
- </tbody>
- </table>
- <table class="docutils footnote" frame="void" id="no-result-of" rules="none">
- <colgroup><col class="label" /><col /></colgroup>
- <tbody valign="top">
- <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>,
- <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"><F()>::type</span></tt> is replaced by <tt class="docutils literal"><span class="pre">F::result_type</span></tt>.</td></tr>
- </tbody>
- </table>
- </div>
- </div>
- <div class="footer">
- <hr class="footer" />
- Generated on: 2019-12-10 00:22 UTC.
- 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.
- </div>
- </body>
- </html>
|