123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247 |
- [/==============================================================================
- Copyright (C) 2001-2011 Joel de Guzman
- Copyright (C) 2006 Dan Marsden
- Use, modification and distribution is subject to 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)
- ===============================================================================/]
- [section Container]
- Fusion provides a few predefined sequences out of the box. These
- /containers/ actually hold heterogeneously typed data; unlike
- __views__. These containers are more or less counterparts of those in __stl__.
- [heading Header]
- #include <boost/fusion/container.hpp>
- #include <boost/fusion/include/container.hpp>
- [section vector]
- [heading Description]
- `vector` is a __random_access_sequence__ of heterogeneous typed data
- structured as a simple `struct` where each element is held as a member
- variable. `vector` is the simplest of the Fusion sequence container (a
- vector with N elements is just a struct with N members), and in many
- cases the most efficient.
- [heading Header]
- #include <boost/fusion/container/vector.hpp>
- #include <boost/fusion/include/vector.hpp>
- #include <boost/fusion/container/vector/vector_fwd.hpp>
- #include <boost/fusion/include/vector_fwd.hpp>
- // numbered forms
- #include <boost/fusion/container/vector/vector10.hpp>
- #include <boost/fusion/include/vector10.hpp>
- #include <boost/fusion/container/vector/vector20.hpp>
- #include <boost/fusion/include/vector20.hpp>
- #include <boost/fusion/container/vector/vector30.hpp>
- #include <boost/fusion/include/vector30.hpp>
- #include <boost/fusion/container/vector/vector40.hpp>
- #include <boost/fusion/include/vector40.hpp>
- #include <boost/fusion/container/vector/vector50.hpp>
- #include <boost/fusion/include/vector50.hpp>
- [heading Synopsis]
- [*Numbered forms]
- struct vector0;
- template <typename T0>
- struct vector1;
- template <typename T0, typename T1>
- struct vector2;
- template <typename T0, typename T1, typename T2>
- struct vector3;
- ...
- template <typename T0, typename T1, typename T2..., typename TN>
- struct vectorN;
- [important Numbered forms will be deprecated in C++11 and it will be provided
- via aliasing templates. It means that your partial specialization
- might be compile error. You can detect whether it is aliasing
- templates or not, using `BOOST_FUSION_HAS_VARIADIC_VECTOR`.]
- [*Variadic form]
- template <
- typename T0 = __unspecified__
- , typename T1 = __unspecified__
- , typename T2 = __unspecified__
- ...
- , typename TN = __unspecified__
- >
- struct vector;
- The numbered form accepts the exact number of elements. Example:
- vector3<int, char, double>
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the The variadic form accepts `0` to
- `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a
- user definable predefined maximum that defaults to `10`. Example:
- vector<int, char, double>
- You may define the preprocessor constant `FUSION_MAX_VECTOR_SIZE` before
- including any Fusion header to change the default. Example:
- #define FUSION_MAX_VECTOR_SIZE 20
- [heading Template parameters]
- [table
- [[Parameter] [Description] [Default]]
- [[`T0`...`TN`] [Element types] [__unspecified__]]
- ]
- [heading Model of]
- * __random_access_sequence__
- [variablelist Notation
- [[`v`] [Instance of `vector`]]
- [[`V`] [A `vector` type]]
- [[`e0`...`en`] [Heterogeneous values]]
- [[`s`] [A __forward_sequence__]]
- ]
- [heading Expression Semantics]
- Semantics of an expression is defined only where it differs from, or is not
- defined in __random_access_sequence__.
- [table
- [[Expression] [Semantics]]
- [[`V()`] [Creates a vector with default constructed elements.]]
- [[`V(e0, e1,... en)`] [Creates a vector with elements `e0`...`en`.]]
- [[`V(s)`] [Copy constructs a vector from a __forward_sequence__, `s`.]]
- [[`v = s`] [Assigns to a vector, `v`, from a __forward_sequence__, `s`.]]
- ]
- [heading Example]
- vector<int, float> v(12, 5.5f);
- std::cout << __at_c__<0>(v) << std::endl;
- std::cout << __at_c__<1>(v) << std::endl;
- [endsect]
- [section cons]
- [heading Description]
- `cons` is a simple __forward_sequence__. It is a lisp style recursive list
- structure where `car` is the /head/ and `cdr` is the /tail/: usually
- another cons structure or `nil`: the empty list. Fusion's __list__ is built
- on top of this more primitive data structure. It is more efficient than
- __vector__ when the target sequence is constructed piecemeal (a data at a
- time). The runtime cost of access to each element is peculiarly constant
- (see __recursive_inline__).
- [heading Header]
- #include <boost/fusion/container/list/cons.hpp>
- #include <boost/fusion/include/cons.hpp>
- [heading Synopsis]
- template <typename Car, typename Cdr = nil>
- struct cons;
- [heading Template parameters]
- [table
- [[Parameter] [Description] [Default]]
- [[`Car`] [Head type] [ ]]
- [[`Cdr`] [Tail type] [`nil`]]
- ]
- [heading Model of]
- * __forward_sequence__
- [variablelist Notation
- [[`nil`] [An empty `cons`]]
- [[`C`] [A `cons` type]]
- [[`l`, `l2`] [Instances of `cons`]]
- [[`car`] [An arbitrary data]]
- [[`cdr`] [Another `cons` list]]
- [[`s`] [A __forward_sequence__]]
- [[`N`] [An __mpl_integral_constant__]]
- ]
- [heading Expression Semantics]
- Semantics of an expression is defined only where it differs from, or is not
- defined in __forward_sequence__.
- [table
- [[Expression] [Semantics]]
- [[`nil()`] [Creates an empty list.]]
- [[`C()`] [Creates a cons with default constructed elements.]]
- [[`C(car)`] [Creates a cons with `car` head and default constructed tail.]]
- [[`C(car, cdr)`] [Creates a cons with `car` head and `cdr` tail.]]
- [[`C(s)`] [Copy constructs a cons from a __forward_sequence__, `s`.]]
- [[`l = s`] [Assigns to a cons, `l`, from a __forward_sequence__, `s`.]]
- [[`__at__<N>(l)`] [The Nth element from the beginning of the sequence; see __at__.]]
- ]
- [note `__at__<N>(l)` is provided for convenience and compatibility
- with the original __tuple__ library, despite `cons` being a
- __forward_sequence__ only (`at` is supposed to be a
- __random_access_sequence__ requirement). The runtime complexity of __at__ is
- constant (see __recursive_inline__).]
- [heading Example]
- cons<int, cons<float> > l(12, cons<float>(5.5f));
- std::cout << __at_c__<0>(l) << std::endl;
- std::cout << __at_c__<1>(l) << std::endl;
- [endsect]
- [section list]
- [heading Description]
- `list` is a __forward_sequence__ of heterogeneous typed data built on top of
- __cons__. It is more efficient than __vector__ when the target sequence is
- constructed piecemeal (a data at a time). The runtime cost of access to
- each element is peculiarly constant (see __recursive_inline__).
- [heading Header]
- #include <boost/fusion/container/list.hpp>
- #include <boost/fusion/include/list.hpp>
- #include <boost/fusion/container/list/list_fwd.hpp>
- #include <boost/fusion/include/list_fwd.hpp>
- [heading Synopsis]
- template <
- typename T0 = __unspecified__
- , typename T1 = __unspecified__
- , typename T2 = __unspecified__
- ...
- , typename TN = __unspecified__
- >
- struct list;
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic class interface accepts `0` to
- `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
- definable predefined maximum that defaults to `10`. Example:
- list<int, char, double>
- You may define the preprocessor constant `FUSION_MAX_LIST_SIZE` before
- including any Fusion header to change the default. Example:
- #define FUSION_MAX_LIST_SIZE 20
- [heading Template parameters]
- [table
- [[Parameter] [Description] [Default]]
- [[`T0`...`TN`] [Element types] [__unspecified__]]
- ]
- [heading Model of]
- * __forward_sequence__
- [variablelist Notation
- [[`L`] [A `list` type]]
- [[`l`] [An instance of `list`]]
- [[`e0`...`en`] [Heterogeneous values]]
- [[`s`] [A __forward_sequence__]]
- [[`N`] [An __mpl_integral_constant__]]
- ]
- [heading Expression Semantics]
- Semantics of an expression is defined only where it differs from, or is not
- defined in __forward_sequence__.
- [table
- [[Expression] [Semantics]]
- [[`L()`] [Creates a list with default constructed elements.]]
- [[`L(e0, e1,... en)`] [Creates a list with elements `e0`...`en`.]]
- [[`L(s)`] [Copy constructs a list from a __forward_sequence__, `s`.]]
- [[`l = s`] [Assigns to a list, `l`, from a __forward_sequence__, `s`.]]
- [[`__at__<N>(l)`] [The Nth element from the beginning of the sequence; see __at__.]]
- ]
- [note `__at__<n>(l)` is provided for convenience and compatibility
- with the original __tuple__ library, despite `list` being a
- __forward_sequence__ only (__at__ is supposed to be a
- __random_access_sequence__ requirement). The runtime complexity of __at__ is
- constant (see __recursive_inline__).]
- [heading Example]
- list<int, float> l(12, 5.5f);
- std::cout << __at_c__<0>(l) << std::endl;
- std::cout << __at_c__<1>(l) << std::endl;
- [endsect]
- [section deque]
- [heading Description]
- `deque` is a simple __bidirectional_sequence__ that supports
- constant-time insertion and removal of elements at both ends. Like the
- __list__ and __cons__, `deque` is more efficient than __vector__
- (especially at compile time) when the target sequence is constructed
- piecemeal (a data at a time, e.g. when constructing expression
- templates). Like the __list__ and __cons__, runtime cost of access to
- each element is peculiarly constant (see __recursive_inline__).
- Element insertion and removal are done by special `deque` helper classes
- __front_extended_deque__ and __back_extended_deque__.
- [heading Header]
- #include <boost/fusion/container/deque.hpp>
- #include <boost/fusion/include/deque.hpp>
- #include <boost/fusion/container/deque/deque_fwd.hpp>
- #include <boost/fusion/include/deque_fwd.hpp>
- [heading Synopsis]
- template <typename ...Elements>
- struct deque;
- For C++11 compilers, the variadic class interface has no upper bound.
- For C++03 compilers, the variadic class interface accepts `0` to
- `FUSION_MAX_DEQUE_SIZE` elements, where `FUSION_MAX_DEQUE_SIZE` is a
- user definable predefined maximum that defaults to `10`. Example:
- deque<int, char, double>
- You may define the preprocessor constant `FUSION_MAX_DEQUE_SIZE` before
- including any Fusion header to change the default. Example:
- #define FUSION_MAX_DEQUE_SIZE 20
- [heading Template parameters]
- [table
- [[Parameter] [Description] [Default]]
- [[`Elements`] [Element types] [ ]]
- ]
- [heading Model of]
- * __bidirectional_sequence__
- [variablelist Notation
- [[`D`] [A `deque` type]]
- [[`d`, `d2`] [Instances of `deque`]]
- [[`e0`...`en`] [Heterogeneous values]]
- [[`s`] [A __forward_sequence__]]
- [[`N`] [An __mpl_integral_constant__]]
- ]
- [heading Expression Semantics]
- Semantics of an expression is defined only where it differs from, or is not
- defined in __bidirectional_sequence__.
- [table
- [[Expression] [Semantics]]
- [[`D()`] [Creates a deque with default constructed elements.]]
- [[`D(e0, e1,... en)`] [Creates a deque with elements `e0`...`en`.]]
- [[`D(s)`] [Copy constructs a deque from a __forward_sequence__, `s`.]]
- [[`d = s`] [Assigns to a deque, `d`, from a __forward_sequence__, `s`.]]
- [[`__at__<N>(d)`] [The Nth element from the beginning of the sequence; see __at__.]]
- ]
- [note `__at__<N>(d)` is provided for convenience, despite
- `deque` being a __bidirectional_sequence__ only (`at` is supposed to be
- a __random_access_sequence__ requirement). The runtime complexity of
- __at__ is constant (see __recursive_inline__). `deque` element access
- utilizes operator overloading with argument dependent lookup (ADL) of
- the proper element getter function given a static constant index
- parameter. Interestingly, with modern C++ compilers, this lookup is very
- fast and rivals recursive template instantiations in compile time-speed,
- so much so that `deque` relies on ADL for all element access (indexing)
- as well as iteration.]
- [heading Example]
- deque<int, float> d(12, 5.5f);
- std::cout << __at_c__<0>(d) << std::endl;
- std::cout << __at_c__<1>(d) << std::endl;
- [endsect]
- [section front_extended_deque]
- [heading Description]
- `front_extended_deque` allows a __deque__ to be front extended. It shares
- the same properties as the __deque__.
- [heading Header]
- See __deque__
- [heading Synopsis]
- template <typename Deque, typename T>
- struct front_extended_deque;
- [heading Template parameters]
- [table
- [[Parameter] [Description] [Default]]
- [[`Deque`] [Deque type] [ ]]
- [[`T`] [Element type] [ ]]
- ]
- [note `Deque` can be a __deque__, a __front_extended_deque__ or a
- __back_extended_deque__]
- [heading Model of]
- * __bidirectional_sequence__
- [variablelist Notation
- [[`D`] [A `front_extended_deque` type]]
- [[`e`] [Heterogeneous value]]
- [[`N`] [An __mpl_integral_constant__]]
- ]
- [heading Expression Semantics]
- Semantics of an expression is defined only where it differs from, or is
- not defined in __bidirectional_sequence__.
- [table
- [[Expression] [Semantics]]
- [[`D(d, e)`] [Extend `d` prepending `e` to its front.]]
- [[`__at__<N>(d)`] [The Nth element from the beginning of the sequence; see __at__.]]
- ]
- [note See __deque__ for further details.]
- [heading Example]
- typedef deque<int, float> initial_deque;
- initial_deque d(12, 5.5f);
- front_extended_deque<initial_deque, int> d2(d, 999);
- std::cout << __at_c__<0>(d2) << std::endl;
- std::cout << __at_c__<1>(d2) << std::endl;
- std::cout << __at_c__<2>(d2) << std::endl;
- [endsect]
- [section back_extended_deque]
- [heading Description]
- `back_extended_deque` allows a __deque__ to be back extended. It shares
- the same properties as the __deque__.
- [heading Header]
- See __deque__
- [heading Synopsis]
- template <typename Deque, typename T>
- struct back_extended_deque;
- [heading Template parameters]
- [table
- [[Parameter] [Description] [Default]]
- [[`Deque`] [Deque type] [ ]]
- [[`T`] [Element type] [ ]]
- ]
- [note `Deque` can be a __deque__, a __back_extended_deque__ or a
- __back_extended_deque__]
- [heading Model of]
- * __bidirectional_sequence__
- [variablelist Notation
- [[`D`] [A `back_extended_deque` type]]
- [[`e`] [Heterogeneous value]]
- [[`N`] [An __mpl_integral_constant__]]
- ]
- [heading Expression Semantics]
- Semantics of an expression is defined only where it differs from, or is
- not defined in __bidirectional_sequence__.
- [table
- [[Expression] [Semantics]]
- [[`D(d, e)`] [Extend `d` prepending `e` to its back.]]
- [[`__at__<N>(d)`] [The Nth element from the beginning of the sequence; see __at__.]]
- ]
- [note See __deque__ for further details.]
- [heading Example]
- typedef deque<int, float> initial_deque;
- initial_deque d(12, 5.5f);
- back_extended_deque<initial_deque, int> d2(d, 999);
- std::cout << __at_c__<0>(d2) << std::endl;
- std::cout << __at_c__<1>(d2) << std::endl;
- std::cout << __at_c__<2>(d2) << std::endl;
- [endsect]
- [section set]
- [heading Description]
- set is an __associative_sequence__ of heterogeneous typed data elements.
- Type identity is used to impose an equivalence relation on keys. The
- element's type is its key. A set may contain at most one element for each
- key. Membership testing and element key lookup has constant runtime
- complexity (see __overloaded_functions__).
- [heading Header]
- #include <boost/fusion/container/set.hpp>
- #include <boost/fusion/include/set.hpp>
- #include <boost/fusion/container/set/set_fwd.hpp>
- #include <boost/fusion/include/set_fwd.hpp>
- [heading Synopsis]
- template <
- typename T0 = __unspecified__
- , typename T1 = __unspecified__
- , typename T2 = __unspecified__
- ...
- , typename TN = __unspecified__
- >
- struct set;
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic class interface accepts `0` to
- `FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user
- definable predefined maximum that defaults to `10`. Example:
- set<int, char, double>
- You may define the preprocessor constant `FUSION_MAX_SET_SIZE` before
- including any Fusion header to change the default. Example:
- #define FUSION_MAX_SET_SIZE 20
- [heading Template parameters]
- [table
- [[Parameter] [Description] [Default]]
- [[`T0`...`TN`] [Element types] [__unspecified__]]
- ]
- [heading Model of]
- * __associative_sequence__
- * __forward_sequence__
- [variablelist Notation
- [[`S`] [A `set` type]]
- [[`s`] [An instance of `set`]]
- [[`e0`...`en`] [Heterogeneous values]]
- [[`fs`] [A __forward_sequence__]]
- ]
- [heading Expression Semantics]
- Semantics of an expression is defined only where it differs from, or is not
- defined in __random_access_sequence__ and __associative_sequence__.
- [table
- [[Expression] [Semantics]]
- [[`S()`] [Creates a set with default constructed elements.]]
- [[`S(e0, e1,... en)`] [Creates a set with elements `e0`...`en`.]]
- [[`S(fs)`] [Copy constructs a set from a __forward_sequence__ `fs`.]]
- [[`s = fs`] [Assigns to a set, `s`, from a __forward_sequence__ `fs`.]]
- ]
- [heading Example]
- typedef set<int, float> S;
- S s(12, 5.5f);
- std::cout << __at_key__<int>(s) << std::endl;
- std::cout << __at_key__<float>(s) << std::endl;
- std::cout << __result_of_has_key__<S, double>::value << std::endl;
- [endsect]
- [section map]
- [heading Description]
- map is an __associative_sequence__ of heterogeneous typed data elements.
- Each element is a key/data pair (see __fusion_pair__) where the key has no
- data (type only). Type identity is used to impose an equivalence relation
- on keys. A map may contain at most one element for each key. Membership
- testing and element key lookup has constant runtime complexity (see
- __overloaded_functions__).
- [heading Header]
- #include <boost/fusion/container/map.hpp>
- #include <boost/fusion/include/map.hpp>
- #include <boost/fusion/container/map/map_fwd.hpp>
- #include <boost/fusion/include/map_fwd.hpp>
- [heading Synopsis]
- template <
- typename T0 = __unspecified__
- , typename T1 = __unspecified__
- , typename T2 = __unspecified__
- ...
- , typename TN = __unspecified__
- >
- struct map;
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic class interface accepts `0` to
- `FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user
- definable predefined maximum that defaults to `10`. Example:
- map<__pair__<int, char>, __pair__<char, char>, __pair__<double, char> >
- You may define the preprocessor constant `FUSION_MAX_MAP_SIZE` before
- including any Fusion header to change the default. Example:
- #define FUSION_MAX_MAP_SIZE 20
- [heading Template parameters]
- [table
- [[Parameter] [Description] [Default]]
- [[`T0`...`TN`] [Element types] [__unspecified__]]
- ]
- [heading Model of]
- * __associative_sequence__
- * __random_access_sequence__
- [variablelist Notation
- [[`M`] [A `map` type]]
- [[`m`] [An instance of `map`]]
- [[`e0`...`en`] [Heterogeneous key/value pairs (see __fusion_pair__)]]
- [[`s`] [A __forward_sequence__]]
- ]
- [heading Expression Semantics]
- Semantics of an expression is defined only where it differs from, or is not
- defined in __forward_sequence__ and __associative_sequence__.
- [table
- [[Expression] [Semantics]]
- [[`M()`] [Creates a map with default constructed elements.]]
- [[`M(e0, e1,... en)`] [Creates a map with element pairs `e0`...`en`.]]
- [[`M(s)`] [Copy constructs a map from a __forward_sequence__ `s`.]]
- [[`m = s`] [Assigns to a map, `m`, from a __forward_sequence__ `s`.]]
- ]
- [heading Example]
- typedef map<
- __pair__<int, char>
- , __pair__<double, std::string> >
- map_type;
- map_type m(
- __fusion_make_pair__<int>('X')
- , __fusion_make_pair__<double>("Men"));
- std::cout << __at_key__<int>(m) << std::endl;
- std::cout << __at_key__<double>(m) << std::endl;
- [endsect]
- [section Generation]
- These are the functions that you can use to generate various forms of
- __containers__ from elemental values.
- [heading Header]
- #include <boost/fusion/container/generation.hpp>
- #include <boost/fusion/include/generation.hpp>
- [section Functions]
- [section make_list]
- [heading Description]
- Create a __list__ from one or more values.
- [heading Synopsis]
- template <typename T0, typename T1,... typename TN>
- typename __result_of_make_list__<T0, T1,... TN>::type
- make_list(T0 const& x0, T1 const& x1... TN const& xN);
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
- definable predefined maximum that defaults to `10`. You may define the
- preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
- header to change the default. Example:
- #define FUSION_MAX_LIST_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_list`]]
- ]
- [heading Expression Semantics]
- make_list(x0, x1,... xN);
- [*Return type]: __result_of_make_list__`<T0, T1,... TN>::type`
- [*Semantics]: Create a __list__ from `x0, x1,... xN`.
- [heading Header]
- #include <boost/fusion/container/generation/make_list.hpp>
- #include <boost/fusion/include/make_list.hpp>
- [heading Example]
- make_list(123, "hello", 12.5)
- [heading See also]
- __note_ref_wrappers__
- [endsect]
- [section make_cons]
- [heading Description]
- Create a __cons__ from `car` (/head/) and optional `cdr` (/tail/).
- [heading Synopsis]
- template <typename Car>
- typename __result_of_make_cons__<Car>::type
- make_cons(Car const& car);
- template <typename Car, typename Cdr>
- typename __result_of_make_cons__<Car, Cdr>::type
- make_cons(Car const& car, Cdr const& cdr);
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`car`] [Instance of `Car`] [The list's head]]
- [[`cdr`] [Instance of `Cdr`] [The list's tail (optional)]]
- ]
- [heading Expression Semantics]
- make_cons(car, cdr);
- [*Return type]: __result_of_make_cons__`<Car, Cdr>::type` or
- __result_of_make_cons__`<Car>::type`
- [*Semantics]: Create a __cons__ from `car` (/head/) and optional `cdr` (/tail/).
- [heading Header]
- #include <boost/fusion/container/generation/make_cons.hpp>
- #include <boost/fusion/include/make_cons.hpp>
- [heading Example]
- make_cons('x', make_cons(123))
- [heading See also]
- __note_ref_wrappers__
- [endsect]
- [section make_vector]
- [heading Description]
- Create a __vector__ from one or more values.
- [heading Synopsis]
- template <typename T0, typename T1,... typename TN>
- typename __result_of_make_vector__<T0, T1,... TN>::type
- make_vector(T0 const& x0, T1 const& x1... TN const& xN);
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a
- user definable predefined maximum that defaults to `10`. You may define
- the preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any
- Fusion header to change the default. Example:
- #define FUSION_MAX_VECTOR_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_vector`]]
- ]
- [heading Expression Semantics]
- make_vector(x0, x1,... xN);
- [*Return type]: __result_of_make_vector__`<T0, T1,... TN>::type`
- [*Semantics]: Create a __vector__ from `x0, x1,... xN`.
- [heading Header]
- #include <boost/fusion/container/generation/make_vector.hpp>
- #include <boost/fusion/include/make_vector.hpp>
- [heading Example]
- make_vector(123, "hello", 12.5)
- [heading See also]
- __note_ref_wrappers__
- [endsect]
- [section make_deque]
- [heading Description]
- Create a __deque__ from one or more values.
- [heading Synopsis]
- template <typename ...Elements>
- typename __result_of_make_deque__<Elements...>::type
- make_deque(Elements const&... elements);
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_DEQUE_SIZE` elements, where `FUSION_MAX_DEQUE_SIZE` is a
- user definable predefined maximum that defaults to `10`. You may define
- the preprocessor constant `FUSION_MAX_DEQUE_SIZE` before including any
- Fusion header to change the default. Example:
- #define FUSION_MAX_DEQUE_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Description] [Description]]
- [[`elements`] [Instances of `Elements`] [The arguments to `make_deque`]]
- ]
- [heading Expression Semantics]
- make_deque(elements...);
- [*Return type]: __result_of_make_deque__`<Elements...>::type`
- [*Semantics]: Create a __deque__ from `elements...`.
- [heading Header]
- #include <boost/fusion/container/generation/make_deque.hpp>
- #include <boost/fusion/include/make_deque.hpp>
- [heading Example]
- make_deque(123, "hello", 12.5)
- [heading See also]
- __note_ref_wrappers__
- [endsect]
- [section make_set]
- [heading Description]
- Create a __set__ from one or more values.
- [heading Synopsis]
- template <typename T0, typename T1,... typename TN>
- typename __result_of_make_set__<T0, T1,... TN>::type
- make_set(T0 const& x0, T1 const& x1... TN const& xN);
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user
- definable predefined maximum that defaults to `10`. You may define the
- preprocessor constant `FUSION_MAX_SET_SIZE` before including any Fusion
- header to change the default. Example:
- #define FUSION_MAX_SET_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_set`]]
- ]
- [heading Expression Semantics]
- make_set(x0, x1,... xN);
- [*Return type]: __result_of_make_set__`<T0, T1,... TN>::type`
- [*Semantics]: Create a __set__ from `x0, x1,... xN`.
- [*Precondition]: There may be no duplicate key types.
- [heading Header]
- #include <boost/fusion/container/generation/make_set.hpp>
- #include <boost/fusion/include/make_set.hpp>
- [heading Example]
- make_set(123, "hello", 12.5)
- [heading See also]
- __note_ref_wrappers__
- [endsect]
- [section make_map]
- [heading Description]
- Create a __map__ from one or more key/data pairs.
- [heading Synopsis]
- template <
- typename K0, typename K1,... typename KN
- , typename T0, typename T1,... typename TN>
- typename __result_of_make_map__<K0, K0,... KN, T0, T1,... TN>::type
- make_map(T0 const& x0, T1 const& x1... TN const& xN);
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to `FUSION_MAX_MAP_SIZE` elements,
- where `FUSION_MAX_MAP_SIZE` is a user definable predefined maximum that
- defaults to `10`. You may define the preprocessor constant
- `FUSION_MAX_MAP_SIZE` before including any Fusion header to change the
- default. Example:
- #define FUSION_MAX_MAP_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`K0, K1,... KN`] [The key types] [Keys associated with `x0, x1,... xN`]]
- [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `make_map`]]
- ]
- [heading Expression Semantics]
- make_map<K0, K1,... KN>(x0, x1,... xN);
- [*Return type]: __result_of_make_map__`<K0, K0,... KN, T0, T1,... TN>::type`
- [*Semantics]: Create a __map__ from `K0, K1,... KN` keys and
- `x0, x1,... xN` data.
- [*Precondition]: There may be no duplicate key types.
- [heading Header]
- #include <boost/fusion/container/generation/make_map.hpp>
- #include <boost/fusion/include/make_map.hpp>
- [heading Example]
- make_map<int, double>('X', "Men")
- [heading See also]
- __note_ref_wrappers__, __fusion_pair__
- [endsect]
- [section Tiers]
- Tiers are sequences, where all elements are non-const reference types. They
- are constructed with a call to a couple of /tie/ function templates. The
- succeeding sections document the various /tier/ flavors.
- * __list_tie__
- * __vector_tie__
- * __map_tie__
- * __deque_tie__
- Example:
- int i; char c; double d;
- ...
- __vector_tie__(i, c, d);
- The __vector_tie__ function creates a __vector__ of type
- `__vector__<int&, char&, double&>`. The same result could be achieved with the call
- __make_vector__(__boost_ref_call__(i), __boost_ref_call__(c), __boost_ref_call__(d))
- [footnote see __boost_ref__ for details about `ref`].
- A /tie/ can be used to 'unpack' another tuple into variables. E.g.:
- int i; char c; double d;
- __vector_tie__(i, c, d) = __make_vector__(1,'a', 5.5);
- std::cout << i << " " << c << " " << d;
- This code prints 1 a 5.5 to the standard output stream. A sequence
- unpacking operation like this is found for example in ML and Python. It is
- convenient when calling functions which return sequences.
- [heading Ignore]
- There is also an object called /ignore/ which allows you to ignore an
- element assigned by a sequence. The idea is that a function may return a
- sequence, only part of which you are interested in. For example:
- char c;
- __vector_tie__(ignore, c) = __make_vector__(1, 'a');
- [endsect]
- [section list_tie]
- [heading Description]
- Constructs a tie using a __list__ sequence.
- [heading Synopsis]
- template <typename T0, typename T1,... typename TN>
- __list__<T0&, T1&,... TN&>
- list_tie(T0& x0, T1& x1... TN& xN);
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
- definable predefined maximum that defaults to `10`. You may define the
- preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
- header to change the default. Example:
- #define FUSION_MAX_LIST_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `list_tie`]]
- ]
- [heading Expression Semantics]
- list_tie(x0, x1,... xN);
- [*Return type]: __list__<T0&, T1&,... TN&>
- [*Semantics]: Create a __list__ of references from `x0, x1,... xN`.
- [heading Header]
- #include <boost/fusion/container/generation/list_tie.hpp>
- #include <boost/fusion/include/list_tie.hpp>
- [heading Example]
- int i = 123;
- double d = 123.456;
- list_tie(i, d)
- [endsect]
- [section vector_tie]
- [heading Description]
- Constructs a tie using a __vector__ sequence.
- [heading Synopsis]
- template <typename T0, typename T1,... typename TN>
- __vector__<T0&, T1&,... TN&>
- vector_tie(T0& x0, T1& x1... TN& xN);
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a
- user definable predefined maximum that defaults to `10`. You may define
- the preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any
- Fusion header to change the default. Example:
- #define FUSION_MAX_VECTOR_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `vector_tie`]]
- ]
- [heading Expression Semantics]
- vector_tie(x0, x1,... xN);
- [*Return type]: __vector__<T0&, T1&,... TN&>
- [*Semantics]: Create a __vector__ of references from `x0, x1,... xN`.
- [heading Header]
- #include <boost/fusion/container/generation/vector_tie.hpp>
- #include <boost/fusion/include/vector_tie.hpp>
- [heading Example]
- int i = 123;
- double d = 123.456;
- vector_tie(i, d)
- [endsect]
- [section map_tie]
- [heading Description]
- Constructs a tie using a __map__ sequence.
- [heading Synopsis]
- template <typename K0, typename K1,... typename KN, typename D0, typename D1,... typename DN>
- __map__<__pair__<K0, D0&>, __pair__<K1, D1&>,... __pair__<KN, DN&> >
- map_tie(D0& d0, D1& d1... DN& dN);
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user
- definable predefined maximum that defaults to `10`, and a corresponding
- number of key types. You may define the preprocessor constant
- `FUSION_MAX_MAP_SIZE` before including any Fusion header to change the
- default. Example:
- #define FUSION_MAX_MAP_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`K0, K1,... KN`] [Any type][The key types associated with each of the `x1,x2,...,xN` values]]
- [[`x0, x1,... xN`] [Instances of `T0, T1,... TN`] [The arguments to `map_tie`]]
- ]
- [heading Expression Semantics]
- map_tie<K0, K1,... KN>(x0, x1,... xN);
- [*Return type]: __map__<__pair__<K0, D0&>, __pair__<K1, D1&>,... __pair__<KN, DN&> >
- [*Semantics]: Create a __map__ of references from `x0, x1,... xN` with keys `K0, K1,... KN`
- [heading Header]
- #include <boost/fusion/container/generation/map_tie.hpp>
- #include <boost/fusion/include/map_tie.hpp>
- [heading Example]
- struct int_key;
- struct double_key;
- ...
- int i = 123;
- double d = 123.456;
- map_tie<int_key, double_key>(i, d)
- [endsect]
- [section deque_tie]
- [heading Description]
- Constructs a tie using a __deque__ sequence.
- [heading Synopsis]
- template <typename ...Elements>
- __deque__<Elements&...>
- deque_tie(Elements&... elements);
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_DEQUE_SIZE` elements, where `FUSION_MAX_DEQUE_SIZE` is a
- user definable predefined maximum that defaults to `10`. You may define
- the preprocessor constant `FUSION_MAX_DEQUE_SIZE` before including any
- Fusion header to change the default. Example:
- #define FUSION_MAX_DEQUE_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Description] [Description]]
- [[`elements`] [Instances of `Elements`] [The arguments to `deque_tie`]]
- ]
- [heading Expression Semantics]
- deque_tie(elements...);
- [*Return type]: __deque__<Elements&...>
- [*Semantics]: Create a __deque__ of references from `elements...`.
- [heading Header]
- #include <boost/fusion/container/generation/deque_tie.hpp>
- #include <boost/fusion/include/deque_tie.hpp>
- [heading Example]
- int i = 123;
- double d = 123.456;
- deque_tie(i, d)
- [endsect]
- [endsect]
- [section MetaFunctions]
- [section make_list]
- [heading Description]
- Returns the result type of __make_list__.
- [heading Synopsis]
- template <typename T0, typename T1,... typename TN>
- struct make_list;
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
- definable predefined maximum that defaults to `10`. You may define the
- preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
- header to change the default. Example:
- #define FUSION_MAX_LIST_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`T0, T1,... TN`] [Any type] [Template arguments to `make_list`]]
- ]
- [heading Expression Semantics]
- result_of::make_list<T0, T1,... TN>::type
- [*Return type]: A __list__ with elements of types converted following the
- rules for __element_conversion__.
- [*Semantics]: Create a __list__ from `T0, T1,... TN`.
- [heading Header]
- #include <boost/fusion/container/generation/make_list.hpp>
- #include <boost/fusion/include/make_list.hpp>
- [heading Example]
- result_of::make_list<int, const char(&)[7], double>::type
- [endsect]
- [section make_cons]
- [heading Description]
- Returns the result type of __make_cons__.
- [heading Synopsis]
- template <typename Car, typename Cdr = nil>
- struct make_cons;
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`Car`] [Any type] [The list's head type]]
- [[`Cdr`] [A `cons`] [The list's tail type (optional)]]
- ]
- [heading Expression Semantics]
- result_of::make_cons<Car, Cdr>::type
- [*Return type]: A __cons__ with head element, `Car`, of type converted
- following the rules for __element_conversion__, and tail, `Cdr`.
- [*Semantics]: Create a __cons__ from `Car` (/head/) and optional `Cdr` (/tail/).
- [heading Header]
- #include <boost/fusion/container/generation/make_cons.hpp>
- #include <boost/fusion/include/make_cons.hpp>
- [heading Example]
- result_of::make_cons<char, result_of::make_cons<int>::type>::type
- [endsect]
- [section make_vector]
- [heading Description]
- Returns the result type of __make_vector__.
- [heading Synopsis]
- template <typename T0, typename T1,... typename TN>
- struct make_vector;
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a user
- definable predefined maximum that defaults to `10`. You may define the
- preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any Fusion
- header to change the default. Example:
- #define FUSION_MAX_VECTOR_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`T0, T1,... TN`] [Any type] [Template arguments to `make_vector`]]
- ]
- [heading Expression Semantics]
- result_of::make_vector<T0, T1,... TN>::type
- [*Return type]: A __vector__ with elements of types converted following the
- rules for __element_conversion__.
- [*Semantics]: Create a __vector__ from `T0, T1,... TN`.
- [heading Header]
- #include <boost/fusion/container/generation/make_vector.hpp>
- #include <boost/fusion/include/make_vector.hpp>
- [heading Example]
- result_of::make_vector<int, const char(&)[7], double>::type
- [endsect]
- [section make_deque]
- [heading Description]
- Returns the result type of __make_deque__.
- [heading Synopsis]
- template <typename ...Elements>
- struct make_deque;
- For C++11 compilers, the variadic template interface has no upper bound.
- For C++03 The variadic function accepts `0` to `FUSION_MAX_DEQUE_SIZE`
- elements, where `FUSION_MAX_DEQUE_SIZE` is a user definable predefined
- maximum that defaults to `10`. You may define the preprocessor constant
- `FUSION_MAX_DEQUE_SIZE` before including any Fusion header to change the
- default. Example:
- #define FUSION_MAX_DEQUE_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`Elements`] [Variadic template types] [Template arguments to `make_deque`]]
- ]
- [heading Expression Semantics]
- result_of::make_deque<Elements...>::type
- [*Return type]: A __deque__ with elements of types converted following the
- rules for __element_conversion__.
- [*Semantics]: Create a __deque__ from `Elements...`.
- [heading Header]
- #include <boost/fusion/container/generation/make_deque.hpp>
- #include <boost/fusion/include/make_deque.hpp>
- [heading Example]
- result_of::make_deque<int, const char(&)[7], double>::type
- [endsect]
- [section make_set]
- [heading Description]
- Returns the result type of __make_set__.
- [heading Synopsis]
- template <typename T0, typename T1,... typename TN>
- struct make_set;
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_SET_SIZE` elements, where `FUSION_MAX_SET_SIZE` is a user definable
- predefined maximum that defaults to `10`. You may define the preprocessor
- constant `FUSION_MAX_SET_SIZE` before including any Fusion header to change
- the default. Example:
- #define FUSION_MAX_SET_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`T0, T1,... TN`] [Any type] [The arguments to `make_set`]]
- ]
- [heading Expression Semantics]
- result_of::make_set<T0, T1,... TN>::type
- [*Return type]: A __set__ with elements of types converted following the
- rules for __element_conversion__.
- [*Semantics]: Create a __set__ from `T0, T1,... TN`.
- [*Precondition]: There may be no duplicate key types.
- [heading Header]
- #include <boost/fusion/container/generation/make_set.hpp>
- #include <boost/fusion/include/make_set.hpp>
- [heading Example]
- result_of::make_set<int, char, double>::type
- [endsect]
- [section make_map]
- [heading Description]
- Returns the result type of __make_map__.
- The implementation depends on the support of variadic templates.
- When variadic templates are not supported, make_map is a metafunction of the form:
- [heading Synopsis]
- template <
- typename K0, typename K1,... typename KN
- , typename T0, typename T1,... typename TN>
- struct make_map;
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to `FUSION_MAX_MAP_SIZE` elements,
- where `FUSION_MAX_MAP_SIZE` is a user definable predefined maximum that
- defaults to `10`. You may define the preprocessor constant
- `FUSION_MAX_MAP_SIZE` before including any Fusion header to change the
- default. Example:
- #define FUSION_MAX_MAP_SIZE 20
- When variadic templates are supported, make_map is a metafunction class of the form:
- [heading Synopsis]
- template <
- typename K0, typename K1,... typename KN>
- struct make_map
- {
- struct apply<
- typename T0, typename T1,... typename TN>
- };
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`K0, K1,... KN`] [Any type] [Keys associated with `T0, T1,... TN`]]
- [[`T0, T1,... TN`] [Any type] [Data associated with keys `K0, K1,... KN`]]
- ]
- [heading Expression Semantics]
- #if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
- resulf_of::make_map<K0, K1,... KN, T0, T1,... TN>::type;
- #else
- resulf_of::make_map<K0, K1,... KN>::apply<T0, T1,... TN>::type;
- #endif
- [*Return type]: __result_of_make_map__`<K0, K0,... KN, T0, T1,... TN>::type`
- when variadic templates are not supported, or
- __result_of_make_map__`<K0, K0,... KN>::apply<T0, T1,... TN>::type`
- when variadic templates are supported.
- [*Semantics]: A __map__ with __fusion_pair__ elements where the
- `second_type` is converted following the rules for __element_conversion__.
- [*Precondition]: There may be no duplicate key types.
- [heading Header]
- #include <boost/fusion/container/generation/make_map.hpp>
- #include <boost/fusion/include/make_map.hpp>
- [heading Example]
- #if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
- result_of::make_map<int, double, char, double>::type
- #else
- result_of::make_map<int, double>::apply<char, double>::type
- #endif
- [heading See also]
- __fusion_pair__
- [endsect]
- [section list_tie]
- [heading Description]
- Returns the result type of __list_tie__.
- [heading Synopsis]
- template <typename T0, typename T1,... typename TN>
- struct list_tie;
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_LIST_SIZE` elements, where `FUSION_MAX_LIST_SIZE` is a user
- definable predefined maximum that defaults to `10`. You may define the
- preprocessor constant `FUSION_MAX_LIST_SIZE` before including any Fusion
- header to change the default. Example:
- #define FUSION_MAX_LIST_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`T0, T1,... TN`] [Any type] [The arguments to `list_tie`]]
- ]
- [heading Expression Semantics]
- result_of::list_tie<T0, T1,... TN>::type;
- [*Return type]: __list__<T0&, T1&,... TN&>
- [*Semantics]: Create a __list__ of references from `T0, T1,... TN`.
- [heading Header]
- #include <boost/fusion/container/generation/list_tie.hpp>
- #include <boost/fusion/include/list_tie.hpp>
- [heading Example]
- result_of::list_tie<int, double>::type
- [endsect]
- [section vector_tie]
- [heading Description]
- Returns the result type of __vector_tie__.
- [heading Synopsis]
- template <typename T0, typename T1,... typename TN>
- struct vector_tie;
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_VECTOR_SIZE` elements, where `FUSION_MAX_VECTOR_SIZE` is a user
- definable predefined maximum that defaults to `10`. You may define the
- preprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any Fusion
- header to change the default. Example:
- #define FUSION_MAX_VECTOR_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`T0, T1,... TN`] [Any type] [The arguments to `vector_tie`]]
- ]
- [heading Expression Semantics]
- result_of::vector_tie<T0, T1,... TN>::type;
- [*Return type]: __vector__<T0&, T1&,... TN&>
- [*Semantics]: Create a __vector__ of references from `T0, T1,... TN`.
- [heading Header]
- #include <boost/fusion/container/generation/vector_tie.hpp>
- #include <boost/fusion/include/vector_tie.hpp>
- [heading Example]
- result_of::vector_tie<int, double>::type
- [endsect]
- [section deque_tie]
- [heading Description]
- Returns the result type of __deque_tie__.
- [heading Synopsis]
- template <typename ...Elements>
- struct deque_tie;
- For C++11 compilers, the variadic template interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_DEQUE_SIZE` elements, where `FUSION_MAX_DEQUE_SIZE` is a
- user definable predefined maximum that defaults to `10`. You may define
- the preprocessor constant `FUSION_MAX_DEQUE_SIZE` before including any
- Fusion header to change the default. Example:
- #define FUSION_MAX_DEQUE_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`Elements`] [Variadic template types] [Template arguments to `deque_tie`]]
- ]
- [heading Expression Semantics]
- result_of::deque_tie<Elements...>::type;
- [*Return type]: __deque__<Elements&...>
- [*Semantics]: Create a __deque__ of references from `Elements...`.
- [heading Header]
- #include <boost/fusion/container/generation/deque_tie.hpp>
- #include <boost/fusion/include/deque_tie.hpp>
- [heading Example]
- result_of::deque_tie<int, double>::type
- [endsect]
- [section map_tie]
- [heading Description]
- Returns the result type of __map_tie__.
- [heading Synopsis]
- template <typename K0, typename K1,... typename KN, typename D0, typename D1,... typename DN>
- struct map_tie;
- For C++11 compilers, the variadic function interface has no upper bound.
- For C++03 compilers, the variadic function accepts `0` to
- `FUSION_MAX_MAP_SIZE` elements, where `FUSION_MAX_MAP_SIZE` is a user definable
- predefined maximum that defaults to `10`. You may define the preprocessor
- constant `FUSION_MAX_MAP_SIZE` before including any Fusion header to change
- the default. Example:
- #define FUSION_MAX_MAP_SIZE 20
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`K0, K1,... KN`] [Any type] [The key types for `map_tie`]]
- [[`D0, D1,... DN`] [Any type] [The arguments types for `map_tie`]]
- ]
- [heading Expression Semantics]
- result_of::map_tie<K0, K1,... KN, D0, D1,... DN>::type;
- [*Return type]: __map__<__pair__<K0, D0&>, __pair__<K1, D1&>,... __pair__<KN, DN&> >
- [*Semantics]: Create a __map__ of references from `D0, D1,... DN` with keys `K0, K1,... KN`
- [heading Header]
- #include <boost/fusion/container/generation/map_tie.hpp>
- #include <boost/fusion/include/map_tie.hpp>
- [heading Example]
- struct int_key;
- struct double_key;
- ...
- result_of::map_tie<int_key, double_key, int, double>::type
- [endsect]
- [endsect]
- [endsect]
- [section Conversion]
- All fusion sequences can be converted to one of the __containers__ types
- using one of these conversion functions.
- [heading Header]
- #include <boost/fusion/include/convert.hpp>
- [section Functions]
- [section as_list]
- [heading Description]
- Convert a fusion sequence to a __list__.
- [heading Synopsis]
- template <typename Sequence>
- typename result_of::as_list<Sequence>::type
- as_list(Sequence& seq);
- template <typename Sequence>
- typename result_of::as_list<Sequence const>::type
- as_list(Sequence const& seq);
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`seq`] [An instance of Sequence] [The sequence to convert.]]
- ]
- [heading Expression Semantics]
- as_list(seq);
- [*Return type]: __result_of_as_list__`<Sequence>::type`
- [*Semantics]: Convert a fusion sequence, `seq`, to a __list__.
- [heading Header]
- #include <boost/fusion/container/list/convert.hpp>
- #include <boost/fusion/include/as_list.hpp>
- [heading Example]
- as_list(__make_vector__('x', 123, "hello"))
- [endsect]
- [section as_vector]
- [heading Description]
- Convert a fusion sequence to a __vector__.
- [heading Synopsis]
- template <typename Sequence>
- typename result_of::as_vector<Sequence>::type
- as_vector(Sequence& seq);
- template <typename Sequence>
- typename result_of::as_vector<Sequence const>::type
- as_vector(Sequence const& seq);
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`seq`] [An instance of Sequence] [The sequence to convert.]]
- ]
- [heading Expression Semantics]
- as_vector(seq);
- [*Return type]: __result_of_as_vector__`<Sequence>::type`
- [*Semantics]: Convert a fusion sequence, `seq`, to a __vector__.
- [heading Header]
- #include <boost/fusion/container/vector/convert.hpp>
- #include <boost/fusion/include/as_vector.hpp>
- [heading Example]
- as_vector(__make_list__('x', 123, "hello"))
- [endsect]
- [section as_deque]
- [heading Description]
- Convert a fusion sequence to a __deque__.
- [heading Synopsis]
- template <typename Sequence>
- typename result_of::as_deque<Sequence>::type
- as_deque(Sequence& seq);
- template <typename Sequence>
- typename result_of::as_deque<Sequence const>::type
- as_deque(Sequence const& seq);
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`seq`] [An instance of Sequence] [The sequence to convert.]]
- ]
- [heading Expression Semantics]
- as_deque(seq);
- [*Return type]: __result_of_as_deque__`<Sequence>::type`
- [*Semantics]: Convert a fusion sequence, `seq`, to a __deque__.
- [heading Header]
- #include <boost/fusion/container/deque/convert.hpp>
- #include <boost/fusion/include/as_deque.hpp>
- [heading Example]
- as_deque(__make_vector__('x', 123, "hello"))
- [endsect]
- [section as_set]
- [heading Description]
- Convert a fusion sequence to a __set__.
- [heading Synopsis]
- template <typename Sequence>
- typename result_of::as_set<Sequence>::type
- as_set(Sequence& seq);
- template <typename Sequence>
- typename result_of::as_set<Sequence const>::type
- as_set(Sequence const& seq);
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`seq`] [An instance of Sequence] [The sequence to convert.]]
- ]
- [heading Expression Semantics]
- as_set(seq);
- [*Return type]: __result_of_as_set__`<Sequence>::type`
- [*Semantics]: Convert a fusion sequence, `seq`, to a __set__.
- [*Precondition]: There may be no duplicate key types.
- [heading Header]
- #include <boost/fusion/container/set/convert.hpp>
- #include <boost/fusion/include/as_set.hpp>
- [heading Example]
- as_set(__make_vector__('x', 123, "hello"))
- [endsect]
- [section as_map]
- [heading Description]
- Convert a fusion sequence to a __map__.
- [heading Synopsis]
- template <typename Sequence>
- typename result_of::as_map<Sequence>::type
- as_map(Sequence& seq);
- template <typename Sequence>
- typename result_of::as_map<Sequence const>::type
- as_map(Sequence const& seq);
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`seq`] [An instance of Sequence] [The sequence to convert.]]
- ]
- [heading Expression Semantics]
- as_map(seq);
- [*Return type]: __result_of_as_map__`<Sequence>::type`
- [*Semantics]: Convert a fusion sequence, `seq`, to a __map__.
- [*Precondition]: For non-associative sequence, the elements are assumed to be
- __fusion_pair__s. There may be no duplicate __fusion_pair__ key types.
- [heading Header]
- #include <boost/fusion/container/map/convert.hpp>
- #include <boost/fusion/include/as_map.hpp>
- [heading Example]
- // from sequence of __fusion_pair__
- as_map(__make_vector__(
- __fusion_make_pair__<int>('X')
- , __fusion_make_pair__<double>("Men")))
-
- // from associative sequence
- namespace ns
- {
- struct x_member;
- struct y_member;
- }
- BOOST_FUSION_DEFINE_ASSOC_STRUCT(
- (ns),
- point,
- (int, x, ns::x_member)
- (int, y, ns::y_member)
- )
- ...
- as_map(ns::point(123, 456))
- [endsect]
- [endsect]
- [section Metafunctions]
- [section as_list]
- [heading Description]
- Returns the result type of __as_list__.
- [heading Synopsis]
- template <typename Sequence>
- struct as_list;
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`Sequence`] [A fusion __sequence__] [The sequence type to convert.]]
- ]
- [heading Expression Semantics]
- result_of::as_list<Sequence>::type;
- [*Return type]: A __list__ with same elements as the input sequence,
- `Sequence`.
- [*Semantics]: Convert a fusion sequence, `Sequence`, to a __list__.
- [heading Header]
- #include <boost/fusion/container/list/convert.hpp>
- #include <boost/fusion/include/as_list.hpp>
- [heading Example]
- result_of::as_list<__vector__<char, int> >::type
- [endsect]
- [section as_vector]
- [heading Description]
- Returns the result type of __as_vector__.
- [heading Synopsis]
- template <typename Sequence>
- struct as_vector;
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`Sequence`] [A fusion __sequence__] [The sequence to convert.]]
- ]
- [heading Expression Semantics]
- result_of::as_vector<Sequence>::type;
- [*Return type]: A __vector__ with same elements as the input sequence,
- `Sequence`.
- [*Semantics]: Convert a fusion sequence, `Sequence`, to a __vector__.
- [heading Header]
- #include <boost/fusion/container/vector/convert.hpp>
- #include <boost/fusion/include/as_vector.hpp>
- [heading Example]
- result_of::as_vector<__list__<char, int> >::type
- [endsect]
- [section as_deque]
- [heading Description]
- Returns the result type of __as_deque__.
- [heading Synopsis]
- template <typename Sequence>
- struct as_deque;
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`Sequence`] [A fusion __sequence__] [The sequence type to convert.]]
- ]
- [heading Expression Semantics]
- result_of::as_deque<Sequence>::type;
- [*Return type]: A __deque__ with same elements as the input sequence,
- `Sequence`.
- [*Semantics]: Convert a fusion sequence, `Sequence`, to a __deque__.
- [heading Header]
- #include <boost/fusion/container/deque/convert.hpp>
- #include <boost/fusion/include/as_deque.hpp>
- [heading Example]
- result_of::as_deque<__vector__<char, int> >::type
- [endsect]
- [section as_set]
- [heading Description]
- Returns the result type of __as_set__.
- [heading Synopsis]
- template <typename Sequence>
- struct as_set;
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`Sequence`] [A fusion __sequence__] [The sequence to convert.]]
- ]
- [heading Expression Semantics]
- result_of::as_set<Sequence>::type;
- [*Return type]: A __set__ with same elements as the input sequence,
- `Sequence`.
- [*Semantics]: Convert a fusion sequence, `Sequence`, to a __set__.
- [*Precondition]: There may be no duplicate key types.
- [heading Header]
- #include <boost/fusion/container/set/convert.hpp>
- #include <boost/fusion/include/as_set.hpp>
- [heading Example]
- result_of::as_set<__vector__<char, int> >::type
- [endsect]
- [section as_map]
- [heading Description]
- Returns the result type of __as_map__.
- [heading Synopsis]
- template <typename Sequence>
- struct as_map;
- [heading Parameters]
- [table
- [[Parameter] [Requirement] [Description]]
- [[`Sequence`] [A fusion __sequence__] [The sequence to convert.]]
- ]
- [heading Expression Semantics]
- result_of::as_map<Sequence>::type;
- [*Return type]: A __map__ with same elements as the input sequence,
- `Sequence`.
- [*Semantics]: Convert a fusion sequence, `Sequence`, to a __map__.
- [*Precondition]: For non-associative sequence, the elements are assumed to be
- __fusion_pair__s. There may be no duplicate __fusion_pair__ key types.
- [heading Header]
- #include <boost/fusion/container/map/convert.hpp>
- #include <boost/fusion/include/as_map.hpp>
- [heading Example]
- // from sequence of __fusion_pair__
- result_of::as_map<__vector__<
- __fusion_pair__<int, char>
- , __fusion_pair__<double, std::string> > >::type
-
- // from associative sequence
- namespace ns
- {
- struct x_member;
- struct y_member;
- }
- BOOST_FUSION_DEFINE_ASSOC_STRUCT(
- (ns),
- point,
- (int, x, ns::x_member)
- (int, y, ns::y_member)
- )
- ...
- result_of::as_map<ns::point>::type // __map__<__fusion_pair__<ns::x_member, int>, __fusion_pair__<ns::y_member, int> >
- [endsect]
- [endsect]
- [endsect]
- [endsect]
|