📄 container.qbk
字号:
[*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_boost_ref__[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);The variadic function accepts `0` to `FUSION_MAX_VECTOR_SIZE` elements,where `FUSION_MAX_VECTOR_SIZE` is a user definable predefined maximum thatdefaults to `10`. You may define the preprocessor constant`FUSION_MAX_VECTOR_SIZE` before including any Fusion header to change thedefault. 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_boost_ref__[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);The variadic function accepts `0` to `FUSION_MAX_VECTOR_SIZE`[footnote`set` is implemented in terms of the vector. That is why we reuse`FUSION_MAX_VECTOR_SIZE`] elements, where `FUSION_MAX_VECTOR_SIZE` is a userdefinable predefined maximum that defaults to `10`. You may define thepreprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any Fusionheader 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_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_boost_ref__[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);The variadic function accepts `0` to `FUSION_MAX_VECTOR_SIZE`[footnote`map` is implemented in terms of the vector. That is why we reuse`FUSION_MAX_VECTOR_SIZE`] elements, where `FUSION_MAX_VECTOR_SIZE` is a userdefinable predefined maximum that defaults to `10`. You may define thepreprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any Fusionheader to change the default. Example: #define FUSION_MAX_VECTOR_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( __fusion_make_pair__<int>('X') , __fusion_make_pair__<double>("Men"))[heading See also]__note_boost_ref__, __fusion_pair__[endsect][section Tiers]Tiers are sequences, where all elements are non-const reference types. Theyare constructed with a call to a couple of /tie/ function templates. Thesucceeding sections document the various /tier/ flavors.* __list_tie__* __vector_tie__* __map_tie__Example: int i; char c; double d; ... __vector_tie__(i, c, a);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__(a))[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 sequenceunpacking operation like this is found for example in ML and Python. It isconvenient when calling functions which return sequences.[heading Ignore]There is also an object called /ignore/ which allows you to ignore anelement assigned by a sequence. The idea is that a function may return asequence, 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);The variadic function accepts `0` to `FUSION_MAX_LIST_SIZE` elements, where`FUSION_MAX_LIST_SIZE` is a user definable predefined maximum that defaultsto `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);The variadic function accepts `0` to `FUSION_MAX_VECTOR_SIZE` elements,where `FUSION_MAX_VECTOR_SIZE` is a user definable predefined maximum thatdefaults to `10`. You may define the preprocessor constant`FUSION_MAX_VECTOR_SIZE` before including any Fusion header to change thedefault. 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);The variadic function accepts `0` to `FUSION_MAX_MAP_SIZE` elements,where `FUSION_MAX_MAP_SIZE` is a user definable predefined maximum thatdefaults to `10`, and a corresponding number of key types.You may define the preprocessor constant `FUSION_MAX_MAP_SIZE` beforeincluding 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][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;The variadic function accepts `0` to `FUSION_MAX_LIST_SIZE` elements, where`FUSION_MAX_LIST_SIZE` is a user definable predefined maximum that defaultsto `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 therules 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 convertedfollowing 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;The variadic function accepts `0` to `FUSION_MAX_VECTOR_SIZE` elements,where `FUSION_MAX_VECTOR_SIZE` is a user definable predefined maximum thatdefaults to `10`. You may define the preprocessor constant`FUSION_MAX_VECTOR_SIZE` before including any Fusion header to change thedefault. 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 therules for __element_conversion__.[*Semantics]: Create a __vector__ 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_vector<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;The variadic function accepts `0` to `FUSION_MAX_VECTOR_SIZE`[footnote`set` is implemented in terms of the vector. That is why we reuse`FUSION_MAX_VECTOR_SIZE`] elements, where `FUSION_MAX_VECTOR_SIZE` is a userdefinable predefined maximum that defaults to `10`. You may define thepreprocessor constant `FUSION_MAX_VECTOR_SIZE` before including any Fusionheader 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 `make_set`]]][heading Expression Semantics] result_of::make_set<T0, T1,... TN>::type[*Return type]: A __set__ with elements of types converted following therules 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]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -