Compare commits
78 Commits
svn-branch
...
boost-1.55
Author | SHA1 | Date | |
---|---|---|---|
4b541f1a18 | |||
93447d3382 | |||
a9335aa664 | |||
8aef19648b | |||
1f718e4520 | |||
66ddb762d3 | |||
fc38122f0f | |||
940c594d3e | |||
9cceb79cf8 | |||
5a51e5d9aa | |||
bcb5fd9618 | |||
e03dcc7c54 | |||
2e99690387 | |||
ee33ea5cfa | |||
93477e270e | |||
b159898a47 | |||
9a8955fbe1 | |||
44b337abb0 | |||
af16a84f09 | |||
4b6dddde03 | |||
01156b172a | |||
295bacb652 | |||
adb2d8bef0 | |||
518ac25a80 | |||
efea9aec4b | |||
c411c4b479 | |||
13aca9d862 | |||
dcbebe60f1 | |||
577a607a14 | |||
aa30bad7e4 | |||
94f5406936 | |||
cd811f56bc | |||
7aa4e2cbda | |||
9792f67700 | |||
a3427ea75b | |||
134fbf9600 | |||
199d8b548f | |||
0f4ac2e9e3 | |||
32adb57290 | |||
02b2a88bea | |||
1572e0e9c3 | |||
649770fdcd | |||
6f0af5db0a | |||
95555f3f20 | |||
0f33972fe9 | |||
a0733ce5ee | |||
dc8225a7aa | |||
994b37e4d5 | |||
3f4d3eb887 | |||
cda74605fc | |||
b605617c4f | |||
b22e2b64da | |||
46fc256c2f | |||
7615b492af | |||
e0a17b552c | |||
2e805be6df | |||
2f8b91828b | |||
ea5ea7f001 | |||
df633002dd | |||
d726756148 | |||
efcab8aae4 | |||
5dff610007 | |||
d004046aa5 | |||
a046e43990 | |||
b1ebdd60a6 | |||
0b58f052b3 | |||
36736edec5 | |||
57725cb393 | |||
099deb4385 | |||
d150ba8498 | |||
df2abdab6b | |||
780b8bc1b0 | |||
813930aee6 | |||
9e8d8b1871 | |||
4a29dd2a7c | |||
7bd2fd716d | |||
d57e8cfe9e | |||
ed9cb87ac3 |
120
doc/adapted.qbk
@ -244,7 +244,7 @@ __random_access_sequence__.
|
||||
|
||||
[heading Semantics]
|
||||
|
||||
The above macro generates the necessary code to adapt `struct_name` or an
|
||||
The above macro generates the necessary code to adapt `struct_name` or an
|
||||
arbitrary specialization of `struct_name` as a model of
|
||||
__random_access_sequence__.
|
||||
The sequence `(template_param0)(template_param1)...` declares the names of
|
||||
@ -287,9 +287,9 @@ namespace qualified name of the struct to be adapted.
|
||||
[section:adapt_struct_named BOOST_FUSION_ADAPT_STRUCT_NAMED]
|
||||
|
||||
[heading Description]
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED and BOOST_FUSION_ADAPT_STRUCT_NAMED_NS are
|
||||
macros that can be used to generate all the necessary boilerplate to make an
|
||||
arbitrary struct a model of __random_access_sequence__. The given struct is
|
||||
BOOST_FUSION_ADAPT_STRUCT_NAMED and BOOST_FUSION_ADAPT_STRUCT_NAMED_NS are
|
||||
macros that can be used to generate all the necessary boilerplate to make an
|
||||
arbitrary struct a model of __random_access_sequence__. The given struct is
|
||||
adapted using the given name.
|
||||
|
||||
[heading Synopsis]
|
||||
@ -312,7 +312,7 @@ adapted using the given name.
|
||||
[heading Semantics]
|
||||
|
||||
The above macros generate the necessary code to adapt `struct_name`
|
||||
as a model of __random_access_sequence__ while using `adapted_name` as the
|
||||
as a model of __random_access_sequence__ while using `adapted_name` as the
|
||||
name of the adapted struct.
|
||||
The sequence `(namespace0)(namespace1)...` declares the namespace
|
||||
for `adapted_name`. It yields to a fully qualified name for `adapted_name` of
|
||||
@ -427,7 +427,7 @@ __random_access_sequence__ and __associative_sequence__.
|
||||
|
||||
[heading Semantics]
|
||||
|
||||
The above macro generates the necessary code to adapt `struct_name` or an
|
||||
The above macro generates the necessary code to adapt `struct_name` or an
|
||||
arbitrary specialization of `struct_name` as a model of
|
||||
__random_access_sequence__ and __associative_sequence__.
|
||||
The sequence `(template_param0)(template_param1)...` declares the names of
|
||||
@ -463,7 +463,7 @@ namespace qualified name of the struct to be adapted.
|
||||
struct name;
|
||||
struct age;
|
||||
}
|
||||
|
||||
|
||||
// Any instantiated demo::employee is now a Fusion sequence.
|
||||
// It is also an associative sequence with
|
||||
// keys keys::name and keys::age present.
|
||||
@ -478,8 +478,8 @@ namespace qualified name of the struct to be adapted.
|
||||
[section:adapt_assoc_struct_named BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED]
|
||||
|
||||
[heading Description]
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED and BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_NS are
|
||||
macros that can be used to generate all the necessary boilerplate to make an
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED and BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_NS are
|
||||
macros that can be used to generate all the necessary boilerplate to make an
|
||||
arbitrary struct a model of __random_access_sequence__ and
|
||||
__associative_sequence__. The given struct is adapted using the given name.
|
||||
|
||||
@ -539,7 +539,7 @@ namespace qualified name of the struct to be converted.
|
||||
struct name;
|
||||
struct age;
|
||||
}
|
||||
|
||||
|
||||
// boost::fusion::adapted::adapted_employee is now a Fusion sequence
|
||||
// referring to demo::employee
|
||||
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(
|
||||
@ -567,7 +567,7 @@ __random_access_sequence__.
|
||||
[heading Expression Semantics]
|
||||
|
||||
The above macro generates the necessary code to adapt `type_name`
|
||||
as a model of __random_access_sequence__.
|
||||
as a model of __random_access_sequence__.
|
||||
The sequence of
|
||||
[^(attribute_type['N], attribute_const_type['N], get_expr['N], set_expr['N])]
|
||||
quadruples declares the types, const types, get-expressions and set-expressions
|
||||
@ -600,7 +600,7 @@ namespace qualified name of the class type to be adapted.
|
||||
|
||||
#include <boost/fusion/adapted/adt/adapt_adt.hpp>
|
||||
#include <boost/fusion/include/adapt_adt.hpp>
|
||||
|
||||
|
||||
[heading Example]
|
||||
namespace demo
|
||||
{
|
||||
@ -609,41 +609,41 @@ namespace qualified name of the class type to be adapted.
|
||||
private:
|
||||
std::string name;
|
||||
int age;
|
||||
|
||||
|
||||
public:
|
||||
void set_name(std::string const& n)
|
||||
{
|
||||
name=n;
|
||||
}
|
||||
|
||||
|
||||
void set_age(int a)
|
||||
{
|
||||
age=a;
|
||||
}
|
||||
|
||||
|
||||
std::string const& get_name()const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
int get_age()const
|
||||
{
|
||||
return age;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
BOOST_FUSION_ADAPT_ADT(
|
||||
demo::employee,
|
||||
(std::string const&, std::string const&, obj.get_name(), obj.set_name(val))
|
||||
(int, int, obj.get_age(), obj.set_age(val)))
|
||||
|
||||
|
||||
demo::employee e;
|
||||
front(e)="Edward Norton";
|
||||
back(e)=41;
|
||||
//Prints 'Edward Norton is 41 years old'
|
||||
std::cout << e.get_name() << " is " << e.get_age() << " years old" << std::endl;
|
||||
|
||||
|
||||
[heading See also]
|
||||
|
||||
__adt_attribute_proxy__
|
||||
@ -670,7 +670,7 @@ __random_access_sequence__.
|
||||
|
||||
The above macro generates the necessary code to adapt `type_name`
|
||||
or an arbitrary specialization of `type_name`
|
||||
as a model of __random_access_sequence__.
|
||||
as a model of __random_access_sequence__.
|
||||
The sequence `(template_param0)(template_param1)...` declares the names of
|
||||
the template type parameters used.
|
||||
The sequence `(specialization_param0)(specialization_param1)...`
|
||||
@ -708,40 +708,40 @@ namespace qualified name of the template class type to be adapted.
|
||||
|
||||
#include <boost/fusion/adapted/adt/adapt_adt.hpp>
|
||||
#include <boost/fusion/include/adapt_adt.hpp>
|
||||
|
||||
|
||||
[heading Example]
|
||||
namespace demo
|
||||
{
|
||||
{
|
||||
template<typename Name, typename Age>
|
||||
struct employee
|
||||
{
|
||||
private:
|
||||
Name name;
|
||||
Age age;
|
||||
|
||||
|
||||
public:
|
||||
void set_name(Name const& n)
|
||||
{
|
||||
name=n;
|
||||
}
|
||||
|
||||
|
||||
void set_age(Age const& a)
|
||||
{
|
||||
age=a;
|
||||
}
|
||||
|
||||
|
||||
Name const& get_name()const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
Age const& get_age()const
|
||||
{
|
||||
return age;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
BOOST_FUSION_ADAPT_TPL_ADT(
|
||||
(Name)(Age),
|
||||
(demo::employee) (Name)(Age),
|
||||
@ -753,7 +753,7 @@ namespace qualified name of the template class type to be adapted.
|
||||
boost::fusion::back(e)=41;
|
||||
//Prints 'Edward Norton is 41 years old'
|
||||
std::cout << e.get_name() << " is " << e.get_age() << " years old" << std::endl;
|
||||
|
||||
|
||||
[heading See also]
|
||||
|
||||
__adt_attribute_proxy__
|
||||
@ -778,7 +778,7 @@ __random_access_sequence__ and __associative_sequence__.
|
||||
[heading Expression Semantics]
|
||||
|
||||
The above macro generates the necessary code to adapt `type_name`
|
||||
as a model of __random_access_sequence__ and __associative_sequence__.
|
||||
as a model of __random_access_sequence__ and __associative_sequence__.
|
||||
The sequence of
|
||||
[^(attribute_type['N], attribute_const_type['N], get_expr['N], set_expr['N], key_type['N])]
|
||||
5-tuples declares the types, const types, get-expressions, set-expressions and key types
|
||||
@ -800,7 +800,7 @@ The actual return type of fusion's intrinsic sequence access (meta-)functions
|
||||
when in invoked with (an instance of) `type_name` is a proxy type.
|
||||
This type is implicitly convertible to the attribute type via [^get_expr['N]] and
|
||||
forwards assignment to the underlying element via [^set_expr['N]].
|
||||
The value type (that is the type returned by __result_of_value_of__, __result_of_value_of_data__,
|
||||
The value type (that is the type returned by __result_of_value_of__, __result_of_value_of_data__,
|
||||
__result_of_value_at__, __result_of_value_at_c__ and __result_of_value_at_key__) of the ['N]th element
|
||||
is [^attribute_type['N]] with const-qualifier and reference removed.
|
||||
|
||||
@ -811,7 +811,7 @@ namespace qualified name of the class type to be adapted.
|
||||
|
||||
#include <boost/fusion/adapted/adt/adapt_assoc_adt.hpp>
|
||||
#include <boost/fusion/include/adapt_assoc_adt.hpp>
|
||||
|
||||
|
||||
[heading Example]
|
||||
namespace demo
|
||||
{
|
||||
@ -820,47 +820,47 @@ namespace qualified name of the class type to be adapted.
|
||||
private:
|
||||
std::string name;
|
||||
int age;
|
||||
|
||||
|
||||
public:
|
||||
void set_name(std::string const& n)
|
||||
{
|
||||
name=n;
|
||||
}
|
||||
|
||||
|
||||
void set_age(int a)
|
||||
{
|
||||
age=a;
|
||||
}
|
||||
|
||||
|
||||
std::string const& get_name()const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
int get_age()const
|
||||
{
|
||||
return age;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace keys
|
||||
{
|
||||
struct name;
|
||||
struct age;
|
||||
}
|
||||
|
||||
|
||||
BOOST_FUSION_ADAPT_ASSOC_ADT(
|
||||
demo::employee,
|
||||
(std::string const&, std::string const&, obj.get_name(), obj.set_name(val), keys::name)
|
||||
(int, int, obj.get_age(), obj.set_age(val), keys::age))
|
||||
|
||||
|
||||
demo::employee e;
|
||||
at_key<keys::name>(e)="Edward Norton";
|
||||
at_key<keys::age>(e)=41;
|
||||
//Prints 'Edward Norton is 41 years old'
|
||||
std::cout << e.get_name() << " is " << e.get_age() << " years old" << std::endl;
|
||||
|
||||
|
||||
[heading See also]
|
||||
|
||||
__adt_attribute_proxy__
|
||||
@ -887,7 +887,7 @@ __random_access_sequence__ and __associative_sequence__.
|
||||
|
||||
The above macro generates the necessary code to adapt `type_name`
|
||||
or an arbitrary specialization of `type_name`
|
||||
as a model of __random_access_sequence__ and __associative_sequence__.
|
||||
as a model of __random_access_sequence__ and __associative_sequence__.
|
||||
The sequence `(template_param0)(template_param1)...` declares the names of
|
||||
the template type parameters used.
|
||||
The sequence `(specialization_param0)(specialization_param1)...`
|
||||
@ -914,7 +914,7 @@ The actual return type of fusion's intrinsic sequence access (meta-)functions
|
||||
when in invoked with (an instance of) `type_name` is a proxy type.
|
||||
This type is implicitly convertible to the attribute type via [^get_expr['N]] and
|
||||
forwards assignment to the underlying element via [^set_expr['N]].
|
||||
The value type (that is the type returned by __result_of_value_of__, __result_of_value_of_data__,
|
||||
The value type (that is the type returned by __result_of_value_of__, __result_of_value_of_data__,
|
||||
__result_of_value_at__, __result_of_value_at_c__ and __result_of_value_at_key__) of the ['N]th element
|
||||
is [^attribute_type['N]] with const-qualifier and reference removed.
|
||||
|
||||
@ -925,7 +925,7 @@ namespace qualified name of the template class type to be adapted.
|
||||
|
||||
#include <boost/fusion/adapted/adt/adapt_assoc_adt.hpp>
|
||||
#include <boost/fusion/include/adapt_assoc_adt.hpp>
|
||||
|
||||
|
||||
[heading Example]
|
||||
namespace demo
|
||||
{
|
||||
@ -935,48 +935,48 @@ namespace qualified name of the template class type to be adapted.
|
||||
private:
|
||||
Name name;
|
||||
Age age;
|
||||
|
||||
|
||||
public:
|
||||
void set_name(Name const& n)
|
||||
{
|
||||
name=n;
|
||||
}
|
||||
|
||||
|
||||
void set_age(Age const& a)
|
||||
{
|
||||
age=a;
|
||||
}
|
||||
|
||||
|
||||
Name const& get_name()const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
Age const& get_age()const
|
||||
{
|
||||
return age;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace keys
|
||||
{
|
||||
struct name;
|
||||
struct age;
|
||||
}
|
||||
|
||||
|
||||
BOOST_FUSION_ADAPT_ASSOC_TPL_ADT(
|
||||
(Name)(Age),
|
||||
(demo::employee) (Name)(Age),
|
||||
(Name const&, Name const&, obj.get_name(), obj.set_name(val), keys::name)
|
||||
(Age const&, Age const&, obj.get_age(), obj.set_age(val), keys::age))
|
||||
|
||||
|
||||
demo::employee<std::string, int> e;
|
||||
at_key<keys::name>(e)="Edward Norton";
|
||||
at_key<keys::age>(e)=41;
|
||||
//Prints 'Edward Norton is 41 years old'
|
||||
std::cout << e.get_name() << " is " << e.get_age() << " years old" << std::endl;
|
||||
|
||||
|
||||
[heading See also]
|
||||
|
||||
__adt_attribute_proxy__
|
||||
@ -1028,14 +1028,14 @@ defined in __random_access_sequence__.
|
||||
[[`struct_name(e0, e1,... en)`] [Creates an instance of `struct_name` with elements `e0`...`en`.]]
|
||||
[[`struct_name(fs)`] [Copy constructs an instance of `struct_name` from a __forward_sequence__ `fs`.]]
|
||||
[[`str = fs`] [Assigns from a __forward_sequence__ `fs`.]]
|
||||
[[`str.member_nameN`] [Access of struct member `member_nameN`]]
|
||||
[[`str.member_nameN`] [Access of struct member `member_nameN`]]
|
||||
]
|
||||
|
||||
[heading Header]
|
||||
|
||||
#include <boost/fusion/adapted/struct/define_struct.hpp>
|
||||
#include <boost/fusion/include/define_struct.hpp>
|
||||
|
||||
|
||||
[heading Example]
|
||||
|
||||
// demo::employee is a Fusion sequence
|
||||
@ -1097,14 +1097,14 @@ defined in __random_access_sequence__.
|
||||
[[`Str(e0, e1,... en)`] [Creates an instance of `Str` with elements `e0`...`en`.]]
|
||||
[[`Str(fs)`] [Copy constructs an instance of `Str` from a __forward_sequence__ `fs`.]]
|
||||
[[`str = fs`] [Assigns from a __forward_sequence__ `fs`.]]
|
||||
[[`str.member_nameN`] [Access of struct member `member_nameN`]]
|
||||
[[`str.member_nameN`] [Access of struct member `member_nameN`]]
|
||||
]
|
||||
|
||||
[heading Header]
|
||||
|
||||
#include <boost/fusion/adapted/struct/define_struct.hpp>
|
||||
#include <boost/fusion/include/define_struct.hpp>
|
||||
|
||||
|
||||
[heading Example]
|
||||
|
||||
// Any instantiated demo::employee is a Fusion sequence
|
||||
@ -1256,14 +1256,14 @@ defined in __random_access_sequence__ and __associative_sequence__.
|
||||
[[`struct_name(e0, e1,... en)`] [Creates an instance of `struct_name` with elements `e0`...`en`.]]
|
||||
[[`struct_name(fs)`] [Copy constructs an instance of `struct_name` from a __forward_sequence__ `fs`.]]
|
||||
[[`str = fs`] [Assigns from a __forward_sequence__ `fs`.]]
|
||||
[[`str.member_nameN`] [Access of struct member `member_nameN`]]
|
||||
[[`str.member_nameN`] [Access of struct member `member_nameN`]]
|
||||
]
|
||||
|
||||
[heading Header]
|
||||
|
||||
#include <boost/fusion/adapted/struct/define_assoc_struct.hpp>
|
||||
#include <boost/fusion/include/define_assoc_struct.hpp>
|
||||
|
||||
|
||||
[heading Example]
|
||||
|
||||
namespace keys
|
||||
@ -1271,7 +1271,7 @@ defined in __random_access_sequence__ and __associative_sequence__.
|
||||
struct name;
|
||||
struct age;
|
||||
}
|
||||
|
||||
|
||||
// demo::employee is a Fusion sequence
|
||||
BOOST_FUSION_DEFINE_ASSOC_STRUCT(
|
||||
(demo), employee,
|
||||
@ -1332,14 +1332,14 @@ defined in __random_access_sequence__ and __associative_sequence__.
|
||||
[[`Str(e0, e1,... en)`] [Creates an instance of `Str` with elements `e0`...`en`.]]
|
||||
[[`Str(fs)`] [Copy constructs an instance of `Str` from a __forward_sequence__ `fs`.]]
|
||||
[[`str = fs`] [Assigns from a __forward_sequence__ `fs`.]]
|
||||
[[`str.member_nameN`] [Access of struct member `member_nameN`]]
|
||||
[[`str.member_nameN`] [Access of struct member `member_nameN`]]
|
||||
]
|
||||
|
||||
[heading Header]
|
||||
|
||||
#include <boost/fusion/adapted/struct/define_assoc_struct.hpp>
|
||||
#include <boost/fusion/include/define_assoc_struct.hpp>
|
||||
|
||||
|
||||
[heading Example]
|
||||
|
||||
namespace keys
|
||||
@ -1347,7 +1347,7 @@ defined in __random_access_sequence__ and __associative_sequence__.
|
||||
struct name;
|
||||
struct age;
|
||||
}
|
||||
|
||||
|
||||
// Any instantiated demo::employee is a Fusion sequence
|
||||
BOOST_FUSION_DEFINE_ASSOC_TPL_STRUCT(
|
||||
(Name)(Age), (demo), employee,
|
||||
|
@ -134,7 +134,7 @@ the first call) and [arg_desc] of `seq`.
|
||||
>
|
||||
typename result_of_name_macro<Sequence, State const, F>::type name_macro(
|
||||
Sequence& seq, State const& initial_state, F f);
|
||||
|
||||
|
||||
template<
|
||||
typename Sequence,
|
||||
typename State,
|
||||
|
@ -44,9 +44,5 @@ This section summarizes significant changes to the Fusion library.
|
||||
* September 16, 2011: Added preprocessed files (using wave) to speed up
|
||||
compilation (Joel de Guzman)
|
||||
* October 8, 2011: Added adaptor for std::tuple (Joel de Guzman)
|
||||
* October 10, 2011: Made map random access (Brandon Kohn)
|
||||
* April 7, 2012: Added C++11 version of deque
|
||||
* May 19, 2012: Added BOOST_FUSION_DEFINE_STRUCT_INLINE by Nathan Ridge
|
||||
* September 1, 2012: Added move support for deque and vector
|
||||
|
||||
[endsect]
|
||||
|
@ -635,7 +635,7 @@ including any Fusion header to change the default. Example:
|
||||
[heading Model of]
|
||||
|
||||
* __associative_sequence__
|
||||
* __random_access_sequence__
|
||||
* __forward_sequence__
|
||||
|
||||
[variablelist Notation
|
||||
[[`M`] [A `map` type]]
|
||||
@ -647,7 +647,7 @@ including any Fusion header to change the default. Example:
|
||||
[heading Expression Semantics]
|
||||
|
||||
Semantics of an expression is defined only where it differs from, or is not
|
||||
defined in __forward_sequence__ and __associative_sequence__.
|
||||
defined in __random_access_sequence__ and __associative_sequence__.
|
||||
|
||||
[table
|
||||
[[Expression] [Semantics]]
|
||||
@ -949,7 +949,7 @@ Create a __map__ from one or more key/data pairs.
|
||||
, 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_MAP_SIZE` elements,
|
||||
where `FUSION_MAX_MAP_SIZE` is a user definable predefined maximum that
|
||||
defaults to `10`. You may define the preprocessor constant
|
||||
@ -1357,8 +1357,8 @@ rules for __element_conversion__.
|
||||
|
||||
[heading Header]
|
||||
|
||||
#include <boost/fusion/container/generation/make_vector.hpp>
|
||||
#include <boost/fusion/include/make_vector.hpp>
|
||||
#include <boost/fusion/container/generation/make_list.hpp>
|
||||
#include <boost/fusion/include/make_list.hpp>
|
||||
|
||||
[heading Example]
|
||||
|
||||
|
@ -66,9 +66,9 @@ function objects to accept arbitrary calls. In other words, an unary function
|
||||
object can be implemented instead of (maybe heavily overloaded) function
|
||||
templates or function call operators.
|
||||
|
||||
The library provides both a strictly typed and a generic variant for this
|
||||
The library provides both a strictly typed and a generic variant for this
|
||||
transformation. The latter should be used in combination with
|
||||
__boost_func_forward__ to attack __the_forwarding_problem__.
|
||||
__boost_func_forward__ to attack __the_forwarding_problem__.
|
||||
|
||||
Both variants have a corresponding generator function template that returns an
|
||||
adapter instance for the given argument.
|
||||
@ -546,7 +546,7 @@ Returns the result type of __invoke_function_object__.
|
||||
|
||||
[heading Macros]
|
||||
|
||||
The following macros can be defined to change the maximum arity.
|
||||
The following macros can be defined to change the maximum arity.
|
||||
The default is 6.
|
||||
|
||||
* BOOST_FUSION_INVOKE_MAX_ARITY
|
||||
@ -1060,7 +1060,7 @@ signature is optimized automatically to avoid by-value parameters.]
|
||||
|
||||
[heading Macros]
|
||||
|
||||
The following macros can be defined to change the maximum arity.
|
||||
The following macros can be defined to change the maximum arity.
|
||||
The value used for these macros must not exceed `FUSION_MAX_VECTOR_SIZE`.
|
||||
The default is 6.
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
===============================================================================/]
|
||||
[library Fusion
|
||||
[quickbook 1.3]
|
||||
[version 2.2]
|
||||
[version 2.1]
|
||||
[authors [de Guzman, Joel], [Marsden, Dan], [Schwinger, Tobias]]
|
||||
[copyright 2001 2002 2003 2004 2005 2006 2011 2012 Joel de Guzman, Dan Marsden, Tobias Schwinger]
|
||||
[purpose Statically Typed Heterogeneous Data Structures and Algorithms]
|
||||
|
0
doc/html/images/alert.png
Executable file → Normal file
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 603 B |
0
doc/html/images/home.png
Executable file → Normal file
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 358 B |
0
doc/html/images/next.png
Executable file → Normal file
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 336 B |
0
doc/html/images/note.png
Executable file → Normal file
Before Width: | Height: | Size: 658 B After Width: | Height: | Size: 658 B |
0
doc/html/images/prev.png
Executable file → Normal file
Before Width: | Height: | Size: 334 B After Width: | Height: | Size: 334 B |
0
doc/html/images/smiley.png
Executable file → Normal file
Before Width: | Height: | Size: 867 B After Width: | Height: | Size: 867 B |
0
doc/html/images/tip.png
Executable file → Normal file
Before Width: | Height: | Size: 640 B After Width: | Height: | Size: 640 B |
0
doc/html/images/up.png
Executable file → Normal file
Before Width: | Height: | Size: 370 B After Width: | Height: | Size: 370 B |
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<head>
|
||||
<!-- Copyright (C) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
@ -8,9 +8,9 @@
|
||||
http://www.boost.org/LICENSE_1_0.txt) -->
|
||||
<title>Redirect to generated documentation</title>
|
||||
<meta http-equiv="refresh" content="0; URL=http://boost-sandbox.sourceforge.net/libs/fusion/doc/html/">
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
Automatic redirection failed, please go to
|
||||
<a href="http://boost-sandbox.sourceforge.net/libs/fusion/doc/html/">http://boost-sandbox.sourceforge.net/libs/fusion/doc/html/</a>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -161,7 +161,6 @@ the following invariants always hold:
|
||||
* __std_pair__ iterator
|
||||
* __boost_array__ iterator
|
||||
* __vector__ iterator
|
||||
* __map__ iterator
|
||||
* __single_view__ iterator
|
||||
* __iterator_range__ (where adapted sequence is a __bidirectional_sequence__)
|
||||
* __transform_view__ (where adapted sequence is a __bidirectional_sequence__)
|
||||
@ -207,7 +206,6 @@ the following expressions must be valid:
|
||||
|
||||
[heading Models]
|
||||
* __vector__ iterator
|
||||
* __map__ iterator
|
||||
* __std_pair__ iterator
|
||||
* __boost_array__ iterator
|
||||
* __single_view__ iterator
|
||||
@ -995,9 +993,9 @@ Returns the key type associated with the element referenced by an associative it
|
||||
[heading Example]
|
||||
typedef __map__<__pair__<float,int> > vec;
|
||||
typedef __result_of_begin__<vec>::type first;
|
||||
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_same<__result_of_key_of__<first>::type, float>));
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
[section value_of_data]
|
||||
@ -1034,9 +1032,9 @@ Returns the type of the data property associated with the element referenced by
|
||||
[heading Example]
|
||||
typedef __map__<__pair__<float,int> > vec;
|
||||
typedef __result_of_begin__<vec>::type first;
|
||||
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_same<__result_of_value_of_data__<first>::type, int>));
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
[section deref_data]
|
||||
|
@ -168,7 +168,7 @@ and __deref_data__) is a proxy type, an instance of
|
||||
has three template arguments:
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
{
|
||||
template<
|
||||
typename Type
|
||||
, int Index
|
||||
@ -176,14 +176,14 @@ has three template arguments:
|
||||
>
|
||||
struct adt_attribute_proxy;
|
||||
}}}
|
||||
|
||||
|
||||
When adapting a class type, `adt_attribute_proxy` is specialized for every
|
||||
element of the adapted sequence, with `Type` being the class type that is
|
||||
adapted, `Index` the 0-based indices of the elements, and `Const` both `true`
|
||||
and `false`. The return type of fusion's intrinsic sequence access functions
|
||||
for the ['N]th element of an adapted class type `type_name` is
|
||||
[^adt_attribute_proxy<type_name, ['N], ['Const]>], with [^['Const]] being `true`
|
||||
for constant instances of `type_name` and `false` for non-constant ones.
|
||||
for constant instances of `type_name` and `false` for non-constant ones.
|
||||
|
||||
[variablelist Notation
|
||||
[[`type_name`]
|
||||
@ -205,7 +205,7 @@ for constant instances of `type_name` and `false` for non-constant ones.
|
||||
]
|
||||
|
||||
[*Expression Semantics]
|
||||
|
||||
|
||||
[table
|
||||
[[Expression] [Semantics]]
|
||||
[[[^proxy_type['N](inst)]] [Creates an instance of [^proxy_type['N]] with underlying object `inst`]]
|
||||
|
@ -189,7 +189,6 @@ are not defined in __forward_sequence__.
|
||||
* __std_pair__
|
||||
* __boost_array__
|
||||
* __vector__
|
||||
* __map__
|
||||
* __reverse_view__
|
||||
* __single_view__
|
||||
* __iterator_range__ (where adapted sequence is a Bidirectional Sequence)
|
||||
@ -266,7 +265,6 @@ are not defined in __bidirectional_sequence__.
|
||||
* __std_pair__
|
||||
* __boost_array__
|
||||
* __vector__
|
||||
* __map__
|
||||
* __reverse_view__
|
||||
* __single_view__
|
||||
* __iterator_range__ (where adapted sequence is a Random Access Sequence)
|
||||
@ -283,7 +281,6 @@ An Associative Sequence allows efficient retrieval of elements based on keys.
|
||||
Like associative sequences in __mpl__, and unlike associative containers in
|
||||
__stl__, Fusion associative sequences have no implied ordering relation.
|
||||
Instead, type identity is used to impose an equivalence relation on keys.
|
||||
Keys are not checked for uniqueness.
|
||||
|
||||
[variablelist Notation
|
||||
[[`s`] [An Associative Sequence]]
|
||||
@ -851,7 +848,7 @@ Performs an element by element swap of the elements in 2 sequences.
|
||||
|
||||
[table
|
||||
[[Parameters] [Requirement] [Description]]
|
||||
[[`seq1`, `seq2`][Models of __forward_sequence__][The sequences whos elements we wish to swap.]]
|
||||
[[`seq1`, `seq2`] [Models of __forward_sequence__][The sequences whos elements we wish to swap.]]
|
||||
]
|
||||
|
||||
[heading Expression Semantics]
|
||||
@ -1379,7 +1376,7 @@ Returns the actual element type associated with a Key from the __sequence__.
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
|
||||
#include <boost/fusion/include/value_at_key.hpp>
|
||||
|
||||
|
||||
[heading Example]
|
||||
typedef __map__<__pair__<int, char>, __pair__<char, char>, __pair__<double, char> > mymap;
|
||||
BOOST_MPL_ASSERT((boost::is_same<__result_of_at_key__<mymap, int>::type, char>));
|
||||
|
@ -483,7 +483,7 @@ defined in the implemented models.
|
||||
|
||||
[heading Description]
|
||||
|
||||
`nview` presents a view which iterates over a given __sequence__ in a specified order.
|
||||
`nview` presents a view which iterates over a given __sequence__ in a specified order.
|
||||
An `nview` is constructed from an arbitrary __sequence__ and a list of indicies specifying
|
||||
the elements to iterate over.
|
||||
|
||||
@ -507,15 +507,15 @@ the elements to iterate over.
|
||||
[[Parameter] [Description] [Default]]
|
||||
[[`Sequence`] [An arbitrary Fusion __forward_sequence__]
|
||||
[]]
|
||||
[[`Indicies`] [A `mpl::vector_c<int, ...>` holding the indicies defining
|
||||
[[`Indicies`] [A `mpl::vector_c<int, ...>` holding the indicies defining
|
||||
the required iteration order.] []]
|
||||
[[`I1`, `I2`, `I3`...] [A list of integers specifying the required
|
||||
[[`I1`, `I2`, `I3`...] [A list of integers specifying the required
|
||||
iteration order.] [`INT_MAX` for `I2`, `I3`...]]
|
||||
]
|
||||
|
||||
[heading Model of]
|
||||
|
||||
* __random_access_sequence__ (see __traversal_concept__)
|
||||
* __random_access_sequence__ (see __traversal_concept__)
|
||||
|
||||
[variablelist Notation
|
||||
[[`NV`] [A `nview` type]]
|
||||
|
@ -3,7 +3,7 @@
|
||||
Copyright (c) 2011 Nathan Ridge
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
|
@ -19,10 +19,10 @@ namespace boost { namespace fusion
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, typename Dummy>
|
||||
struct get_identity
|
||||
: remove_const<typename remove_reference<T>::type>
|
||||
{};
|
||||
template <typename T, typename Dummy>
|
||||
struct get_identity
|
||||
: remove_const<typename remove_reference<T>::type>
|
||||
{};
|
||||
}
|
||||
|
||||
namespace extension
|
||||
|
@ -36,7 +36,7 @@
|
||||
// an alternate implementation for these metafunctions is used that does not
|
||||
// require such specializations. The alternate implementation takes longer
|
||||
// to compile so its use is restricted to the offending compilers.
|
||||
// For MSVC, the bug was reported at https://connect.microsoft.com/VisualStudio/feedback/details/757891/c-compiler-error-involving-partial-specializations-of-nested-templates
|
||||
// For MSVC, the bug was was reported at https://connect.microsoft.com/VisualStudio/feedback/details/757891/c-compiler-error-involving-partial-specializations-of-nested-templates
|
||||
// For GCC, 4.4 and earlier are no longer maintained so there is no need
|
||||
// to report a bug.
|
||||
#if defined(BOOST_MSVC) || (defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 4)))
|
||||
|
@ -27,7 +27,7 @@ namespace boost { namespace fusion
|
||||
{
|
||||
template <typename ...T>
|
||||
struct deque_tie
|
||||
{
|
||||
{
|
||||
typedef deque<T&...> type;
|
||||
};
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace boost { namespace fusion
|
||||
{
|
||||
return deque<typename detail::as_fusion_element<T>::type...>(arg...);
|
||||
}
|
||||
}}
|
||||
}}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@ namespace boost { namespace fusion
|
||||
, typename detail::as_fusion_element<T>::type
|
||||
>...>
|
||||
type;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ namespace boost { namespace fusion
|
||||
|
||||
return result_type(arg...);
|
||||
}
|
||||
}}
|
||||
}}
|
||||
|
||||
#endif
|
||||
#endif
|
@ -29,7 +29,7 @@ namespace boost { namespace fusion
|
||||
struct apply
|
||||
{
|
||||
typedef map<fusion::pair<Key, T&>...> type;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ namespace boost { namespace fusion
|
||||
typedef map<fusion::pair<Key, T&>...> result_type;
|
||||
return result_type(arg...);
|
||||
}
|
||||
}}
|
||||
}}
|
||||
|
||||
#endif
|
||||
#endif
|
@ -2,7 +2,7 @@
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005 Eric Niebler
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_CONS_FWD_HPP_INCLUDED)
|
||||
|
@ -50,6 +50,30 @@ namespace boost { namespace fusion
|
||||
typedef result_of::as_map<Sequence const> gen;
|
||||
return gen::call(fusion::begin(seq), fusion::end(seq));
|
||||
}
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template <typename T>
|
||||
struct convert_impl;
|
||||
|
||||
template <>
|
||||
struct convert_impl<map_tag>
|
||||
{
|
||||
template <typename Sequence>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
result_of::as_map<Sequence>::type
|
||||
type;
|
||||
|
||||
static type call(Sequence& seq)
|
||||
{
|
||||
typedef result_of::as_map<Sequence> gen;
|
||||
return gen::call(fusion::begin(seq), fusion::end(seq));
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
@ -19,7 +19,7 @@
|
||||
#else
|
||||
# if !defined(BOOST_FUSION_HAS_VARIADIC_MAP)
|
||||
# define BOOST_FUSION_HAS_VARIADIC_MAP
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <boost/fusion/container/map/detail/map_impl.hpp>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
|
@ -39,7 +39,7 @@ namespace boost { namespace fusion
|
||||
|
||||
template<typename Tag, typename Category, typename Seq, int Index>
|
||||
struct basic_iterator
|
||||
: iterator_facade<basic_iterator<Tag, Category, Seq, Index>, Category>
|
||||
: iterator_facade<basic_iterator<Tag,Category,Seq,Index>, Category>
|
||||
{
|
||||
typedef mpl::int_<Index> index;
|
||||
typedef Seq seq_type;
|
||||
|
@ -22,19 +22,19 @@ namespace boost { namespace fusion { namespace detail
|
||||
// return make_segmented_iterator( segmented_begin_impl( seq, nil_ ) );
|
||||
//}
|
||||
|
||||
template <typename Sequence, typename Nil = fusion::nil_>
|
||||
template <typename Sequence, typename Nil_ = fusion::nil_>
|
||||
struct segmented_begin
|
||||
{
|
||||
typedef
|
||||
segmented_iterator<
|
||||
typename segmented_begin_impl<Sequence, Nil>::type
|
||||
typename segmented_begin_impl<Sequence, Nil_>::type
|
||||
>
|
||||
type;
|
||||
|
||||
static type call(Sequence& seq)
|
||||
{
|
||||
return type(
|
||||
segmented_begin_impl<Sequence, Nil>::call(seq, Nil()));
|
||||
segmented_begin_impl<Sequence, Nil_>::call(seq, Nil_()));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -18,19 +18,19 @@ namespace boost { namespace fusion { namespace detail
|
||||
// return make_segmented_iterator( segmented_end_impl( seq ) );
|
||||
//}
|
||||
|
||||
template <typename Sequence, typename Nil = fusion::nil_>
|
||||
template <typename Sequence, typename Nil_ = fusion::nil_>
|
||||
struct segmented_end
|
||||
{
|
||||
typedef
|
||||
segmented_iterator<
|
||||
typename segmented_end_impl<Sequence, Nil>::type
|
||||
typename segmented_end_impl<Sequence, Nil_>::type
|
||||
>
|
||||
type;
|
||||
|
||||
static type call(Sequence & seq)
|
||||
{
|
||||
return type(
|
||||
segmented_end_impl<Sequence, Nil>::call(seq, Nil()));
|
||||
segmented_end_impl<Sequence, Nil_>::call(seq, Nil_()));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
#if !defined(FUSION_ACCESS_04182005_0737)
|
||||
@ -21,10 +21,10 @@ namespace boost { namespace fusion { namespace detail
|
||||
template <typename T>
|
||||
struct cref_result
|
||||
{
|
||||
typedef typename
|
||||
typedef typename
|
||||
add_reference<
|
||||
typename add_const<T>::type
|
||||
>::type
|
||||
>::type
|
||||
type;
|
||||
};
|
||||
|
||||
@ -35,7 +35,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct call_param<T&>
|
||||
struct call_param<T &>
|
||||
{
|
||||
typedef T& type;
|
||||
};
|
||||
|
@ -61,7 +61,7 @@ namespace boost { namespace fusion
|
||||
struct is_sequence
|
||||
: mpl::bool_<
|
||||
(bool)extension::is_sequence_impl<
|
||||
typename fusion::detail::tag_of<T>::type
|
||||
typename fusion::detail::tag_of<T>::type
|
||||
>::template apply<T>::type::value
|
||||
>
|
||||
{};
|
||||
|
@ -13,4 +13,3 @@
|
||||
#include <boost/fusion/container/generation/ignore.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -18,5 +18,4 @@
|
||||
#include <boost/fusion/tuple/detail/preprocessed/tuple50.hpp>
|
||||
#else
|
||||
#error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
|
||||
#endif
|
||||
|
||||
#endif
|
@ -112,4 +112,3 @@ namespace boost { namespace fusion
|
||||
#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -48,4 +48,3 @@ namespace boost { namespace fusion
|
||||
#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -89,12 +89,6 @@ project
|
||||
[ run sequence/make_list.cpp : : : : ]
|
||||
[ run sequence/make_vector.cpp : : : : ]
|
||||
[ run sequence/map.cpp : : : : ]
|
||||
[ run sequence/map_comparison.cpp : : : : ]
|
||||
[ run sequence/map_construction.cpp : : : : ]
|
||||
[ run sequence/map_copy.cpp : : : : ]
|
||||
[ run sequence/map_misc.cpp : : : : ]
|
||||
[ run sequence/map_move.cpp : : : : ]
|
||||
[ run sequence/map_mutate.cpp : : : : ]
|
||||
[ run sequence/map_tie.cpp : : : : ]
|
||||
[ run sequence/nview.cpp : : : : ]
|
||||
[ run sequence/reverse_view.cpp : : : : ]
|
||||
@ -144,13 +138,10 @@ project
|
||||
[ run sequence/adapt_tpl_struct.cpp : : : : ]
|
||||
[ run sequence/adt_attribute_proxy.cpp : : : : ]
|
||||
[ run sequence/define_struct.cpp : : : : ]
|
||||
[ run sequence/define_struct_inline.cpp : : : : ]
|
||||
[ run sequence/define_assoc_struct.cpp : : : : ]
|
||||
[ run sequence/define_tpl_struct.cpp : : : : ]
|
||||
[ run sequence/define_tpl_struct_inline.cpp : : : : ]
|
||||
[ run sequence/define_assoc_tpl_struct.cpp : : : : ]
|
||||
[ run sequence/std_tuple_iterator.cpp : : : : ]
|
||||
[ run sequence/ref_vector.cpp : : : : ]
|
||||
|
||||
[ run functional/fused.cpp : : : : ]
|
||||
[ run functional/fused_function_object.cpp : : : : ]
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
@ -75,7 +75,7 @@ main()
|
||||
//~ std::cout << pop_back(l) << std::endl;
|
||||
//~ }
|
||||
|
||||
#ifndef BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
#ifndef BOOST_NO_AUTO_DECLARATIONS
|
||||
{
|
||||
auto vec = make_vector(1, 3.14, "hello");
|
||||
|
||||
|
@ -10,10 +10,6 @@
|
||||
#include <boost/fusion/functional/invocation/invoke.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#include <functional>
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
@ -76,8 +72,6 @@ struct fobj
|
||||
|
||||
int operator()(int i, object &, object_nc &) { return 10 + i; }
|
||||
int operator()(int i, object &, object_nc &) const { return 11 + i; }
|
||||
int operator()(int i, object const &, object_nc &);
|
||||
int operator()(int i, object const &, object_nc &) const;
|
||||
};
|
||||
|
||||
struct nullary_fobj
|
||||
@ -234,8 +228,7 @@ void test_sequence_n(Sequence & seq, mpl::int_<0>)
|
||||
|
||||
// Pointer to data member
|
||||
|
||||
// $$$ JDG $$$ disabling this test due to C++11 error: assignment of read-only location
|
||||
//~ BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_obj_ctx,seq)) = that.data));
|
||||
BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_obj_ctx,seq)) = that.data));
|
||||
BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_ref_ctx,seq)) = that.data));
|
||||
BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_ptr_ctx,seq)) = that.data));
|
||||
BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_spt_ctx,seq)) = that.data));
|
||||
@ -244,8 +237,7 @@ void test_sequence_n(Sequence & seq, mpl::int_<0>)
|
||||
BOOST_TEST(that.data == fusion::invoke(& members::data, fusion::join(sv_ptr_c_ctx,seq)));
|
||||
BOOST_TEST(that.data == fusion::invoke(& members::data, fusion::join(sv_spt_c_ctx,seq)));
|
||||
|
||||
// $$$ JDG $$$ disabling this test due to C++11 error: assignment of read-only location
|
||||
//~ BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_obj_d_ctx,seq)) = that.data));
|
||||
BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_obj_d_ctx,seq)) = that.data));
|
||||
BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_ref_d_ctx,seq)) = that.data));
|
||||
BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_ptr_d_ctx,seq)) = that.data));
|
||||
BOOST_TEST(that.data == (fusion::invoke(& members::data, fusion::join(sv_spt_d_ctx,seq)) = that.data));
|
||||
@ -375,17 +367,7 @@ int main()
|
||||
vector0 v0;
|
||||
vector1 v1(element1);
|
||||
vector2 v2(element1, element2);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
// Note: C++11 will pickup the rvalue overload for the d argument
|
||||
// since we do not have all permutations (expensive!) for all const&
|
||||
// and && arguments. We either have all && or all const& arguments only.
|
||||
// For that matter, use std::ref to disambiguate the call.
|
||||
|
||||
vector3 v3(element1, element2, std::ref(element3));
|
||||
#else
|
||||
vector3 v3(element1, element2, element3);
|
||||
#endif
|
||||
|
||||
test_sequence(v0);
|
||||
test_sequence(v1);
|
||||
|
@ -10,10 +10,6 @@
|
||||
#include <boost/fusion/functional/invocation/invoke_function_object.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#include <functional>
|
||||
#endif
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <memory>
|
||||
@ -79,8 +75,6 @@ struct fobj
|
||||
|
||||
int operator()(int i, object &, object_nc &) { return 10 + i; }
|
||||
int operator()(int i, object &, object_nc &) const { return 11 + i; }
|
||||
int operator()(int i, object const &, object_nc &);
|
||||
int operator()(int i, object const &, object_nc &) const;
|
||||
};
|
||||
|
||||
struct nullary_fobj
|
||||
@ -213,17 +207,7 @@ int main()
|
||||
vector0 v0;
|
||||
vector1 v1(element1);
|
||||
vector2 v2(element1, element2);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
// Note: C++11 will pickup the rvalue overload for the d argument
|
||||
// since we do not have all permutations (expensive!) for all const&
|
||||
// and && arguments. We either have all && or all const& arguments only.
|
||||
// For that matter, use std::ref to disambiguate the call.
|
||||
|
||||
vector3 v3(element1, element2, std::ref(element3));
|
||||
#else
|
||||
vector3 v3(element1, element2, element3);
|
||||
#endif
|
||||
|
||||
test_sequence(v0);
|
||||
test_sequence(v1);
|
||||
|
@ -10,10 +10,6 @@
|
||||
#include <boost/fusion/functional/invocation/invoke_procedure.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#include <functional>
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
@ -260,19 +256,8 @@ int main()
|
||||
|
||||
vector0 v0;
|
||||
vector1 v1(element1);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
// Note: C++11 will pickup the rvalue overload for the d argument
|
||||
// since we do not have all permutations (expensive!) for all const&
|
||||
// and && arguments. We either have all && or all const& arguments only.
|
||||
// For that matter, use std::ref to disambiguate the call.
|
||||
|
||||
vector2 v2(std::ref(element1), element2);
|
||||
vector3 v3(std::ref(element1), element2, std::ref(element3));
|
||||
#else
|
||||
vector2 v2(element1, element2);
|
||||
vector3 v3(element1, element2, element3);
|
||||
#endif
|
||||
|
||||
test_sequence(v0);
|
||||
test_sequence(v1);
|
||||
|
@ -71,7 +71,7 @@ void result_type_tests()
|
||||
|
||||
typedef fusion::unfused< test_func<> > t;
|
||||
BOOST_TEST(( is_same< boost::result_of< t () >::type, long >::value ));
|
||||
BOOST_TEST(( is_same< boost::result_of< t (int &) >::type, long >::value ));
|
||||
BOOST_TEST(( is_same< boost::result_of< t (int) >::type, long >::value ));
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -85,7 +85,7 @@ void result_type_tests()
|
||||
typedef fusion::unfused_typed< test_func<>, types0 > t0;
|
||||
BOOST_TEST(( is_same< boost::result_of< t0 () >::type, long >::value ));
|
||||
typedef fusion::unfused_typed< test_func<>, types1 > t1;
|
||||
BOOST_TEST(( is_same< boost::result_of< t1 (long &) >::type, long >::value ));
|
||||
BOOST_TEST(( is_same< boost::result_of< t1 (int) >::type, long >::value ));
|
||||
}
|
||||
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC < 1400
|
||||
|
@ -154,7 +154,7 @@ main()
|
||||
BOOST_TEST(v3 > v2);
|
||||
BOOST_TEST(v3 >= v2);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
fusion::vector<std::string, std::string> v1("Lincoln", "Abraham");
|
||||
ns::name v2("Roosevelt", "Franklin");
|
||||
|
@ -3,7 +3,7 @@
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/fusion/container/deque/deque.hpp>
|
||||
|
@ -2,7 +2,7 @@
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/fusion/container/deque/deque.hpp>
|
||||
|
@ -3,15 +3,13 @@
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/fusion/container/deque/deque.hpp>
|
||||
#include <boost/fusion/container/deque/convert.hpp>
|
||||
#include <boost/fusion/adapted/mpl.hpp>
|
||||
|
||||
#define BOOST_FUSION_SEQUENCE_CONVERSION_IS_NOT_SEQUENCE__TYPE_PRESERVING
|
||||
|
||||
#define FUSION_SEQUENCE deque
|
||||
#include "misc.hpp"
|
||||
|
||||
|
@ -9,13 +9,11 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
|
||||
#include <boost/fusion/container/deque/deque.hpp>
|
||||
|
||||
#define FUSION_SEQUENCE boost::fusion::deque<std::vector<x>>
|
||||
#define FUSION_SEQUENCE2 boost::fusion::deque<std::vector<x>, x>
|
||||
|
||||
#define FUSION_SEQUENCE boost::fusion::deque
|
||||
#include "move.hpp"
|
||||
|
||||
#else
|
||||
@ -25,7 +23,7 @@
|
||||
int
|
||||
main()
|
||||
{
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
test();
|
||||
#endif
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <string>
|
||||
@ -113,7 +113,7 @@ void test()
|
||||
BOOST_TEST(*next(next(next(i))) == s);
|
||||
|
||||
next(next(next(next(i)))); // end
|
||||
|
||||
|
||||
#ifdef FUSION_TEST_FAIL
|
||||
next(next(next(next(next(i))))); // past the end: must not compile
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
@ -20,8 +20,6 @@
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
@ -41,19 +39,18 @@ main()
|
||||
{
|
||||
typedef map<
|
||||
pair<int, char>
|
||||
, pair<double, std::string> >
|
||||
, pair<double, std::string> >
|
||||
map_type;
|
||||
|
||||
BOOST_MPL_ASSERT((traits::is_associative<map_type>));
|
||||
BOOST_MPL_ASSERT((traits::is_random_access<map_type>));
|
||||
|
||||
|
||||
map_type m(
|
||||
make_pair<int>('X')
|
||||
, make_pair<double>("Men"));
|
||||
|
||||
|
||||
std::cout << at_key<int>(m) << std::endl;
|
||||
std::cout << at_key<double>(m) << std::endl;
|
||||
|
||||
|
||||
BOOST_TEST(at_key<int>(m) == 'X');
|
||||
BOOST_TEST(at_key<double>(m) == "Men");
|
||||
|
||||
@ -61,7 +58,7 @@ main()
|
||||
boost::is_same<boost::fusion::result_of::value_at_key<map_type, int>::type, char>::value));
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_same<boost::fusion::result_of::value_at_key<map_type, double>::type, std::string>::value));
|
||||
|
||||
|
||||
std::cout << m << std::endl;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<map_type, int>::value));
|
||||
@ -78,42 +75,8 @@ main()
|
||||
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<map_type>::type>::type>::type, double>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<map_type>::type>::type, char>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<map_type>::type>::type>::type, std::string>::value));
|
||||
|
||||
// Test random access interface.
|
||||
pair<int, char> a = at_c<0>(m); (void) a;
|
||||
pair<double, std::string> b = at_c<1>(m);
|
||||
}
|
||||
|
||||
// iterators & random access interface.
|
||||
{
|
||||
typedef pair<boost::mpl::int_<0>, std::string> pair0;
|
||||
typedef pair<boost::mpl::int_<1>, std::string> pair1;
|
||||
typedef pair<boost::mpl::int_<2>, std::string> pair2;
|
||||
typedef pair<boost::mpl::int_<3>, std::string> pair3;
|
||||
typedef pair<boost::mpl::int_<4>, std::string> pair4;
|
||||
|
||||
typedef map< pair0, pair1, pair2, pair3, pair4 > map_type;
|
||||
map_type m( pair0("zero"), pair1("one"), pair2("two"), pair3("three"), pair4("four") );
|
||||
BOOST_AUTO( it0, begin(m) );
|
||||
BOOST_TEST((deref(it0) == pair0("zero")));
|
||||
BOOST_AUTO( it1, fusion::next(it0) );
|
||||
BOOST_TEST((deref(it1) == pair1("one")));
|
||||
BOOST_AUTO( it2, fusion::next(it1) );
|
||||
BOOST_TEST((deref(it2) == pair2("two")));
|
||||
BOOST_AUTO( it3, fusion::next(it2) );
|
||||
BOOST_TEST((deref(it3) == pair3("three")));
|
||||
BOOST_AUTO( it4, fusion::next(it3) );
|
||||
BOOST_TEST((deref(it4) == pair4("four")));
|
||||
|
||||
BOOST_TEST((deref(fusion::advance_c<4>(it0)) == deref(it4)));
|
||||
|
||||
// Bi-directional
|
||||
BOOST_TEST((deref(fusion::prior(it4)) == deref(it3) ));
|
||||
BOOST_TEST((deref(fusion::prior(it3)) == deref(it2) ));
|
||||
BOOST_TEST((deref(fusion::prior(it2)) == deref(it1) ));
|
||||
BOOST_TEST((deref(fusion::prior(it1)) == deref(it0) ));
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
std::cout << make_map<char, int>('X', 123) << std::endl;
|
||||
BOOST_TEST(at_key<char>(make_map<char, int>('X', 123)) == 'X');
|
||||
|
@ -1,68 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1999-2003 Jaakko Jarvi
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/fusion/container/map/map.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/fusion/sequence/comparison.hpp>
|
||||
|
||||
struct key1 {};
|
||||
struct key2 {};
|
||||
struct key3 {};
|
||||
|
||||
void
|
||||
equality_test()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
|
||||
map<pair<key1, int>, pair<key2, char> > v1(5, 'a');
|
||||
map<pair<key1, int>, pair<key2, char> > v2(5, 'a');
|
||||
BOOST_TEST(v1 == v2);
|
||||
|
||||
map<pair<key1, int>, pair<key2, char> > v3(5, 'b');
|
||||
map<pair<key1, int>, pair<key2, char> > t4(2, 'a');
|
||||
BOOST_TEST(v1 != v3);
|
||||
BOOST_TEST(v1 != t4);
|
||||
BOOST_TEST(!(v1 != v2));
|
||||
|
||||
map<pair<key1, int>, pair<key2, char>, pair<key2, bool> > v5(5, 'a', true);
|
||||
BOOST_TEST(v1 != v5);
|
||||
BOOST_TEST(!(v1 == v5));
|
||||
BOOST_TEST(v5 != v1);
|
||||
BOOST_TEST(!(v5 == v1));
|
||||
}
|
||||
|
||||
void
|
||||
ordering_test()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
|
||||
map<pair<key1, int>, pair<key2, float> > v1(4, 3.3f);
|
||||
map<pair<key1, short>, pair<key2, float> > v2(5, 3.3f);
|
||||
map<pair<key1, long>, pair<key2, double> > v3(5, 4.4);
|
||||
BOOST_TEST(v1 < v2);
|
||||
BOOST_TEST(v1 <= v2);
|
||||
BOOST_TEST(v2 > v1);
|
||||
BOOST_TEST(v2 >= v1);
|
||||
BOOST_TEST(v2 < v3);
|
||||
BOOST_TEST(v2 <= v3);
|
||||
BOOST_TEST(v3 > v2);
|
||||
BOOST_TEST(v3 >= v2);
|
||||
|
||||
#if defined(FUSION_TEST_FAIL)
|
||||
map<int, char, bool> v5(5, 'a', true);
|
||||
v1 >= v5;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
equality_test();
|
||||
ordering_test();
|
||||
return boost::report_errors();
|
||||
}
|
@ -1,131 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1999-2003 Jaakko Jarvi
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/fusion/container/map/map.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
|
||||
struct key1 {};
|
||||
struct key2 {};
|
||||
struct key3 {};
|
||||
|
||||
namespace test_detail
|
||||
{
|
||||
// something to prevent warnings for unused variables
|
||||
template<class T> void dummy(const T&) {}
|
||||
|
||||
// no public default constructor
|
||||
class foo
|
||||
{
|
||||
public:
|
||||
|
||||
explicit foo(int v) : val(v) {}
|
||||
|
||||
bool operator==(const foo& other) const
|
||||
{
|
||||
return val == other.val;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
foo() {}
|
||||
int val;
|
||||
};
|
||||
|
||||
// another class without a public default constructor
|
||||
class no_def_constructor
|
||||
{
|
||||
no_def_constructor() {}
|
||||
|
||||
public:
|
||||
|
||||
no_def_constructor(std::string) {}
|
||||
};
|
||||
}
|
||||
|
||||
inline void
|
||||
test()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
using namespace test_detail;
|
||||
|
||||
nil empty;
|
||||
|
||||
map<> empty0;
|
||||
|
||||
#ifndef NO_CONSTRUCT_FROM_NIL
|
||||
map<> empty1(empty);
|
||||
#endif
|
||||
|
||||
map<pair<key1, int> > t1;
|
||||
BOOST_TEST(at_c<0>(t1).second == int());
|
||||
|
||||
map<pair<key1, float> > t2(5.5f);
|
||||
BOOST_TEST(at_c<0>(t2).second > 5.4f && at_c<0>(t2).second < 5.6f);
|
||||
|
||||
map<pair<key1, foo> > t3(foo(12));
|
||||
BOOST_TEST(at_c<0>(t3).second == foo(12));
|
||||
|
||||
map<pair<key1, double> > t4(t2);
|
||||
BOOST_TEST(at_c<0>(t4).second > 5.4 && at_c<0>(t4).second < 5.6);
|
||||
|
||||
map<pair<key1, int>, pair<key2, float> > t5;
|
||||
BOOST_TEST(at_c<0>(t5).second == int());
|
||||
BOOST_TEST(at_c<1>(t5).second == float());
|
||||
|
||||
map<pair<key1, int>, pair<key2, float> > t6(12, 5.5f);
|
||||
BOOST_TEST(at_c<0>(t6).second == 12);
|
||||
BOOST_TEST(at_c<1>(t6).second > 5.4f && at_c<1>(t6).second < 5.6f);
|
||||
|
||||
map<pair<key1, int>, pair<key2, float> > t7(t6);
|
||||
BOOST_TEST(at_c<0>(t7).second == 12);
|
||||
BOOST_TEST(at_c<1>(t7).second > 5.4f && at_c<1>(t7).second < 5.6f);
|
||||
|
||||
map<pair<key1, long>, pair<key2, double> > t8(t6);
|
||||
BOOST_TEST(at_c<0>(t8).second == 12);
|
||||
BOOST_TEST(at_c<1>(t8).second > 5.4f && at_c<1>(t8).second < 5.6f);
|
||||
|
||||
dummy
|
||||
(
|
||||
map<
|
||||
pair<key1, no_def_constructor>,
|
||||
pair<key2, no_def_constructor>,
|
||||
pair<key3, no_def_constructor> >
|
||||
(
|
||||
pair<key1, no_def_constructor>(std::string("Jaba")), // ok, since the default
|
||||
pair<key2, no_def_constructor>(std::string("Daba")), // constructor is not used
|
||||
pair<key3, no_def_constructor>(std::string("Doo"))
|
||||
)
|
||||
);
|
||||
|
||||
dummy(map<pair<key1, int>, pair<key2, double> >());
|
||||
dummy(map<pair<key1, int>, pair<key2, double> >(1,3.14));
|
||||
|
||||
#if defined(FUSION_TEST_FAIL)
|
||||
dummy(map<pair<key1, double&> >()); // should fail, no defaults for references
|
||||
dummy(map<pair<key1, const double&> >()); // likewise
|
||||
#endif
|
||||
|
||||
{
|
||||
double dd = 5;
|
||||
dummy(map<pair<key1, double&> >(pair<key1, double&>(dd))); // ok
|
||||
dummy(map<pair<key1, const double&> >(pair<key1, const double&>(dd+3.14))); // ok, but dangerous
|
||||
}
|
||||
|
||||
#if defined(FUSION_TEST_FAIL)
|
||||
dummy(map<pair<key1, double&> >(dd+3.14)); // should fail,
|
||||
// temporary to non-const reference
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test();
|
||||
return boost::report_errors();
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1999-2003 Jaakko Jarvi
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/fusion/container/map/map.hpp>
|
||||
#include <boost/fusion/container/generation/make_map.hpp>
|
||||
#include <boost/fusion/container/generation/map_tie.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
#include <boost/fusion/mpl.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/mpl/insert_range.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/mpl/begin.hpp>
|
||||
#include <boost/mpl/equal.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <string>
|
||||
|
||||
struct k1 {};
|
||||
struct k2 {};
|
||||
struct k3 {};
|
||||
struct k4 {};
|
||||
|
||||
namespace test_detail
|
||||
{
|
||||
// classes with different kinds of conversions
|
||||
class AA {};
|
||||
class BB : public AA {};
|
||||
struct CC { CC() {} CC(const BB&) {} };
|
||||
struct DD { operator CC() const { return CC(); }; };
|
||||
}
|
||||
|
||||
boost::fusion::map<
|
||||
boost::fusion::pair<k1, double>,
|
||||
boost::fusion::pair<k2, double>,
|
||||
boost::fusion::pair<k3, double>,
|
||||
boost::fusion::pair<k4, double>
|
||||
>
|
||||
foo(int i)
|
||||
{
|
||||
return boost::fusion::make_map<k1, k2, k3, k4>(i, i+1, i+2, i+3);
|
||||
}
|
||||
|
||||
void
|
||||
test()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
using namespace test_detail;
|
||||
|
||||
map<pair<k1, int>, pair<k2, char> > t1(4, 'a');
|
||||
map<pair<k1, int>, pair<k2, char> > t2(5, 'b');
|
||||
t2 = t1;
|
||||
BOOST_TEST(at_c<0>(t1).second == at_c<0>(t2).second);
|
||||
BOOST_TEST(at_c<1>(t1).second == at_c<1>(t2).second);
|
||||
|
||||
map<pair<k1, int>, pair<k2, char const*> > t4(4, "a");
|
||||
map<pair<k1, long>, pair<k2, std::string> > t3(2, std::string("a"));
|
||||
t3 = t4;
|
||||
BOOST_TEST((double)at_c<0>(t4).second == at_c<0>(t3).second);
|
||||
BOOST_TEST(at_c<1>(t4).second == at_c<1>(t3).second);
|
||||
|
||||
// testing copy and assignment with implicit conversions
|
||||
// between elements testing tie
|
||||
|
||||
map<pair<k1, char>, pair<k2, BB*>, pair<k3, BB>, pair<k4, DD> > t;
|
||||
map<pair<k1, int>, pair<k2, AA*>, pair<k3, CC>, pair<k4, CC> > a(t);
|
||||
a = t;
|
||||
|
||||
int i; char c; double d;
|
||||
map_tie<k1, k2, k3>(i, c, d) = make_map<k1, k2, k3>(1, 'a', 5.5);
|
||||
|
||||
BOOST_TEST(i==1);
|
||||
BOOST_TEST(c=='a');
|
||||
BOOST_TEST(d>5.4 && d<5.6);
|
||||
|
||||
// returning a map with conversion
|
||||
foo(2);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test();
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,167 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1999-2003 Jaakko Jarvi
|
||||
Copyright (c) 2001-2013 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/fusion/container/map/map.hpp>
|
||||
#include <boost/fusion/container/map/convert.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic.hpp>
|
||||
#include <boost/fusion/support/is_sequence.hpp>
|
||||
#include <boost/fusion/mpl.hpp>
|
||||
#include <boost/mpl/find.hpp>
|
||||
#include <boost/mpl/equal.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/integral_c.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <string>
|
||||
|
||||
struct k1 {};
|
||||
struct k2 {};
|
||||
struct k3 {};
|
||||
struct k4 {};
|
||||
|
||||
template <typename S1, typename S2>
|
||||
struct is_same
|
||||
{
|
||||
};
|
||||
|
||||
namespace fn = boost::fusion;
|
||||
|
||||
struct test_intrinsics1
|
||||
{
|
||||
// test at, begin, end, next, prior, advance, size, deref, etc.
|
||||
|
||||
typedef fn::map<
|
||||
fn::pair<k1, int>, fn::pair<k2, float>,
|
||||
fn::pair<k3, bool>, fn::pair<k3, char> >
|
||||
sequence;
|
||||
|
||||
typedef boost::mpl::begin<sequence>::type first;
|
||||
typedef boost::mpl::next<first>::type second;
|
||||
typedef boost::mpl::next<second>::type third;
|
||||
typedef boost::mpl::next<third>::type fourth;
|
||||
typedef boost::mpl::end<sequence>::type last;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<
|
||||
boost::mpl::deref<first>::type, fn::pair<k1, int> >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<
|
||||
boost::mpl::deref<second>::type, fn::pair<k2, float> >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<
|
||||
boost::mpl::deref<third>::type, fn::pair<k3, bool> >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<
|
||||
boost::mpl::deref<fourth>::type, fn::pair<k3, char> >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<
|
||||
boost::mpl::at_c<sequence, 2>::type, fn::pair<k3, bool> >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<
|
||||
boost::mpl::front<sequence>::type, fn::pair<k1, int> >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<
|
||||
boost::mpl::deref<
|
||||
boost::mpl::advance_c<second, 2>::type>::type, fn::pair<k3, char> >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::mpl::size<sequence>::value == 4));
|
||||
BOOST_STATIC_ASSERT(!(boost::mpl::empty<sequence>::value));
|
||||
BOOST_STATIC_ASSERT((boost::mpl::distance<second, fourth>::value == 2));
|
||||
|
||||
typedef boost::mpl::prior<last>::type fourth_;
|
||||
typedef boost::mpl::prior<fourth_>::type third_;
|
||||
typedef boost::mpl::prior<third_>::type second_;
|
||||
typedef boost::mpl::prior<second_>::type first_;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<
|
||||
boost::mpl::deref<first_>::type, fn::pair<k1, int> >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<
|
||||
boost::mpl::deref<second_>::type, fn::pair<k2, float> >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<
|
||||
boost::mpl::deref<third_>::type, fn::pair<k3, bool> >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<
|
||||
boost::mpl::deref<fourth_>::type, fn::pair<k3, char> >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<
|
||||
boost::mpl::back<sequence>::type, fn::pair<k3, char> >::value));
|
||||
|
||||
};
|
||||
|
||||
void
|
||||
test()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
|
||||
{ // testing const sequences
|
||||
|
||||
const map<pair<k1, int>, pair<k2, float> > t1(5, 3.3f);
|
||||
BOOST_TEST(at_c<0>(t1).second == 5);
|
||||
BOOST_TEST(at_c<1>(t1).second == 3.3f);
|
||||
}
|
||||
|
||||
{ // testing at<N> works with MPL integral constants
|
||||
const map<pair<k1, int>, pair<k2, char> > t1(101, 'z');
|
||||
BOOST_TEST(boost::fusion::at<boost::mpl::int_<0> >(t1).second == 101);
|
||||
BOOST_TEST(boost::fusion::at<boost::mpl::int_<1> >(t1).second == 'z');
|
||||
// explicitly try something other than mpl::int_
|
||||
BOOST_TEST((boost::fusion::at<boost::mpl::integral_c<long, 0> >(t1).second == 101));
|
||||
BOOST_TEST((boost::fusion::at<boost::mpl::integral_c<long, 1> >(t1).second == 'z'));
|
||||
}
|
||||
|
||||
{ // testing size & empty
|
||||
|
||||
typedef map<pair<k1, int>, pair<k2, float>, pair<k3, double> > t1;
|
||||
typedef map<> t2;
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<t1>::value == 3);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<t2>::value == 0);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<t1>::value);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::empty<t2>::value);
|
||||
}
|
||||
|
||||
{ // testing front & back
|
||||
|
||||
typedef map<pair<k1, int>, pair<k2, float>, pair<k3, std::string> > tup;
|
||||
tup t(1, 2.2f, std::string("Kimpo"));
|
||||
|
||||
BOOST_TEST(front(t).second == 1);
|
||||
BOOST_TEST(back(t).second == "Kimpo");
|
||||
}
|
||||
|
||||
{ // testing is_sequence
|
||||
|
||||
typedef map<pair<k1, int>, pair<k2, float>, pair<k3, double> > t1;
|
||||
typedef map<> t2;
|
||||
typedef map<pair<k1, char> > t3;
|
||||
|
||||
BOOST_STATIC_ASSERT(traits::is_sequence<t1>::value);
|
||||
BOOST_STATIC_ASSERT(traits::is_sequence<t2>::value);
|
||||
BOOST_STATIC_ASSERT(traits::is_sequence<t3>::value);
|
||||
BOOST_STATIC_ASSERT(!traits::is_sequence<int>::value);
|
||||
BOOST_STATIC_ASSERT(!traits::is_sequence<char>::value);
|
||||
}
|
||||
|
||||
{ // testing mpl compatibility
|
||||
|
||||
// test an algorithm
|
||||
typedef map<pair<k1, int>, pair<k2, float>, pair<k3, double> > t1;
|
||||
typedef boost::mpl::find<t1, pair<k2, float> >::type iter;
|
||||
typedef boost::mpl::deref<iter>::type type;
|
||||
BOOST_STATIC_ASSERT((boost::is_same<type, pair<k2, float> >::value));
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test();
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,39 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2012 Joel de Guzman
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#define BOOST_FUSION_DONT_USE_PREPROCESSED_FILES // $$$ JDG temp $$$
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
#include <boost/fusion/container/map/map.hpp>
|
||||
|
||||
struct k1 {};
|
||||
struct k2 {};
|
||||
|
||||
#define FUSION_SEQUENCE boost::fusion::map<boost::fusion::pair<k1, std::vector<x>>>
|
||||
|
||||
#define FUSION_SEQUENCE2 boost::fusion::map< \
|
||||
boost::fusion::pair<k1, std::vector<x>>, \
|
||||
boost::fusion::pair<k2, x>>
|
||||
|
||||
#include "move.hpp"
|
||||
|
||||
#else
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#endif
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
test();
|
||||
#endif
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,69 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1999-2003 Jaakko Jarvi
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/fusion/container/map/map.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/at.hpp>
|
||||
|
||||
struct k1 {};
|
||||
struct k2 {};
|
||||
struct k3 {};
|
||||
struct k4 {};
|
||||
|
||||
namespace test_detail
|
||||
{
|
||||
// no public default constructor
|
||||
class foo
|
||||
{
|
||||
public:
|
||||
|
||||
explicit foo(int v) : val(v) {}
|
||||
|
||||
bool operator==(const foo& other) const
|
||||
{
|
||||
return val == other.val;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
foo() {}
|
||||
int val;
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
test()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
using namespace test_detail;
|
||||
|
||||
map<
|
||||
pair<k1, int>,
|
||||
pair<k1, float>,
|
||||
pair<k1, bool>,
|
||||
pair<k1, foo>
|
||||
> t1(5, 12.2f, true, foo(4));
|
||||
|
||||
at_c<0>(t1).second = 6;
|
||||
at_c<1>(t1).second = 2.2f;
|
||||
at_c<2>(t1).second = false;
|
||||
at_c<3>(t1).second = foo(5);
|
||||
|
||||
BOOST_TEST(at_c<0>(t1).second == 6);
|
||||
BOOST_TEST(at_c<1>(t1).second > 2.1f && at_c<1>(t1).second < 2.3f);
|
||||
BOOST_TEST(at_c<2>(t1).second == false);
|
||||
BOOST_TEST(at_c<3>(t1).second == foo(5));
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test();
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -95,7 +95,6 @@ struct test_intrinsics2
|
||||
{
|
||||
typedef boost::fusion::FUSION_SEQUENCE<> seq0;
|
||||
|
||||
#if !defined(BOOST_FUSION_SEQUENCE_CONVERSION_IS_NOT_SEQUENCE__TYPE_PRESERVING)
|
||||
#if !defined(FUSION_FORWARD_ONLY) // list has no back/prev
|
||||
|
||||
typedef boost::fusion::FUSION_SEQUENCE<int> target1;
|
||||
@ -115,8 +114,6 @@ struct test_intrinsics2
|
||||
typedef boost::fusion::FUSION_SEQUENCE<double, int> target4;
|
||||
typedef boost::mpl::push_front<seq3, double>::type seq4;
|
||||
BOOST_STATIC_ASSERT((boost::mpl::equal<seq4, target4>::value));
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -6,7 +6,7 @@
|
||||
==============================================================================*/
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#error "Valid only on compilers that support rvalues"
|
||||
#endif
|
||||
|
||||
@ -73,7 +73,7 @@ namespace test_detail
|
||||
return T();
|
||||
}
|
||||
|
||||
typedef FUSION_SEQUENCE return_type;
|
||||
typedef FUSION_SEQUENCE<std::vector<x>> return_type;
|
||||
|
||||
return_type
|
||||
generate()
|
||||
@ -84,7 +84,7 @@ namespace test_detail
|
||||
return return_type();
|
||||
}
|
||||
|
||||
typedef FUSION_SEQUENCE2 return_type2;
|
||||
typedef FUSION_SEQUENCE<std::vector<x>, x> return_type2;
|
||||
|
||||
return_type2
|
||||
generate2()
|
||||
|
@ -1,64 +0,0 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2012 Joel falcou
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <iostream>
|
||||
#include <boost/mpl/transform.hpp>
|
||||
#include <boost/fusion/include/mpl.hpp>
|
||||
#include <boost/fusion/adapted/mpl.hpp>
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
#include <boost/fusion/include/as_vector.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/fusion/include/adapt_struct.hpp>
|
||||
|
||||
struct foo
|
||||
{
|
||||
double d; float f; short c;
|
||||
};
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(foo,(double,d)(float,f)(short,c))
|
||||
|
||||
template<class T>
|
||||
class composite_reference
|
||||
: public boost::mpl::
|
||||
transform < typename boost::fusion::result_of::
|
||||
as_vector<T>::type
|
||||
, boost::add_reference<boost::mpl::_>
|
||||
>::type
|
||||
{
|
||||
public:
|
||||
typedef typename boost::mpl::
|
||||
transform < typename boost::fusion::result_of::
|
||||
as_vector<T>::type
|
||||
, boost::add_reference<boost::mpl::_>
|
||||
>::type parent;
|
||||
|
||||
composite_reference(T& src) : parent( src ) {}
|
||||
composite_reference(parent& src) : parent(src) {}
|
||||
|
||||
composite_reference& operator=(T& src)
|
||||
{
|
||||
static_cast<parent&>(*this) = static_cast<parent&>(src);
|
||||
return *this;
|
||||
}
|
||||
|
||||
composite_reference& operator=(parent const& src)
|
||||
{
|
||||
static_cast<parent&>(*this) = src;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
int main(int,char**)
|
||||
{
|
||||
foo f;
|
||||
composite_reference<foo> ref_f(f);
|
||||
|
||||
boost::fusion::at_c<0>(ref_f) = 1.2;
|
||||
boost::fusion::at_c<1>(ref_f) = 1.2f;
|
||||
boost::fusion::at_c<2>(ref_f) = 12;
|
||||
|
||||
std::cout << f.d << " " << f.f << " " << f.c << "\n";
|
||||
}
|
@ -6,7 +6,6 @@
|
||||
==============================================================================*/
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
#include <boost/fusion/container/map/map.hpp>
|
||||
#include <boost/fusion/adapted/mpl.hpp>
|
||||
#include <boost/fusion/sequence/io/out.hpp>
|
||||
#include <boost/fusion/container/generation/make_vector.hpp>
|
||||
@ -83,27 +82,6 @@ main()
|
||||
));
|
||||
}
|
||||
|
||||
//! Map
|
||||
{
|
||||
typedef pair<boost::mpl::int_<0>, std::string> pair0;
|
||||
typedef pair<boost::mpl::int_<1>, std::string> pair1;
|
||||
typedef pair<boost::mpl::int_<2>, std::string> pair2;
|
||||
typedef pair<boost::mpl::int_<3>, std::string> pair3;
|
||||
typedef pair<boost::mpl::int_<4>, std::string> pair4;
|
||||
|
||||
typedef map< pair0, pair1, pair2, pair3, pair4 > map_type;
|
||||
map_type m( pair0("zero"), pair1("one"), pair2("two"), pair3("three"), pair4("four") );
|
||||
typedef reverse_view<map_type> view_type;
|
||||
view_type rev(m);
|
||||
std::cout << rev << std::endl;
|
||||
BOOST_TEST((rev == make_vector( pair4("four"), pair3("three"), pair2("two"), pair1("one"), pair0("zero"))));
|
||||
BOOST_TEST((at_c<0>(rev) == pair4("four")));
|
||||
BOOST_TEST((at_c<1>(rev) == pair3("three")));
|
||||
BOOST_TEST((at_c<2>(rev) == pair2("two")));
|
||||
BOOST_TEST((at_c<3>(rev) == pair1("one")));
|
||||
BOOST_TEST((at_c<4>(rev) == pair0("zero")));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
// The std_tuple_iterator adaptor only supports implementations
|
||||
// using variadic templates
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
|
||||
#include <boost/fusion/adapted/std_tuple.hpp>
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
Copyright (c) 1999-2003 Jaakko Jarvi
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/fusion/tuple.hpp>
|
||||
|
@ -2,7 +2,7 @@
|
||||
Copyright (c) 1999-2003 Jaakko Jarvi
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
@ -11,10 +11,6 @@
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#include <functional>
|
||||
#endif
|
||||
|
||||
#if !defined(FUSION_AT)
|
||||
#define FUSION_AT at_c
|
||||
#endif
|
||||
@ -39,16 +35,7 @@ test()
|
||||
|
||||
double d = 2.7;
|
||||
A a;
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
// Note: C++11 will pickup the rvalue overload for the d argument
|
||||
// since we do not have all permutations (expensive!) for all const&
|
||||
// and && arguments. We either have all && or all const& arguments only.
|
||||
// For that matter, use std::ref to disambiguate the call.
|
||||
|
||||
FUSION_SEQUENCE<int, double&, const A&, int> t(1, std::ref(d), a, 2);
|
||||
#else
|
||||
FUSION_SEQUENCE<int, double&, const A&, int> t(1, d, a, 2);
|
||||
#endif
|
||||
const FUSION_SEQUENCE<int, double&, const A, int> ct(t);
|
||||
|
||||
int i = FUSION_AT<0>(t);
|
||||
@ -79,7 +66,7 @@ test()
|
||||
|
||||
++FUSION_AT<0>(t);
|
||||
BOOST_TEST(FUSION_AT<0>(t) == 6);
|
||||
|
||||
|
||||
typedef FUSION_SEQUENCE<int, float> seq_type;
|
||||
|
||||
BOOST_STATIC_ASSERT(!(
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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)
|
||||
==============================================================================*/
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
|
@ -8,13 +8,11 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
|
||||
#define FUSION_SEQUENCE boost::fusion::vector<std::vector<x>>
|
||||
#define FUSION_SEQUENCE2 boost::fusion::vector<std::vector<x>, x>
|
||||
|
||||
#define FUSION_SEQUENCE boost::fusion::vector
|
||||
#include "move.hpp"
|
||||
|
||||
#else
|
||||
@ -24,7 +22,7 @@
|
||||
int
|
||||
main()
|
||||
{
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
test();
|
||||
#endif
|
||||
|
||||
|
185
todo.txt
Normal file
@ -0,0 +1,185 @@
|
||||
===============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
|
||||
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)
|
||||
===============================================================================
|
||||
|
||||
* Document extension::struct_size, extension::struct_member and
|
||||
extension::struct_assoc_member in extension section.
|
||||
|
||||
* Document rationale behind at and value_at and how to choose which
|
||||
to use.
|
||||
|
||||
* Reinstate the function object algorithms
|
||||
|
||||
* Break all dependency cycles if there are some more
|
||||
|
||||
* Break the view<-->algorithm dependency cycle
|
||||
|
||||
* Improve extension docs
|
||||
|
||||
* Document sequence/convert
|
||||
|
||||
* Consider object equivalent of functions and algorithms (so you can do
|
||||
transform(iterators, deref()) with needing to put together a wrapper for deref).
|
||||
|
||||
* Make algorithms work with mutable data
|
||||
|
||||
* Consider segmented sequence / algorithm support
|
||||
|
||||
* Consider utility element_ref<Seq,Member>::type thats consts and refs as appropriate
|
||||
|
||||
* Improved motivation section
|
||||
|
||||
* Expand details of view concept
|
||||
|
||||
* Examples, examples, examples
|
||||
|
||||
* look at lambda stuff
|
||||
|
||||
* Complete the fusion/include/ directory containing a flat list of
|
||||
include files for all the modules and components.
|
||||
|
||||
* The error messages when e.g. the function is not set as const are difficult
|
||||
to decipher. e.g. transform(s, f) <<- where f has a non-const operator()
|
||||
|
||||
* mpl, fusion, container type preserving operations incompatible
|
||||
-- shall we consider container-type preserving variations of the
|
||||
functions/algorithms?
|
||||
|
||||
How about making joint_view Concept preserving? This way push/pop/front/back
|
||||
will return a view of the same Concept. - tosh
|
||||
|
||||
* map_tie is implemented. It seems not yet documented? - Dan: done now!
|
||||
|
||||
* multi_set, multi_map?
|
||||
|
||||
* why is insert_range not spelled insert_sequence ?
|
||||
|
||||
* Document the new fusion extension mechanisms
|
||||
->iterator_facade
|
||||
->sequence_facade
|
||||
|
||||
* David A:
|
||||
Wouldn't extension be a lot easier if iterator_base and sequence_base
|
||||
took (optional) 2nd arguments that specify the tag? Then you wouldn't
|
||||
need that whole dance that enables tag dispatching (right?)
|
||||
|
||||
* David A: is_iterator isn't documented?
|
||||
JDG: There is no is_iterator ;) There is is_fusion_iterator, but it should
|
||||
probably be placed in detail.
|
||||
|
||||
* for_each takes the function object by reference to const, so you have to
|
||||
const qualify operator() and make the data members mutable so you can change
|
||||
them anyway.
|
||||
Eric N: IMO, this is a bug in Fusion. There should be an overload of for_each
|
||||
that takes a function object by non-const reference. Stateful predicates should
|
||||
be supported, and Fusion should be explicit about where and when predicates
|
||||
are copied, so that the state doesn't get messed up.
|
||||
|
||||
* Make Boost.parameters library's ArgumentPacks a conforming fusion sequence
|
||||
|
||||
* Optimize container performance with typeof / compiler defect typeof. In particular
|
||||
improve the performance of the prototype deque implementation.
|
||||
|
||||
* Deque docs if we decide we like it
|
||||
|
||||
* Rewrite the whole extension docs section. More formal docs of extension point,
|
||||
example to use the various facade types, rather than hand coding everything.
|
||||
|
||||
* zip optimization - Zip is rather compiler heavy, try and reduce the likelihood
|
||||
of compilers like msvc7 hitting internal compiler limits
|
||||
|
||||
* Document the unused support added to zip for Hartmut.
|
||||
|
||||
* Rationalize support/unused.hpp and the ignore stuff needed for tie etc.
|
||||
|
||||
* Why do we need to set FUSION_MAX_VECTOR_SIZE when we set
|
||||
FUSION_MAX_MAP_SIZE? Setting FUSION_MAX_MAP_SIZE should be enough.
|
||||
|
||||
tosh:
|
||||
|
||||
* Document Incrementable / Single Pass Concepts
|
||||
* Provide infinity-aware default implementation for Incrementable Sequences
|
||||
|
||||
Thoughts: It would probably be cleaner to have infinity conceptually
|
||||
orthogonal so there can be infinite Bidi/RA/Assoc Sequences.
|
||||
OTOH it complicates things in way that might not be worth it...
|
||||
|
||||
* Implement always_view/always with repetitive_view<single_view<T> >
|
||||
semantics - using repetitive_view will for this purpose will be way
|
||||
too much overhead.
|
||||
|
||||
? Functional wrappers for intrinsics/algorithms.
|
||||
|
||||
* Rewrite functional benchmark
|
||||
|
||||
==========================================================
|
||||
|
||||
From the fusion review (please mark all done items):
|
||||
|
||||
The following comments refer to issues that the library authors should
|
||||
address prior to merging the library into CVS:
|
||||
|
||||
* Documentation: Many of the reviewers stated that they would like to
|
||||
see more tutorial documentation that demonstrates not only what the
|
||||
particular constructs in Fusion do, but also how they are expected
|
||||
to be used. A reasonably concise motivating example has been
|
||||
requested. It has already been pointed out that Fusion is used for
|
||||
some other boost libraries. A well-developed and self-contained
|
||||
case study of when and how to use Fusion would be greatly
|
||||
appreciated. The relationship between this library and the current
|
||||
Boost.Tuple library, as well as Boost.Mpl, should be discussed. The
|
||||
reference documentation is quite thorough and detailed comments
|
||||
regarding them have already been addressed by the authors. However
|
||||
the notion of "views" requires greater documentation. The
|
||||
examples in the algorithm sections currently do little more than
|
||||
demonstrate the syntax by which they can be called. Examples that
|
||||
more specifically express intent would be a notable
|
||||
improvement. (see for example Matt Austern's "Generic Programming
|
||||
and the STL"). In general the documentation would benefit from
|
||||
copy-editing.
|
||||
|
||||
* Several commented on the use of the name "pair" for the fusion type
|
||||
that has typedefs for two types but only contains the second type.
|
||||
Although the typedefs and member names are consistent with the
|
||||
std::pair object, the name "pair" is confusing. The
|
||||
compile-time/run-time hybrid nature of this library makes it
|
||||
difficult to find perfect metaphors for constructs in the library.
|
||||
In this case, it seems better to find a term for this template (and
|
||||
the concept that it models) that more directly states its purpose.
|
||||
The name "tag_of" would also benefit from renaming.
|
||||
|
||||
* The behavior of Fusion functions in the face of argument-dependent
|
||||
lookup (ADL) is not well specified. This should be made
|
||||
explicit in the reference documentation.
|
||||
|
||||
The following comments refer to issues that, while not mandatory,
|
||||
deserve consideration:
|
||||
|
||||
* The library name "Fusion", though not arbitrary, says little about
|
||||
the library's purpose. There is precedent for this within boost,
|
||||
however. A name change is not mandatory for the
|
||||
library's acceptance, but it would be worth while for the authors to
|
||||
consider a more telling name.
|
||||
|
||||
Dan - I like the name Fusion, and there is precendent for less direct
|
||||
library names like Spirit and Xpressive in Boost. (And Boost is not
|
||||
exactly an explicit name either).
|
||||
|
||||
* The mechanism for extending Fusion with new containers and iterators
|
||||
is complex and involves implementing a number of components,
|
||||
especially regarding iterators. An adaptation layer that is
|
||||
analogous to the Boost.Iterator library would be a fine addition to
|
||||
Fusion.
|
||||
|
||||
Dan - Joel added iterator and container adapters, still to be documented
|
||||
as part of the improved extension docs to be done by me.
|
||||
|
||||
* It would be beneficial to supply Boost.Serialization support for the
|
||||
Fusion container types. I am sure, as mentioned, that the authors
|
||||
of this library would accept a volunteer to implement this
|
||||
functionality.
|
||||
|