mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-29 20:17:32 +02:00
Quickbook: Copy trunk libs into quickbook-dev branch.
[SVN r75213]
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
#==============================================================================
|
||||
# Copyright (c) 2003-2007 Joel de Guzman
|
||||
# Copyright (c) 2003-2011 Joel de Guzman
|
||||
#
|
||||
# Use, modification and distribution is subject to the Boost Software
|
||||
# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
123
doc/adapted.qbk
123
doc/adapted.qbk
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
Copyright (C) 2010 Christopher Schmidt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
@ -243,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
|
||||
@ -286,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]
|
||||
@ -311,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
|
||||
@ -426,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
|
||||
@ -462,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.
|
||||
@ -477,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.
|
||||
|
||||
@ -538,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(
|
||||
@ -566,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
|
||||
@ -599,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
|
||||
{
|
||||
@ -608,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__
|
||||
@ -669,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)...`
|
||||
@ -707,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),
|
||||
@ -752,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__
|
||||
@ -777,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
|
||||
@ -799,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.
|
||||
|
||||
@ -810,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
|
||||
{
|
||||
@ -819,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__
|
||||
@ -886,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)...`
|
||||
@ -913,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.
|
||||
|
||||
@ -924,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
|
||||
{
|
||||
@ -934,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__
|
||||
@ -1027,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
|
||||
@ -1096,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
|
||||
@ -1161,14 +1162,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
|
||||
@ -1176,7 +1177,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,
|
||||
@ -1237,14 +1238,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
|
||||
@ -1252,7 +1253,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,
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
Copyright (C) 2010 Christopher Schmidt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
@ -10,18 +11,20 @@
|
||||
|
||||
[heading Lazy Evaluation]
|
||||
|
||||
Unlike __mpl__, Fusion algorithms are lazy and non sequence-type
|
||||
preserving. What does that mean? It means that when you operate on a
|
||||
sequence through a Fusion algorithm that returns a sequence, the sequence
|
||||
returned may not be of the same class as the original. This is by design.
|
||||
Runtime efficiency is given a high priority. Like __mpl__, and unlike
|
||||
__stl__, fusion algorithms are functional in nature such that algorithms
|
||||
Unlike __mpl__, Fusion algorithms are lazy[footnote Except for some
|
||||
special cases such as __for_each__ and __copy__ which are inherently
|
||||
imperative algorithms.] and non sequence-type preserving [footnote What
|
||||
does that mean? It means that when you operate on a sequence through a
|
||||
Fusion algorithm that returns a sequence, the sequence returned may not
|
||||
be of the same class as the original]. This is by design. Runtime
|
||||
efficiency is given a high priority. Like __mpl__, and unlike __stl__,
|
||||
fusion algorithms are mostly functional in nature such that algorithms
|
||||
are non mutating (no side effects). However, due to the high cost of
|
||||
returning full sequences such as vectors and lists, /Views/ are returned
|
||||
from Fusion algorithms instead. For example, the __transform__ algorithm
|
||||
does not actually return a transformed version of the original sequence.
|
||||
__transform__ returns a __transform_view__. This view holds a reference to
|
||||
the original sequence plus the transform function. Iteration over the
|
||||
__transform__ returns a __transform_view__. This view holds a reference
|
||||
to the original sequence plus the transform function. Iteration over the
|
||||
__transform_view__ will apply the transform function over the sequence
|
||||
elements on demand. This /lazy/ evaluation scheme allows us to chain as
|
||||
many algorithms as we want without incurring a high runtime penalty.
|
||||
@ -37,6 +40,7 @@ the original sequence `s` and the value `x`. Functions that were once
|
||||
sequence specific and need to be implemented N times over N different
|
||||
sequences are now implemented only once. That is to say that Fusion
|
||||
sequences are cheaply extensible.
|
||||
|
||||
To regain the original sequence, __conversion__ functions are provided. You
|
||||
may use one of the __conversion__ functions to convert back to the original
|
||||
sequence type.
|
||||
@ -46,6 +50,61 @@ sequence type.
|
||||
#include <boost/fusion/algorithm.hpp>
|
||||
#include <boost/fusion/include/algorithm.hpp>
|
||||
|
||||
[section Auxiliary]
|
||||
|
||||
The auxiliary algorithms provide the utility algorithms for sequences.
|
||||
|
||||
[heading Header]
|
||||
|
||||
#include <boost/fusion/algorithm/auxiliary.hpp>
|
||||
#include <boost/fusion/include/auxiliary.hpp>
|
||||
|
||||
[section Functions]
|
||||
|
||||
[section copy]
|
||||
|
||||
[heading Description]
|
||||
Copy a sequence `src` to a sequence `dest`.
|
||||
It is also used to convert sequence into other.
|
||||
|
||||
[heading Synopsis]
|
||||
template <typename Seq1, typename Seq2>
|
||||
void copy(Seq1 const& src, Seq2& dest);
|
||||
|
||||
[table Parameters
|
||||
[[Parameter][Requirement][Description]]
|
||||
[[`src`][A model of __forward_sequence__, all elements contained in the `src` sequence should be convertible into the element contained in the `dest` sequence.][Operation's argument]]
|
||||
[[`dest`][A model of __forward_sequence__, `e2 = e1` is valid expression for each pair of elements `e1` of `src` and `e2` of `dest`.][Operation's argument]]
|
||||
]
|
||||
|
||||
[heading Expression Semantics]
|
||||
__copy__(src, dest);
|
||||
|
||||
[*Return type]: `void`
|
||||
|
||||
[*Semantics]: `e2 = e1` for each element `e1` in `src` and `e2` in `dest`.
|
||||
|
||||
[heading Complexity]
|
||||
Linear, exactly `__result_of_size__<Sequence>::value`.
|
||||
|
||||
[heading Header]
|
||||
|
||||
#include <boost/fusion/algorithm/auxiliary/copy.hpp>
|
||||
#include <boost/fusion/include/copy.hpp>
|
||||
|
||||
[heading Example]
|
||||
__vector__<int,int> vec(1,2);
|
||||
__list__<int,int> ls;
|
||||
__copy__(vec, ls);
|
||||
assert(ls == __make_list__(1,2));
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
[section Iteration]
|
||||
|
||||
The iteration algorithms provide the fundamental algorithms for traversing
|
||||
@ -75,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,
|
||||
|
@ -1,5 +1,7 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
Copyright (C) 2006 Tobias Schwinger
|
||||
Copyright (C) 2010 Christopher Schmidt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
@ -37,6 +39,11 @@ This section summarizes significant changes to the Fusion library.
|
||||
(Christopher Schmidt)
|
||||
* October 7, 2010: Added __adapt_adt__, __adapt_tpl_adt__,
|
||||
__adapt_assoc_adt__ and __adapt_assoc_tpl_adt__ (Joel de Guzman,
|
||||
Hartmut Kaiser and Christopher Schmidt)
|
||||
Hartmut Kaiser and Christopher Schmidt)
|
||||
* August 29, 2011: Added support for segmented sequences and iterators (Eric Niebler)
|
||||
* 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)
|
||||
|
||||
[endsect]
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -419,7 +420,7 @@ including any Fusion header to change the default. Example:
|
||||
[heading Model of]
|
||||
|
||||
* __associative_sequence__
|
||||
* __forward_sequence__
|
||||
* __random_access_sequence__
|
||||
|
||||
[variablelist Notation
|
||||
[[`M`] [A `map` type]]
|
||||
@ -431,7 +432,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 __random_access_sequence__ and __associative_sequence__.
|
||||
defined in __forward_sequence__ and __associative_sequence__.
|
||||
|
||||
[table
|
||||
[[Expression] [Semantics]]
|
||||
@ -681,7 +682,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
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -390,7 +391,7 @@ for a variety of types.
|
||||
|
||||
[heading Description]
|
||||
The __sequence_facade__ template provides an intrusive mechanism for
|
||||
producing a conforming Fusion iterator.
|
||||
producing a conforming Fusion sequence.
|
||||
|
||||
[heading Synopsis]
|
||||
template<typename Derived, typename TravesalTag, typename IsView = mpl::false_>
|
||||
@ -415,6 +416,8 @@ The user must the implement the key expressions required by their sequence type.
|
||||
[[`sequence::template end<Seq>::call(seq)`][An iterator to the end of sequence `seq`]]
|
||||
[[`sequence::template size<Seq>::type`][The size of a sequence of type `Seq` as an __mpl_integral_constant__]]
|
||||
[[`sequence::template size<Seq>::call(seq)`][The size of sequence `seq`]]
|
||||
[[`sequence::template empty<Seq>::type`][Returns `mpl::true_` if `Seq` has zero elements, `mpl::false_` otherwise.]]
|
||||
[[`sequence::template empty<Seq>::call`][Returns a type convertible to `bool` that evaluates to true if the sequence is empty, else, evaluates to false. ]]
|
||||
[[`sequence::template at<Seq, N>::type`][The type of element `N` in a sequence of type `Seq`]]
|
||||
[[`sequence::template at<Seq, N>::call(seq)`][Element `N` in sequence `seq`]]
|
||||
[[`sequence::template value_at<Sequence, N>::type`][The type of the `N`th element in a sequence of type `Seq`]]
|
||||
@ -465,8 +468,8 @@ The user must the implement the key expressions required by their iterator type.
|
||||
[[`iterator::template advance<It, N>::call(it)`][An iterator advanced `N` elements from `it`][Implemented in terms of `next` and `prior`]]
|
||||
[[`iterator::template distance<It1, It2>::type`][The distance between iterators of type `It1` and `It2` as an __mpl_integral_constant__][None]]
|
||||
[[`iterator::template distance<It1, It2>::call(it1, it2)`][The distance between iterator `it1` and `it2`][None]]
|
||||
[[`iterator::template equal_to<It1, It2>::type`][The distance between iterators of type `It1` and `It2`][`boost::same_type<It1, It2>::type`]]
|
||||
[[`iterator::template equal_to<It1, It2>::call(it1, it2)`][The distance between iterators `it1` and `it2`][`boost::same_type<It1, It2>::type()`]]
|
||||
[[`iterator::template equal_to<It1, It2>::type`][Returns `mpl::true_` if `It1` is equal to `It2`, `mpl::false_` otherwise.][`boost::same_type<It1, It2>::type`]]
|
||||
[[`iterator::template equal_to<It1, It2>::call(it1, it2)`][Returns a type convertible to `bool` that evaluates to `true` if `It1` is equal to `It2`, `false` otherwise.][`boost::same_type<It1, It2>::type()`]]
|
||||
[[`iterator::template key_of<It>::type`][The key type associated with the element from `It`][None]]
|
||||
[[`iterator::template value_of_data<It>::type`][The type of the data property associated with the element from `It`][None]]
|
||||
[[`iterator::template deref_data<It>::type`][The type that will be returned by dereferencing the data property of the element from `It`][None]]
|
||||
|
@ -1,5 +1,5 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2006 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
|
||||
@ -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.
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
Copyright (C) 2010 Christopher Schmidt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
@ -8,9 +9,9 @@
|
||||
===============================================================================/]
|
||||
[library Fusion
|
||||
[quickbook 1.3]
|
||||
[version 2.0]
|
||||
[version 2.2]
|
||||
[authors [de Guzman, Joel], [Marsden, Dan], [Schwinger, Tobias]]
|
||||
[copyright 2001 2002 2003 2004 2005 2006 2007 Joel de Guzman, Dan Marsden, Tobias Schwinger]
|
||||
[copyright 2001 2002 2003 2004 2005 2006 2011 Joel de Guzman, Dan Marsden, Tobias Schwinger]
|
||||
[purpose Statically Typed Heterogeneous Data Structures and Algorithms]
|
||||
[license
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
@ -215,6 +216,7 @@
|
||||
|
||||
[def __algorithm__ [link fusion.algorithm Algorithm]]
|
||||
[def __algorithms__ [link fusion.algorithm Algorithms]]
|
||||
[def __copy__ [link fusion.algorithm.auxiliary.functions.copy `copy`]]
|
||||
[def __fold__ [link fusion.algorithm.iteration.functions.fold `fold`]]
|
||||
[def __result_of_fold__ [link fusion.algorithm.iteration.metafunctions.fold `result_of::fold`]]
|
||||
[def __reverse_fold__ [link fusion.algorithm.iteration.functions.reverse_fold `reverse_fold`]]
|
||||
|
@ -1,270 +1,16 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Chapter 1. Fusion 2.0</title>
|
||||
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="index.html" title="Chapter 1. Fusion 2.0">
|
||||
<link rel="next" href="fusion/preface.html" title="Preface">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav"><a accesskey="n" href="fusion/preface.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
|
||||
<div class="chapter">
|
||||
<div class="titlepage"><div>
|
||||
<div><h2 class="title">
|
||||
<a name="fusion"></a>Chapter 1. Fusion 2.0</h2></div>
|
||||
<div><div class="author"><h3 class="author">
|
||||
<span class="firstname">Joel</span> <span class="surname">de Guzman</span>
|
||||
</h3></div></div>
|
||||
<div><div class="author"><h3 class="author">
|
||||
<span class="firstname">Dan</span> <span class="surname">Marsden</span>
|
||||
</h3></div></div>
|
||||
<div><div class="author"><h3 class="author">
|
||||
<span class="firstname">Tobias</span> <span class="surname">Schwinger</span>
|
||||
</h3></div></div>
|
||||
<div><p class="copyright">Copyright © 2001-2007 Joel de Guzman, Dan Marsden, Tobias
|
||||
Schwinger</p></div>
|
||||
<div><div class="legalnotice">
|
||||
<a name="id823866"></a><p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></div>
|
||||
</div></div>
|
||||
<div class="toc">
|
||||
<p><b>Table of Contents</b></p>
|
||||
<dl>
|
||||
<dt><span class="section"><a href="fusion/preface.html">Preface</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/introduction.html">Introduction</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/quick_start.html">Quick Start</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/organization.html">Organization</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/support.html">Support</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/support/is_sequence.html">is_sequence</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/support/is_view.html">is_view</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/support/tag_of.html">tag_of</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/support/category_of.html">category_of</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/support/deduce.html">deduce</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/support/deduce_sequence.html">deduce_sequence</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/support/pair.html">pair</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/iterator.html">Iterator</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/iterator/concepts.html">Concepts</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/iterator/concepts/forward_iterator.html">Forward
|
||||
Iterator</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/concepts/bidirectional_iterator.html">Bidirectional
|
||||
Iterator</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/concepts/random_access_iterator.html">Random
|
||||
Access Iterator</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/concepts/associative_iterator.html">Associative
|
||||
Iterator</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/iterator/functions.html">Functions</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/iterator/functions/deref.html">deref</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/functions/next.html">next</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/functions/prior.html">prior</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/functions/distance.html">distance</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/functions/advance.html">advance</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/functions/advance_c.html">advance_c</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/functions/deref_data.html">deref_data</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/iterator/operator.html">Operator</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/iterator/operator/operator_unary_star.html"> Operator
|
||||
*</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/operator/operator_equality.html"> Operator
|
||||
==</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/operator/operator_inequality.html"> Operator
|
||||
!=</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/iterator/metafunctions.html">Metafunctions</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/iterator/metafunctions/value_of.html">value_of</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/metafunctions/deref.html">deref</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/metafunctions/next.html">next</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/metafunctions/prior.html">prior</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/metafunctions/equal_to.html">equal_to</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/metafunctions/distance.html">distance</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/metafunctions/advance.html">advance</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/metafunctions/advance_c.html">advance_c</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/metafunctions/key_of.html">key_of</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/metafunctions/value_of_data.html">value_of_data</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/iterator/metafunctions/deref_data.html">deref_data</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/sequence.html">Sequence</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/sequence/concepts.html">Concepts</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/sequence/concepts/forward_sequence.html">Forward
|
||||
Sequence</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/sequence/concepts/bidirectional_sequence.html">Bidirectional
|
||||
Sequence</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/sequence/concepts/random_access_sequence.html">Random
|
||||
Access Sequence</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/sequence/concepts/associative_sequence.html">Associative
|
||||
Sequence</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/sequence/intrinsic.html">Intrinsic</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/sequence/intrinsic/functions.html">Functions</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/sequence/intrinsic/metafunctions.html">Metafunctions</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/sequence/operator.html">Operator</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/sequence/operator/i_o.html">I/O</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/sequence/operator/comparison.html">Comparison</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/container.html">Container</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/container/vector.html">vector</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/container/cons.html">cons</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/container/list.html">list</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/container/set.html">set</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/container/map.html">map</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/container/generation.html">Generation</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/container/generation/functions.html">Functions</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/container/generation/metafunctions.html">MetaFunctions</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/container/conversion.html">Conversion</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/container/conversion/functions.html">Functions</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/container/conversion/metafunctions.html">Metafunctions</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/view.html">View</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/view/single_view.html">single_view</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/view/filter_view.html">filter_view</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/view/iterator_range.html">iterator_range</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/view/joint_view.html">joint_view</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/view/zip_view.html">zip_view</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/view/transform_view.html">transform_view</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/view/reverse_view.html">reverse_view</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/view/nview.html">nview</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/view/repetitive_view.html">repetitive_view</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/adapted.html">Adapted</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/adapted/array.html"> Array</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/std__pair.html">std::pair</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/mpl_sequence.html">mpl sequence</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/boost__array.html">boost::array</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/boost__tuple.html">boost::tuple</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/adapt_struct.html"> BOOST_FUSION_ADAPT_STRUCT</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/adapt_tpl_struct.html"> BOOST_FUSION_ADAPT_TPL_STRUCT</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/adapt_struct_named.html"> BOOST_FUSION_ADAPT_STRUCT_NAMED</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/adapt_assoc.html"> BOOST_FUSION_ADAPT_ASSOC_STRUCT</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/adapt_assoc_tpl_struct.html"> BOOST_FUSION_ADAPT_ASSOC_TPL_STRUCT</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/adapt_assoc_struct_named.html"> BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/adapt_adt.html"> BOOST_FUSION_ADAPT_ADT</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/adapt_tpl_adt.html"> BOOST_FUSION_ADAPT_TPL_ADT</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/adapt_assoc_adt.html"> BOOST_FUSION_ADAPT_ASSOC_ADT</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/adapt_assoc_tpl_adt.html"> BOOST_FUSION_ADAPT_ASSOC_TPL_ADT</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/define_struct.html"> BOOST_FUSION_DEFINE_STRUCT</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/define_tpl_struct.html"> BOOST_FUSION_DEFINE_TPL_STRUCT</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/define_assoc_struct.html"> BOOST_FUSION_DEFINE_ASSOC_STRUCT</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/adapted/define_assoc_tpl_struct.html"> BOOST_FUSION_DEFINE_ASSOC_TPL_STRUCT</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/algorithm.html">Algorithm</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/algorithm/iteration.html">Iteration</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/algorithm/iteration/functions.html">Functions</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/algorithm/iteration/metafunctions.html">Metafunctions</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/algorithm/query.html">Query</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/algorithm/query/functions.html">Functions</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/algorithm/query/metafunctions.html">Metafunctions</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/algorithm/transformation.html">Transformation</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/algorithm/transformation/functions.html">Functions</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/algorithm/transformation/metafunctions.html">Metafunctions</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/tuple.html">Tuple</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/tuple/class_template_tuple.html">Class template tuple</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/tuple/class_template_tuple/construction.html">Construction</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/tuple/class_template_tuple/tuple_creation_functions.html">Tuple
|
||||
creation functions</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/tuple/class_template_tuple/tuple_helper_classes.html">Tuple
|
||||
helper classes</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/tuple/class_template_tuple/element_access.html">Element
|
||||
access</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/tuple/class_template_tuple/relational_operators.html">Relational
|
||||
operators</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/tuple/pairs.html">Pairs</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/extension.html">Extension</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/extension/ext_full.html"> The Full Extension Mechanism</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/extension/sequence_facade.html">Sequence Facade</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/extension/iterator_facade.html">Iterator Facade</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/functional.html">Functional</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/functional/concepts.html">Concepts</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/functional/concepts/callable.html"> Callable Object</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/functional/concepts/reg_callable.html"> Regular Callable
|
||||
Object</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/functional/concepts/def_callable.html"> Deferred
|
||||
Callable Object</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/functional/concepts/poly.html"> Polymorphic Function
|
||||
Object</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/functional/invocation.html">Invocation</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/functional/invocation/functions.html">Functions</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/functional/invocation/metafunctions.html">Metafunctions</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/functional/invocation/limits.html">Limits</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/functional/adapters.html"> Adapters</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/functional/adapters/fused.html">fused</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/functional/adapters/fused_procedure.html">fused_procedure</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/functional/adapters/fused_function_object.html">fused_function_object</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/functional/adapters/unfused.html">unfused</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/functional/adapters/unfused_typed.html">unfused_typed</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/functional/adapters/limits.html">Limits</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/functional/generation.html">Generation</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="fusion/functional/generation/functions.html">Functions</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/functional/generation/metafunctions.html">Metafunctions</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="fusion/notes.html">Notes</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/change_log.html">Change log</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/acknowledgements.html">Acknowledgements</a></span></dt>
|
||||
<dt><span class="section"><a href="fusion/references.html">References</a></span></dt>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: March 21, 2011 at 04:01:58 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav"><a accesskey="n" href="fusion/preface.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a></div>
|
||||
</body>
|
||||
<head>
|
||||
<!-- Copyright (C) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
|
||||
|
||||
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) -->
|
||||
<title>Redirect to generated documentation</title>
|
||||
<meta http-equiv="refresh" content="0; URL=http://boost-sandbox.sourceforge.net/libs/fusion/doc/html/">
|
||||
</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>
|
||||
</html>
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -160,6 +161,8 @@ 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__)
|
||||
* __reverse_view__
|
||||
@ -204,8 +207,10 @@ the following expressions must be valid:
|
||||
|
||||
[heading Models]
|
||||
* __vector__ iterator
|
||||
* __map__ iterator
|
||||
* __std_pair__ iterator
|
||||
* __boost_array__ iterator
|
||||
* __single_view__ iterator
|
||||
* __iterator_range__ iterator (where adapted sequence is a __random_access_sequence__)
|
||||
* __transform_view__ iterator (where adapted sequence is a __random_access_sequence__)
|
||||
* __reverse_view__ iterator (where adapted sequence is a __random_access_sequence__)
|
||||
@ -990,9 +995,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]
|
||||
@ -1029,9 +1034,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]
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
Copyright (C) 2010 Christopher Schmidt
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
@ -167,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
|
||||
@ -175,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`]
|
||||
@ -204,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`]]
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -188,7 +189,9 @@ 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)
|
||||
* __transform_view__ (where adapted sequence is a Bidirectional Sequence)
|
||||
* __zip_view__ (where adapted sequences are models of Bidirectional Sequence)
|
||||
@ -263,7 +266,9 @@ 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)
|
||||
* __transform_view__ (where adapted sequence is a Random Access Sequence)
|
||||
* __zip_view__ (where adapted sequences are models of Random Access Sequence)
|
||||
@ -1423,12 +1428,19 @@ operators for free.
|
||||
|
||||
[section I/O]
|
||||
|
||||
The I/O operators: `<<` and `>>` work generically on all Fusion sequences.
|
||||
The global `operator<<` has been overloaded for generic output streams such
|
||||
that __sequence__(s) are output by recursively calling `operator<<` for each
|
||||
element. Analogously, the global `operator>>` has been overloaded to
|
||||
extract __sequence__(s) from generic input streams by recursively calling
|
||||
`operator>>` for each element.
|
||||
The I/O operators: `<<` and `>>` work generically on all Fusion
|
||||
sequences. The I/O operators are overloaded in namespace `boost::fusion`
|
||||
[footnote __sequences__ and __views__ residing in different namespaces
|
||||
will have to either provide their own I/O operators (possibly forwarding
|
||||
to fusion's I/O operators) or hoist fusion's I/O operators (using
|
||||
declaration), in their own namespaces for proper argument dependent
|
||||
lookup.]
|
||||
|
||||
The `operator<<` has been overloaded for generic output streams such
|
||||
that __sequence__(s) are output by recursively calling `operator<<` for
|
||||
each element. Analogously, the global `operator>>` has been overloaded
|
||||
to extract __sequence__(s) from generic input streams by recursively
|
||||
calling `operator>>` for each element.
|
||||
|
||||
The default delimiter between the elements is space, and the __sequence__
|
||||
is enclosed in parenthesis. For Example:
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
|
15
doc/view.qbk
15
doc/view.qbk
@ -1,5 +1,6 @@
|
||||
[/==============================================================================
|
||||
Copyright (C) 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger
|
||||
Copyright (C) 2001-2011 Joel de Guzman
|
||||
Copyright (C) 2006 Dan Marsden
|
||||
|
||||
Use, modification and distribution is subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -43,7 +44,7 @@ lazy nature make them very cheap to copy and be passed around by value.
|
||||
|
||||
[heading Model of]
|
||||
|
||||
* __forward_sequence__
|
||||
* __random_access_sequence__
|
||||
|
||||
[variablelist Notation
|
||||
[[`S`] [A `single_view` type]]
|
||||
@ -54,7 +55,7 @@ lazy nature make them very cheap to copy and be passed around by value.
|
||||
[heading Expression Semantics]
|
||||
|
||||
Semantics of an expression is defined only where it differs from, or is not
|
||||
defined in __forward_sequence__.
|
||||
defined in __random_access_sequence__.
|
||||
|
||||
[table
|
||||
[[Expression] [Semantics]]
|
||||
@ -482,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.
|
||||
|
||||
@ -506,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]]
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006 Joel de Guzman
|
||||
Copyright (c) 2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,8 +1,9 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
@ -17,11 +18,10 @@
|
||||
|
||||
#include <boost/fusion/sequence/sequence_facade.hpp>
|
||||
#include <boost/fusion/iterator/iterator_facade.hpp>
|
||||
|
||||
#include <boost/fusion/sequence/intrinsic.hpp>
|
||||
#include <boost/fusion/iterator.hpp>
|
||||
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
@ -40,7 +40,8 @@ namespace demo
|
||||
{
|
||||
template<typename Seq, int N>
|
||||
struct triple_iterator
|
||||
: fusion::iterator_facade<triple_iterator<Seq, N>, fusion::random_access_traversal_tag>
|
||||
: fusion::iterator_facade<triple_iterator<Seq, N>,
|
||||
fusion::random_access_traversal_tag>
|
||||
{
|
||||
typedef mpl::int_<N> index;
|
||||
typedef Seq sequence_type;
|
||||
@ -74,13 +75,19 @@ namespace demo
|
||||
template <typename Sq>
|
||||
struct deref<triple_iterator<Sq, 0> >
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
boost::is_const<Sq>
|
||||
, typename Sq::t0_type const&
|
||||
, typename Sq::t0_type&
|
||||
>::type
|
||||
type;
|
||||
typedef typename Sq::t0_type& type;
|
||||
|
||||
static type
|
||||
call(triple_iterator<Sq, 0> const& iter)
|
||||
{
|
||||
return iter.seq_.t0;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Sq>
|
||||
struct deref<triple_iterator<Sq, 0> const>
|
||||
{
|
||||
typedef typename Sq::t0_type const& type;
|
||||
|
||||
static type
|
||||
call(triple_iterator<Sq, 0> const& iter)
|
||||
@ -92,13 +99,19 @@ namespace demo
|
||||
template <typename Sq>
|
||||
struct deref<triple_iterator<Sq, 1> >
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
boost::is_const<Sq>
|
||||
, typename Sq::t1_type const&
|
||||
, typename Sq::t1_type&
|
||||
>::type
|
||||
type;
|
||||
typedef typename Sq::t1_type& type;
|
||||
|
||||
static type
|
||||
call(triple_iterator<Sq, 1> const& iter)
|
||||
{
|
||||
return iter.seq_.t1;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Sq>
|
||||
struct deref<triple_iterator<Sq, 1> const>
|
||||
{
|
||||
typedef typename Sq::t1_type const& type;
|
||||
|
||||
static type
|
||||
call(triple_iterator<Sq, 1> const& iter)
|
||||
@ -110,13 +123,19 @@ namespace demo
|
||||
template <typename Sq>
|
||||
struct deref<triple_iterator<Sq, 2> >
|
||||
{
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
boost::is_const<Sq>
|
||||
, typename Sq::t2_type const&
|
||||
, typename Sq::t2_type&
|
||||
>::type
|
||||
type;
|
||||
typedef typename Sq::t2_type& type;
|
||||
|
||||
static type
|
||||
call(triple_iterator<Sq, 2> const& iter)
|
||||
{
|
||||
return iter.seq_.t2;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Sq>
|
||||
struct deref<triple_iterator<Sq, 2> const>
|
||||
{
|
||||
typedef typename Sq::t2_type const& type;
|
||||
|
||||
static type
|
||||
call(triple_iterator<Sq, 2> const& iter)
|
||||
@ -129,7 +148,8 @@ namespace demo
|
||||
struct next
|
||||
{
|
||||
typedef triple_iterator<
|
||||
typename It::sequence_type, It::index::value + 1> type;
|
||||
typename It::sequence_type, It::index::value + 1>
|
||||
type;
|
||||
|
||||
static type call(It const& it)
|
||||
{
|
||||
@ -141,7 +161,8 @@ namespace demo
|
||||
struct prior
|
||||
{
|
||||
typedef triple_iterator<
|
||||
typename It::sequence_type, It::index::value - 1> type;
|
||||
typename It::sequence_type, It::index::value - 1>
|
||||
type;
|
||||
|
||||
static type call(It const& it)
|
||||
{
|
||||
@ -152,7 +173,9 @@ namespace demo
|
||||
template<typename It1, typename It2>
|
||||
struct distance
|
||||
{
|
||||
typedef typename mpl::minus<typename It2::index, typename It1::index>::type type;
|
||||
typedef typename mpl::minus<
|
||||
typename It2::index, typename It1::index>::type
|
||||
type;
|
||||
|
||||
static type call(It1 const& it1, It2 const& it2)
|
||||
{
|
||||
@ -165,7 +188,8 @@ namespace demo
|
||||
{
|
||||
typedef triple_iterator<
|
||||
typename It::sequence_type,
|
||||
It::index::value + M::value> type;
|
||||
It::index::value + M::value>
|
||||
type;
|
||||
|
||||
static type call(It const& it)
|
||||
{
|
||||
@ -176,7 +200,8 @@ namespace demo
|
||||
|
||||
template<typename T0, typename T1, typename T2>
|
||||
struct triple
|
||||
: fusion::sequence_facade<triple<T0, T1, T2>, fusion::random_access_traversal_tag>
|
||||
: fusion::sequence_facade<triple<T0, T1, T2>,
|
||||
fusion::random_access_traversal_tag>
|
||||
{
|
||||
triple(T0 const& t0, T1 const& t1, T2 const& t2)
|
||||
: t0(t0), t1(t1), t2(t2)
|
||||
@ -185,8 +210,7 @@ namespace demo
|
||||
template<typename Sq>
|
||||
struct begin
|
||||
{
|
||||
typedef demo::triple_iterator<
|
||||
Sq, 0> type;
|
||||
typedef demo::triple_iterator<Sq, 0> type;
|
||||
|
||||
static type call(Sq& sq)
|
||||
{
|
||||
@ -197,8 +221,7 @@ namespace demo
|
||||
template<typename Sq>
|
||||
struct end
|
||||
{
|
||||
typedef demo::triple_iterator<
|
||||
Sq, 3> type;
|
||||
typedef demo::triple_iterator<Sq, 3> type;
|
||||
|
||||
static type call(Sq& sq)
|
||||
{
|
||||
@ -300,6 +323,36 @@ namespace demo
|
||||
};
|
||||
}
|
||||
|
||||
struct modifying_fold_functor
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef bool type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
bool operator()(bool b, T&)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
};
|
||||
|
||||
struct nonmodifying_fold_functor
|
||||
{
|
||||
template <typename T>
|
||||
struct result
|
||||
{
|
||||
typedef bool type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
bool operator()(bool b, const T&)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef demo::triple<int, char, std::string> my_triple;
|
||||
@ -309,11 +362,16 @@ int main()
|
||||
BOOST_TEST(*fusion::prior(fusion::end(t)) == "hello");
|
||||
BOOST_TEST(fusion::distance(fusion::begin(t), fusion::end(t)) == 3);
|
||||
BOOST_TEST(fusion::size(t) == 3);
|
||||
BOOST_MPL_ASSERT((boost::is_same<int, fusion::result_of::value_at_c<my_triple, 0>::type>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<char, fusion::result_of::value_at_c<my_triple, 1>::type>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<std::string, fusion::result_of::value_at_c<my_triple, 2>::type>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<
|
||||
int, fusion::result_of::value_at_c<my_triple, 0>::type>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<
|
||||
char, fusion::result_of::value_at_c<my_triple, 1>::type>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<
|
||||
std::string, fusion::result_of::value_at_c<my_triple, 2>::type>));
|
||||
BOOST_TEST(fusion::at_c<0>(t) == 101);
|
||||
BOOST_TEST(fusion::at_c<1>(t) == 'a');
|
||||
BOOST_TEST(fusion::at_c<2>(t) == "hello");
|
||||
BOOST_TEST(fusion::fold(t, true, modifying_fold_functor()) == true);
|
||||
BOOST_TEST(fusion::fold(t, true, nonmodifying_fold_functor()) == true);
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006-2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to the Boost Software
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
7
preprocess/preprocess.bat
Normal file
7
preprocess/preprocess.bat
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
wave @wave.cfg -DFUSION_MAX_VECTOR_SIZE=10 -DFUSION_MAX_LIST_SIZE=10 -DFUSION_MAX_ZIP_SEQUENCES=10 preprocess.cpp
|
||||
wave @wave.cfg -DFUSION_MAX_VECTOR_SIZE=20 -DFUSION_MAX_LIST_SIZE=20 -DFUSION_MAX_ZIP_SEQUENCES=20 preprocess.cpp
|
||||
wave @wave.cfg -DFUSION_MAX_VECTOR_SIZE=30 -DFUSION_MAX_LIST_SIZE=30 -DFUSION_MAX_ZIP_SEQUENCES=30 preprocess.cpp
|
||||
wave @wave.cfg -DFUSION_MAX_VECTOR_SIZE=40 -DFUSION_MAX_LIST_SIZE=40 -DFUSION_MAX_ZIP_SEQUENCES=40 preprocess.cpp
|
||||
wave @wave.cfg -DFUSION_MAX_VECTOR_SIZE=50 -DFUSION_MAX_LIST_SIZE=50 -DFUSION_MAX_ZIP_SEQUENCES=50 preprocess.cpp
|
10
preprocess/preprocess.cpp
Normal file
10
preprocess/preprocess.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2011 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)
|
||||
==============================================================================*/
|
||||
#include <boost/fusion/container.hpp>
|
||||
#include <boost/fusion/algorithm.hpp>
|
||||
#include <boost/fusion/tuple.hpp>
|
||||
|
14
preprocess/wave.cfg
Normal file
14
preprocess/wave.cfg
Normal file
@ -0,0 +1,14 @@
|
||||
-DBOOST_FUSION_DONT_USE_PREPROCESSED_FILES
|
||||
-DBOOST_FUSION_CREATE_PREPROCESSED_FILES
|
||||
-SC:/dev/boost
|
||||
-SC:/dev/tools/mingw/include
|
||||
-SC:/dev/tools/mingw/lib/gcc/mingw32/4.5.2/include
|
||||
-SC:/dev/tools/mingw/lib/gcc/mingw32/4.5.2/include/c++
|
||||
-SC:/dev/tools/mingw/lib/gcc/mingw32/4.5.2/include/c++/mingw32
|
||||
--variadics
|
||||
-NBOOST_FUSION_ADAPT_TPL_STRUCT_NO_PARTIAL
|
||||
-NBOOST_PROTO_USE_GET_POINTER
|
||||
-NBOOST_PROTO_GET_POINTER
|
||||
--timer
|
||||
|
||||
|
20
test/Jamfile
20
test/Jamfile
@ -41,6 +41,10 @@ import testing ;
|
||||
[ run algorithm/reverse_fold.cpp : : : : ]
|
||||
[ run algorithm/reverse_iter_fold.cpp : : : : ]
|
||||
[ run algorithm/reverse.cpp : : : : ]
|
||||
[ run algorithm/segmented_for_each.cpp : : : : ]
|
||||
[ run algorithm/segmented_find.cpp : : : : ]
|
||||
[ run algorithm/segmented_find_if.cpp : : : : ]
|
||||
[ run algorithm/segmented_fold.cpp : : : : ]
|
||||
[ run algorithm/transform.cpp : : : : ]
|
||||
[ run algorithm/join.cpp : : : : ]
|
||||
[ run algorithm/zip.cpp : : : : ]
|
||||
@ -83,6 +87,7 @@ import testing ;
|
||||
[ run sequence/map_tie.cpp : : : : ]
|
||||
[ run sequence/nview.cpp : : : : ]
|
||||
[ run sequence/reverse_view.cpp : : : : ]
|
||||
[ run sequence/segmented_iterator_range.cpp : : : : ]
|
||||
[ run sequence/set.cpp : : : : ]
|
||||
[ run sequence/single_view.cpp : : : : ]
|
||||
[ run sequence/std_pair.cpp : : : : ]
|
||||
@ -130,6 +135,7 @@ import testing ;
|
||||
[ run sequence/define_assoc_struct.cpp : : : : ]
|
||||
[ run sequence/define_tpl_struct.cpp : : : : ]
|
||||
[ run sequence/define_assoc_tpl_struct.cpp : : : : ]
|
||||
[ run sequence/std_tuple_iterator.cpp : : : : ]
|
||||
|
||||
[ run functional/fused.cpp : : : : ]
|
||||
[ run functional/fused_function_object.cpp : : : : ]
|
||||
@ -149,17 +155,3 @@ import testing ;
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
{
|
||||
# Text for extension features, must be explicitly specified on the command line to be run
|
||||
# TODO these are not in a test-suite because currently test-suites cannot be marked "explicit"
|
||||
|
||||
run algorithm/ext_/for_each_s.cpp ;
|
||||
explicit for_each_s ;
|
||||
|
||||
run algorithm/ext_/find_if_s.cpp ;
|
||||
explicit find_if_s ;
|
||||
|
||||
run sequence/ext_/iterator_range_s.cpp ;
|
||||
explicit iterator_range_s ;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2007 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005 Eric Niebler
|
||||
Copyright (c) Dan Marsden
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005 Eric Niebler
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005 Eric Niebler
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
@ -30,7 +30,7 @@ void test_set(Set const& set)
|
||||
using namespace boost::fusion;
|
||||
std::cout << set << std::endl;
|
||||
|
||||
BOOST_STATIC_ASSERT(result_of::size<Set>::value == 3);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<Set>::value == 3);
|
||||
BOOST_TEST((*find<int>(set) == 1));
|
||||
BOOST_TEST((*find<double>(set) == 1.5));
|
||||
BOOST_TEST((*find<std::string>(set) == "hello"));
|
||||
@ -47,7 +47,7 @@ void test_map(Map const& map)
|
||||
using namespace boost::fusion;
|
||||
std::cout << map << std::endl;
|
||||
|
||||
BOOST_STATIC_ASSERT(result_of::size<Map>::value == 3);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<Map>::value == 3);
|
||||
BOOST_TEST(((*find<_1>(map)).second == 1));
|
||||
BOOST_TEST(((*find<_3>(map)).second == 1.5));
|
||||
BOOST_TEST(((*find<_4>(map)).second == std::string("hello")));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2007 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -59,7 +59,7 @@ struct sum
|
||||
|
||||
template<typename Self, typename State, typename T>
|
||||
struct result<Self(State,T)>
|
||||
: fusion::result_of::make_pair<
|
||||
: boost::fusion::result_of::make_pair<
|
||||
mpl::int_<
|
||||
boost::remove_reference<
|
||||
State
|
||||
@ -108,7 +108,7 @@ struct meta_sum
|
||||
|
||||
#ifdef BOOST_FUSION_TEST_ITER_FOLD
|
||||
typedef typename
|
||||
fusion::result_of::value_of<
|
||||
boost::fusion::result_of::value_of<
|
||||
typename boost::remove_reference<T>::type
|
||||
>::type
|
||||
t;
|
||||
@ -144,7 +144,7 @@ struct fold_test_n
|
||||
|
||||
{
|
||||
mpl::range_c<int, 1, n+1> init_range;
|
||||
typename fusion::result_of::as_vector<
|
||||
typename boost::fusion::result_of::as_vector<
|
||||
typename mpl::transform<
|
||||
range
|
||||
, mpl::always<int>
|
||||
@ -169,20 +169,20 @@ struct fold_test_n
|
||||
{
|
||||
typedef typename
|
||||
#ifdef BOOST_FUSION_TEST_REVERSE_FOLD
|
||||
fusion::result_of::as_vector<
|
||||
boost::fusion::result_of::as_vector<
|
||||
typename mpl::copy<
|
||||
mpl::range_c<int, 1, n+1>
|
||||
, mpl::front_inserter<fusion::vector<> >
|
||||
>::type
|
||||
>::type
|
||||
#else
|
||||
fusion::result_of::as_vector<mpl::range_c<int, 1, n+1> >::type
|
||||
boost::fusion::result_of::as_vector<mpl::range_c<int, 1, n+1> >::type
|
||||
#endif
|
||||
vec;
|
||||
|
||||
typedef
|
||||
boost::is_same<
|
||||
typename fusion::result_of::BOOST_FUSION_TEST_FOLD_NAME<
|
||||
typename boost::fusion::result_of::BOOST_FUSION_TEST_FOLD_NAME<
|
||||
vec
|
||||
, mpl::vector<mpl::int_<1>, mpl::int_<0> >
|
||||
, meta_sum
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2007 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,16 +1,23 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
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>
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
#include <boost/fusion/container/list/list.hpp>
|
||||
#include <boost/fusion/adapted/mpl.hpp>
|
||||
#include <boost/fusion/sequence/io/out.hpp>
|
||||
#include <boost/fusion/sequence/comparison/equal_to.hpp>
|
||||
#include <boost/fusion/container/generation/make_vector.hpp>
|
||||
#include <boost/fusion/container/generation/make_list.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/pop_back.hpp>
|
||||
#include <boost/fusion/algorithm/transformation/push_back.hpp>
|
||||
#include <boost/fusion/algorithm/query/find.hpp>
|
||||
#include <boost/fusion/include/back.hpp>
|
||||
#include <boost/fusion/include/array.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/mpl/vector_c.hpp>
|
||||
|
||||
int
|
||||
@ -41,6 +48,57 @@ main()
|
||||
BOOST_TEST((boost::fusion::pop_back(mpl_vec()) == make_vector(1, 2, 3, 4)));
|
||||
}
|
||||
|
||||
{
|
||||
list<int, int> l(1, 2);
|
||||
std::cout << pop_back(l) << std::endl;
|
||||
BOOST_TEST((pop_back(l) == make_list(1)));
|
||||
}
|
||||
|
||||
{ // make sure empty sequences are OK
|
||||
list<int> l(1);
|
||||
std::cout << pop_back(l) << std::endl;
|
||||
BOOST_TEST((pop_back(l) == make_list()));
|
||||
}
|
||||
|
||||
{
|
||||
single_view<int> sv(1);
|
||||
std::cout << pop_back(sv) << std::endl;
|
||||
|
||||
// Compile check only
|
||||
begin(pop_back(sv)) == end(sv);
|
||||
end(pop_back(sv)) == begin(sv);
|
||||
}
|
||||
|
||||
// $$$ JDG: TODO add compile fail facility $$$
|
||||
//~ { // compile fail check (Disabled for now)
|
||||
//~ list<> l;
|
||||
//~ std::cout << pop_back(l) << std::endl;
|
||||
//~ }
|
||||
|
||||
#ifndef BOOST_NO_AUTO_DECLARATIONS
|
||||
{
|
||||
auto vec = make_vector(1, 3.14, "hello");
|
||||
|
||||
// Compile check only
|
||||
auto popv = pop_back(vec);
|
||||
std::cout << popv << std::endl;
|
||||
|
||||
auto push = push_back(vec, 42);
|
||||
auto pop = pop_back(vec);
|
||||
auto i1 = find<int>(popv);
|
||||
auto i2 = find<double>(pop);
|
||||
|
||||
BOOST_TEST(i1 != end(pop));
|
||||
BOOST_TEST(i2 != end(pop));
|
||||
BOOST_TEST(i1 != i2);
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
boost::array<std::size_t, 2> a = { 10, 50 };
|
||||
BOOST_TEST(back(pop_back(a)) == 10);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 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)
|
||||
|
62
test/algorithm/segmented_find.cpp
Normal file
62
test/algorithm/segmented_find.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2011 Eric Niebler
|
||||
|
||||
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>
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
#include <boost/fusion/algorithm/query/find.hpp>
|
||||
#include <boost/fusion/container/generation/make_vector.hpp>
|
||||
#include "../sequence/tree.hpp"
|
||||
|
||||
struct not_there {};
|
||||
|
||||
template<typename Tree>
|
||||
void
|
||||
process_tree(Tree const &tree)
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
typedef typename boost::fusion::result_of::find<Tree const, short>::type short_iter;
|
||||
typedef typename boost::fusion::result_of::find<Tree const, float>::type float_iter;
|
||||
typedef typename boost::fusion::result_of::find<Tree const, not_there>::type not_there_iter;
|
||||
|
||||
// find_if_s of a segmented data structure returns generic
|
||||
// segmented iterators
|
||||
short_iter si = fusion::find<short>(tree);
|
||||
float_iter fi = fusion::find<float>(tree);
|
||||
|
||||
// they behave like ordinary Fusion iterators ...
|
||||
BOOST_TEST((*si == short('d')));
|
||||
BOOST_TEST((*fi == float(1)));
|
||||
|
||||
// Searching for something that's not there should return the end iterator.
|
||||
not_there_iter nti = fusion::find<not_there>(tree);
|
||||
BOOST_TEST((nti == fusion::end(tree)));
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
process_tree(
|
||||
make_tree(
|
||||
make_vector(double(0),'B')
|
||||
, make_tree(
|
||||
make_vector(1,2,long(3))
|
||||
, make_tree(make_vector('a','b','c'))
|
||||
, make_tree(make_vector(short('d'),'e','f'))
|
||||
)
|
||||
, make_tree(
|
||||
make_vector(4,5,6)
|
||||
, make_tree(make_vector(float(1),'h','i'))
|
||||
, make_tree(make_vector('j','k','l'))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
65
test/algorithm/segmented_find_if.cpp
Normal file
65
test/algorithm/segmented_find_if.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2011 Eric Niebler
|
||||
|
||||
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>
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
#include <boost/fusion/algorithm/query/find_if.hpp>
|
||||
#include <boost/fusion/container/generation/make_vector.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include "../sequence/tree.hpp"
|
||||
|
||||
struct not_there {};
|
||||
|
||||
template<typename Tree>
|
||||
void
|
||||
process_tree(Tree const &tree)
|
||||
{
|
||||
using namespace boost;
|
||||
using mpl::_;
|
||||
|
||||
typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,short> >::type short_iter;
|
||||
typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,float> >::type float_iter;
|
||||
typedef typename boost::fusion::result_of::find_if<Tree const, is_same<_,not_there> >::type not_there_iter;
|
||||
|
||||
// find_if of a segmented data structure returns generic
|
||||
// segmented iterators
|
||||
short_iter si = fusion::find_if<is_same<_,short> >(tree);
|
||||
float_iter fi = fusion::find_if<is_same<_,float> >(tree);
|
||||
|
||||
// they behave like ordinary Fusion iterators ...
|
||||
BOOST_TEST((*si == short('d')));
|
||||
BOOST_TEST((*fi == float(1)));
|
||||
|
||||
// Searching for something that's not there should return the end iterator.
|
||||
not_there_iter nti = fusion::find_if<is_same<_,not_there> >(tree);
|
||||
BOOST_TEST((nti == fusion::end(tree)));
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
process_tree(
|
||||
make_tree(
|
||||
make_vector(double(0),'B')
|
||||
, make_tree(
|
||||
make_vector(1,2,long(3))
|
||||
, make_tree(make_vector('a','b','c'))
|
||||
, make_tree(make_vector(short('d'),'e','f'))
|
||||
)
|
||||
, make_tree(
|
||||
make_vector(4,5,6)
|
||||
, make_tree(make_vector(float(1),'h','i'))
|
||||
, make_tree(make_vector('j','k','l'))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
63
test/algorithm/segmented_fold.cpp
Normal file
63
test/algorithm/segmented_fold.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2011 Eric Niebler
|
||||
|
||||
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>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/fold.hpp>
|
||||
#include <boost/fusion/container/generation/make_vector.hpp>
|
||||
#include "../sequence/tree.hpp"
|
||||
|
||||
struct write_string
|
||||
{
|
||||
typedef std::ostream* result_type;
|
||||
|
||||
template<typename T>
|
||||
std::ostream* operator()(std::ostream* sout, T const& t) const
|
||||
{
|
||||
return &(*sout << t << " ");
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Tree>
|
||||
void
|
||||
process_tree(Tree const &tree)
|
||||
{
|
||||
using namespace boost;
|
||||
|
||||
std::stringstream str;
|
||||
fusion::fold(tree, &str, write_string());
|
||||
std::string res = str.str();
|
||||
|
||||
BOOST_TEST_EQ(res, "a b c 1 2 3 100 e f 0 B 1 h i 4 5 6 j k l ");
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
process_tree(
|
||||
make_tree(
|
||||
make_vector(double(0),'B')
|
||||
, make_tree(
|
||||
make_vector(1,2,long(3))
|
||||
, make_tree(make_vector('a','b','c'))
|
||||
, make_tree(make_vector(short('d'),'e','f'))
|
||||
)
|
||||
, make_tree(
|
||||
make_vector(4,5,6)
|
||||
, make_tree(make_vector(float(1),'h','i'))
|
||||
, make_tree(make_vector('j','k','l'))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
49
test/algorithm/segmented_for_each.cpp
Normal file
49
test/algorithm/segmented_for_each.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2011 Eric Niebler
|
||||
|
||||
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>
|
||||
#include <boost/fusion/container/vector/vector.hpp>
|
||||
#include <boost/fusion/algorithm/iteration/for_each.hpp>
|
||||
#include <boost/fusion/container/generation/make_vector.hpp>
|
||||
#include "../sequence/tree.hpp"
|
||||
|
||||
struct print
|
||||
{
|
||||
template <typename T>
|
||||
void operator()(T const& v) const
|
||||
{
|
||||
std::cout << "[ " << v << " ] ";
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
|
||||
{
|
||||
for_each(
|
||||
make_tree(
|
||||
make_vector(double(0),'B')
|
||||
, make_tree(
|
||||
make_vector(1,2,long(3))
|
||||
, make_tree(make_vector('a','b','c'))
|
||||
, make_tree(make_vector(short('d'),'e','f'))
|
||||
)
|
||||
, make_tree(
|
||||
make_vector(4,5,6)
|
||||
, make_tree(make_vector(float(1),'h','i'))
|
||||
, make_tree(make_vector('j','k','l'))
|
||||
)
|
||||
)
|
||||
, print()
|
||||
);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2007 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
@ -109,46 +109,46 @@ main()
|
||||
{
|
||||
typedef range_c<int, 5, 9> sequence_type;
|
||||
sequence_type sequence;
|
||||
std::cout << transform(sequence, square()) << std::endl;
|
||||
BOOST_TEST((transform(sequence, square()) == make_vector(25, 36, 49, 64)));
|
||||
std::cout << boost::fusion::transform(sequence, square()) << std::endl;
|
||||
BOOST_TEST((boost::fusion::transform(sequence, square()) == make_vector(25, 36, 49, 64)));
|
||||
}
|
||||
|
||||
{
|
||||
typedef range_c<int, 5, 9> mpl_list1;
|
||||
std::cout << transform(mpl_list1(), square()) << std::endl;
|
||||
BOOST_TEST((transform(mpl_list1(), square()) == make_vector(25, 36, 49, 64)));
|
||||
std::cout << boost::fusion::transform(mpl_list1(), square()) << std::endl;
|
||||
BOOST_TEST((boost::fusion::transform(mpl_list1(), square()) == make_vector(25, 36, 49, 64)));
|
||||
}
|
||||
|
||||
{
|
||||
vector<int, int, int> tup(1, 2, 3);
|
||||
std::cout << transform(tup, square()) << std::endl;
|
||||
BOOST_TEST((transform(tup, square()) == make_vector(1, 4, 9)));
|
||||
std::cout << boost::fusion::transform(tup, square()) << std::endl;
|
||||
BOOST_TEST((boost::fusion::transform(tup, square()) == make_vector(1, 4, 9)));
|
||||
}
|
||||
|
||||
{
|
||||
vector<int, int, int> tup1(1, 2, 3);
|
||||
vector<int, int, int> tup2(4, 5, 6);
|
||||
std::cout << transform(tup1, tup2, add()) << std::endl;
|
||||
BOOST_TEST((transform(tup1, tup2, add()) == make_vector(5, 7, 9)));
|
||||
std::cout << boost::fusion::transform(tup1, tup2, add()) << std::endl;
|
||||
BOOST_TEST((boost::fusion::transform(tup1, tup2, add()) == make_vector(5, 7, 9)));
|
||||
}
|
||||
|
||||
{
|
||||
// Unary transform that requires lvalues, just check compilation
|
||||
vector<int, int, int> tup1(1, 2, 3);
|
||||
BOOST_TEST(at_c<0>(transform(tup1, unary_lvalue_transform())) == &at_c<0>(tup1));
|
||||
BOOST_TEST(*begin(transform(tup1, unary_lvalue_transform())) == &at_c<0>(tup1));
|
||||
BOOST_TEST(at_c<0>(boost::fusion::transform(tup1, unary_lvalue_transform())) == &at_c<0>(tup1));
|
||||
BOOST_TEST(*begin(boost::fusion::transform(tup1, unary_lvalue_transform())) == &at_c<0>(tup1));
|
||||
}
|
||||
|
||||
{
|
||||
vector<int, int, int> tup1(1, 2, 3);
|
||||
vector<int, int, int> tup2(4, 5, 6);
|
||||
BOOST_TEST(at_c<0>(transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1));
|
||||
BOOST_TEST(*begin(transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1));
|
||||
BOOST_TEST(at_c<0>(boost::fusion::transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1));
|
||||
BOOST_TEST(*begin(boost::fusion::transform(tup1, tup2, binary_lvalue_transform())) == &at_c<0>(tup1));
|
||||
}
|
||||
|
||||
{
|
||||
vector<int, int, int> tup1(1, 2, 3);
|
||||
BOOST_TEST(transform(tup1, twice) == make_vector(2,4,6));
|
||||
BOOST_TEST(boost::fusion::transform(tup1, twice) == make_vector(2,4,6));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -38,17 +38,17 @@ namespace
|
||||
fusion::at_c<8>(v);
|
||||
fusion::at_c<9>(v);
|
||||
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 0>::type va0;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 1>::type va1;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 2>::type va2;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 3>::type va3;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 4>::type va4;
|
||||
typedef typename boost::fusion::result_of::value_at_c<v_type, 0>::type va0;
|
||||
typedef typename boost::fusion::result_of::value_at_c<v_type, 1>::type va1;
|
||||
typedef typename boost::fusion::result_of::value_at_c<v_type, 2>::type va2;
|
||||
typedef typename boost::fusion::result_of::value_at_c<v_type, 3>::type va3;
|
||||
typedef typename boost::fusion::result_of::value_at_c<v_type, 4>::type va4;
|
||||
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 5>::type va5;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 6>::type va6;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 7>::type va7;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 8>::type va8;
|
||||
typedef typename fusion::result_of::value_at_c<v_type, 9>::type va9;
|
||||
typedef typename boost::fusion::result_of::value_at_c<v_type, 5>::type va5;
|
||||
typedef typename boost::fusion::result_of::value_at_c<v_type, 6>::type va6;
|
||||
typedef typename boost::fusion::result_of::value_at_c<v_type, 7>::type va7;
|
||||
typedef typename boost::fusion::result_of::value_at_c<v_type, 8>::type va8;
|
||||
typedef typename boost::fusion::result_of::value_at_c<v_type, 9>::type va9;
|
||||
|
||||
fusion::begin(v);
|
||||
fusion::end(v);
|
||||
|
@ -331,7 +331,7 @@ void test_sequence_n(Sequence & seq, mpl::int_<3>)
|
||||
template <class Sequence>
|
||||
void test_sequence(Sequence & seq)
|
||||
{
|
||||
test_sequence_n(seq, mpl::int_<fusion::result_of::size<Sequence>::value>());
|
||||
test_sequence_n(seq, mpl::int_<boost::fusion::result_of::size<Sequence>::value>());
|
||||
}
|
||||
|
||||
|
||||
@ -340,18 +340,18 @@ void result_type_tests()
|
||||
using boost::is_same;
|
||||
|
||||
BOOST_TEST(( is_same<
|
||||
fusion::result_of::invoke<int (*)(), fusion::vector0<> >::type, int
|
||||
boost::fusion::result_of::invoke<int (*)(), fusion::vector0<> >::type, int
|
||||
>::value ));
|
||||
// disabled until boost::result_of supports it
|
||||
// BOOST_TEST(( is_same<
|
||||
// fusion::result_of::invoke<int (*)(...), fusion::vector1<int> >::type, int
|
||||
// boost::fusion::result_of::invoke<int (*)(...), fusion::vector1<int> >::type, int
|
||||
// >::value ));
|
||||
BOOST_TEST(( is_same<
|
||||
fusion::result_of::invoke<int (members::*)(), fusion::vector1<members*> >::type, int
|
||||
boost::fusion::result_of::invoke<int (members::*)(), fusion::vector1<members*> >::type, int
|
||||
>::value ));
|
||||
// disabled until boost::result_of supports it
|
||||
// BOOST_TEST(( is_same<
|
||||
// fusion::result_of::invoke<int (members::*)(...), fusion::vector2<members*,int> >::type, int
|
||||
// boost::fusion::result_of::invoke<int (members::*)(...), fusion::vector2<members*,int> >::type, int
|
||||
// >::value ));
|
||||
}
|
||||
|
||||
|
@ -182,16 +182,16 @@ void test_sequence_n(Sequence & seq, mpl::int_<3>)
|
||||
template <class Sequence>
|
||||
void test_sequence(Sequence & seq)
|
||||
{
|
||||
test_sequence_n(seq, mpl::int_<fusion::result_of::size<Sequence>::value>());
|
||||
test_sequence_n(seq, mpl::int_<boost::fusion::result_of::size<Sequence>::value>());
|
||||
}
|
||||
|
||||
void result_type_tests()
|
||||
{
|
||||
using boost::is_same;
|
||||
|
||||
BOOST_TEST(( is_same< fusion::result_of::invoke_function_object< nullary_fobj, fusion::vector<> >::type, int >::value ));
|
||||
BOOST_TEST(( is_same< fusion::result_of::invoke_function_object< fobj, fusion::vector<element1_type> >::type, int >::value ));
|
||||
BOOST_TEST(( is_same< fusion::result_of::invoke_function_object< fobj, fusion::vector<element1_type,element2_type> >::type, int >::value ));
|
||||
BOOST_TEST(( is_same< boost::fusion::result_of::invoke_function_object< nullary_fobj, fusion::vector<> >::type, int >::value ));
|
||||
BOOST_TEST(( is_same< boost::fusion::result_of::invoke_function_object< fobj, fusion::vector<element1_type> >::type, int >::value ));
|
||||
BOOST_TEST(( is_same< boost::fusion::result_of::invoke_function_object< fobj, fusion::vector<element1_type,element2_type> >::type, int >::value ));
|
||||
}
|
||||
|
||||
|
||||
|
@ -244,7 +244,7 @@ void test_sequence_n(Sequence & seq, mpl::int_<3>)
|
||||
template <class Sequence>
|
||||
void test_sequence(Sequence & seq)
|
||||
{
|
||||
test_sequence_n(seq, mpl::int_<fusion::result_of::size<Sequence>::value>());
|
||||
test_sequence_n(seq, mpl::int_<boost::fusion::result_of::size<Sequence>::value>());
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -63,7 +63,7 @@ int main()
|
||||
test_func<> f;
|
||||
test_func<noncopyable> f_nc;
|
||||
|
||||
fusion::result_of::make_fused< test_func<> >::type fused_func
|
||||
boost::fusion::result_of::make_fused< test_func<> >::type fused_func
|
||||
= fusion::make_fused(f);
|
||||
|
||||
BOOST_TEST(fused_func(lv_vec) == 1);
|
||||
|
@ -73,7 +73,7 @@ int main()
|
||||
test_func<> f;
|
||||
test_func<noncopyable> f_nc;
|
||||
|
||||
fusion::result_of::make_fused_function_object< test_func<> >::type fused_func
|
||||
boost::fusion::result_of::make_fused_function_object< test_func<> >::type fused_func
|
||||
= fusion::make_fused_function_object(f);
|
||||
|
||||
BOOST_TEST(fused_func(lv_vec) == 1);
|
||||
|
@ -69,7 +69,7 @@ int main()
|
||||
test_func<> f;
|
||||
test_func<noncopyable> f_nc;
|
||||
|
||||
fusion::result_of::make_fused_procedure< test_func<> >::type fused_func
|
||||
boost::fusion::result_of::make_fused_procedure< test_func<> >::type fused_func
|
||||
= fusion::make_fused_procedure(f);
|
||||
|
||||
CHECK_EFFECT(fused_func(lv_vec), 1);
|
||||
|
@ -42,7 +42,7 @@ struct test_func
|
||||
|
||||
template <class Self, class Seq>
|
||||
struct result< Self(Seq &) >
|
||||
: mpl::if_< mpl::and_< fusion::result_of::empty<Seq>, RemoveNullary >,
|
||||
: mpl::if_< mpl::and_< boost::fusion::result_of::empty<Seq>, RemoveNullary >,
|
||||
boost::blank, mpl::identity<long> >::type
|
||||
{ };
|
||||
|
||||
@ -86,14 +86,14 @@ int main()
|
||||
test_func<> f;
|
||||
test_func<noncopyable> f_nc;
|
||||
|
||||
fusion::result_of::make_unfused< test_func<> >::type unfused_func =
|
||||
boost::fusion::result_of::make_unfused< test_func<> >::type unfused_func =
|
||||
fusion::make_unfused(f);
|
||||
|
||||
fusion::result_of::make_unfused< boost::reference_wrapper<
|
||||
boost::fusion::result_of::make_unfused< boost::reference_wrapper<
|
||||
test_func<noncopyable> > >::type unfused_func_ref =
|
||||
fusion::make_unfused(ref(f_nc));
|
||||
|
||||
fusion::result_of::make_unfused< boost::reference_wrapper<
|
||||
boost::fusion::result_of::make_unfused< boost::reference_wrapper<
|
||||
test_func<noncopyable> const> >::type unfused_func_c_ref =
|
||||
fusion::make_unfused(cref(f_nc));
|
||||
|
||||
|
@ -92,7 +92,6 @@ main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
std::cout << tuple_open('[');
|
||||
std::cout << tuple_close(']');
|
||||
@ -111,8 +110,8 @@ main()
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
|
||||
BOOST_STATIC_ASSERT(result_of::size<ns::point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(!result_of::empty<ns::point>::value);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
@ -149,7 +148,7 @@ main()
|
||||
{
|
||||
BOOST_MPL_ASSERT((mpl::is_sequence<ns::point>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<
|
||||
fusion::result_of::value_at_c<ns::point,0>::type
|
||||
boost::fusion::result_of::value_at_c<ns::point,0>::type
|
||||
, mpl::front<ns::point>::type>));
|
||||
}
|
||||
|
||||
@ -167,8 +166,8 @@ main()
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
|
||||
BOOST_STATIC_ASSERT(result_of::size<ns::point_with_private_members>::value == 2);
|
||||
BOOST_STATIC_ASSERT(!result_of::empty<ns::point_with_private_members>::value);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<ns::point_with_private_members>::value == 2);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<ns::point_with_private_members>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
@ -178,22 +177,22 @@ main()
|
||||
{
|
||||
BOOST_MPL_ASSERT((
|
||||
boost::is_same<
|
||||
result_of::front<ns::point>::type,
|
||||
boost::fusion::result_of::front<ns::point>::type,
|
||||
boost::fusion::extension::adt_attribute_proxy<ns::point,0,false>
|
||||
>));
|
||||
BOOST_MPL_ASSERT((
|
||||
boost::is_same<
|
||||
result_of::front<ns::point>::type::type,
|
||||
boost::fusion::result_of::front<ns::point>::type::type,
|
||||
int
|
||||
>));
|
||||
BOOST_MPL_ASSERT((
|
||||
boost::is_same<
|
||||
result_of::front<ns::point const>::type,
|
||||
boost::fusion::result_of::front<ns::point const>::type,
|
||||
boost::fusion::extension::adt_attribute_proxy<ns::point,0,true>
|
||||
>));
|
||||
BOOST_MPL_ASSERT((
|
||||
boost::is_same<
|
||||
result_of::front<ns::point const>::type::type,
|
||||
boost::fusion::result_of::front<ns::point const>::type::type,
|
||||
int
|
||||
>));
|
||||
}
|
||||
|
@ -64,7 +64,6 @@ main()
|
||||
{
|
||||
using namespace boost::fusion;
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
std::cout << tuple_open('[');
|
||||
std::cout << tuple_close(']');
|
||||
@ -84,8 +83,8 @@ main()
|
||||
at_c<1>(p) = 9;
|
||||
BOOST_TEST(p == make_vector(6, 9));
|
||||
|
||||
BOOST_STATIC_ASSERT(result_of::size<adapted::point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(!result_of::empty<adapted::point>::value);
|
||||
BOOST_STATIC_ASSERT(boost::fusion::result_of::size<adapted::point>::value == 2);
|
||||
BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<adapted::point>::value);
|
||||
|
||||
BOOST_TEST(front(p) == 6);
|
||||
BOOST_TEST(back(p) == 9);
|
||||
@ -128,7 +127,7 @@ main()
|
||||
{
|
||||
BOOST_MPL_ASSERT((mpl::is_sequence<adapted::point>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<
|
||||
fusion::result_of::value_at_c<adapted::point,0>::type
|
||||
boost::fusion::result_of::value_at_c<adapted::point,0>::type
|
||||
, mpl::front<adapted::point>::type>));
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user