Compare commits

..

18 Commits

Author SHA1 Message Date
4686882502 Create branches/filesystem-v3 for v2 removal
[SVN r77385]
2012-03-18 20:54:17 +00:00
df0fbd1d9d typo fix
[SVN r77114]
2012-02-25 01:09:58 +00:00
38cd16639d Fixes Ticket #6372
[SVN r76395]
2012-01-10 02:03:43 +00:00
1c51ad943a Fix for ticket #6338
[SVN r76238]
2011-12-31 05:48:27 +00:00
a25a7092d8 Patches from Tim Blechmann
[SVN r75976]
2011-12-16 00:14:49 +00:00
48e4118768 Fixes for MSVC workarounds from Freundlich: http://codepad.org/wRelwDJt
[SVN r75595]
2011-11-21 14:43:19 +00:00
0a520f6021 fix problem where sizeof(int) != sizeof(long)
[SVN r75563]
2011-11-20 10:59:09 +00:00
bbf10066bc C++11 patches by Michel Morin
[SVN r75394]
2011-11-07 22:07:05 +00:00
c2052a3c0c Fix Ticket #6067
[SVN r75318]
2011-11-04 20:37:33 +00:00
480183059e + Fixes Ticket #6016 using a two-level specialization such that specialization is preferred over SFINAE.
+ Removes tag_of_fallback. It's not needed anymore. The proper way is to specialize tag_of.

[SVN r74934]
2011-10-13 00:23:40 +00:00
fd82b51cec Wrong version. Should be 2.2 + fixed copyright notices and dates
[SVN r74886]
2011-10-10 10:37:53 +00:00
24bca52c5e Wrong version. Should be 2.2.
[SVN r74885]
2011-10-10 10:08:44 +00:00
459a1dba3d Bumped copyright date and version to 2.1 (it's about time!).
[SVN r74883]
2011-10-10 10:05:49 +00:00
10274e7884 Made map random access. Thanks to Brandon Kohn!
[SVN r74882]
2011-10-10 09:55:52 +00:00
b6df98e86c Made map random access. Thanks to Brandon Kohn!
[SVN r74881]
2011-10-10 09:55:41 +00:00
4be9e08af7 Fix for ticket #6000
[SVN r74872]
2011-10-10 00:59:32 +00:00
f46b2aeb73 Fix for ticket #6000
[SVN r74871]
2011-10-10 00:58:24 +00:00
21301c93dc Fix for ticket #6000
[SVN r74870]
2011-10-10 00:47:40 +00:00
24 changed files with 180 additions and 104 deletions

View File

@ -244,7 +244,7 @@ __random_access_sequence__.
[heading Semantics]
The above macro generates the necessary code to adapt `struct_name` or an
The above macro generates the necessary code to adapt `struct_name` or an
arbitrary specialization of `struct_name` as a model of
__random_access_sequence__.
The sequence `(template_param0)(template_param1)...` declares the names of
@ -287,9 +287,9 @@ namespace qualified name of the struct to be adapted.
[section:adapt_struct_named BOOST_FUSION_ADAPT_STRUCT_NAMED]
[heading Description]
BOOST_FUSION_ADAPT_STRUCT_NAMED and BOOST_FUSION_ADAPT_STRUCT_NAMED_NS are
macros that can be used to generate all the necessary boilerplate to make an
arbitrary struct a model of __random_access_sequence__. The given struct is
BOOST_FUSION_ADAPT_STRUCT_NAMED and BOOST_FUSION_ADAPT_STRUCT_NAMED_NS are
macros that can be used to generate all the necessary boilerplate to make an
arbitrary struct a model of __random_access_sequence__. The given struct is
adapted using the given name.
[heading Synopsis]
@ -312,7 +312,7 @@ adapted using the given name.
[heading Semantics]
The above macros generate the necessary code to adapt `struct_name`
as a model of __random_access_sequence__ while using `adapted_name` as the
as a model of __random_access_sequence__ while using `adapted_name` as the
name of the adapted struct.
The sequence `(namespace0)(namespace1)...` declares the namespace
for `adapted_name`. It yields to a fully qualified name for `adapted_name` of
@ -427,7 +427,7 @@ __random_access_sequence__ and __associative_sequence__.
[heading Semantics]
The above macro generates the necessary code to adapt `struct_name` or an
The above macro generates the necessary code to adapt `struct_name` or an
arbitrary specialization of `struct_name` as a model of
__random_access_sequence__ and __associative_sequence__.
The sequence `(template_param0)(template_param1)...` declares the names of
@ -463,7 +463,7 @@ namespace qualified name of the struct to be adapted.
struct name;
struct age;
}
// Any instantiated demo::employee is now a Fusion sequence.
// It is also an associative sequence with
// keys keys::name and keys::age present.
@ -478,8 +478,8 @@ namespace qualified name of the struct to be adapted.
[section:adapt_assoc_struct_named BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED]
[heading Description]
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED and BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_NS are
macros that can be used to generate all the necessary boilerplate to make an
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED and BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_NS are
macros that can be used to generate all the necessary boilerplate to make an
arbitrary struct a model of __random_access_sequence__ and
__associative_sequence__. The given struct is adapted using the given name.
@ -539,7 +539,7 @@ namespace qualified name of the struct to be converted.
struct name;
struct age;
}
// boost::fusion::adapted::adapted_employee is now a Fusion sequence
// referring to demo::employee
BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(
@ -567,7 +567,7 @@ __random_access_sequence__.
[heading Expression Semantics]
The above macro generates the necessary code to adapt `type_name`
as a model of __random_access_sequence__.
as a model of __random_access_sequence__.
The sequence of
[^(attribute_type['N], attribute_const_type['N], get_expr['N], set_expr['N])]
quadruples declares the types, const types, get-expressions and set-expressions
@ -600,7 +600,7 @@ namespace qualified name of the class type to be adapted.
#include <boost/fusion/adapted/adt/adapt_adt.hpp>
#include <boost/fusion/include/adapt_adt.hpp>
[heading Example]
namespace demo
{
@ -609,41 +609,41 @@ namespace qualified name of the class type to be adapted.
private:
std::string name;
int age;
public:
void set_name(std::string const& n)
{
name=n;
}
void set_age(int a)
{
age=a;
}
std::string const& get_name()const
{
return name;
}
int get_age()const
{
return age;
}
};
}
BOOST_FUSION_ADAPT_ADT(
demo::employee,
(std::string const&, std::string const&, obj.get_name(), obj.set_name(val))
(int, int, obj.get_age(), obj.set_age(val)))
demo::employee e;
front(e)="Edward Norton";
back(e)=41;
//Prints 'Edward Norton is 41 years old'
std::cout << e.get_name() << " is " << e.get_age() << " years old" << std::endl;
[heading See also]
__adt_attribute_proxy__
@ -670,7 +670,7 @@ __random_access_sequence__.
The above macro generates the necessary code to adapt `type_name`
or an arbitrary specialization of `type_name`
as a model of __random_access_sequence__.
as a model of __random_access_sequence__.
The sequence `(template_param0)(template_param1)...` declares the names of
the template type parameters used.
The sequence `(specialization_param0)(specialization_param1)...`
@ -708,40 +708,40 @@ namespace qualified name of the template class type to be adapted.
#include <boost/fusion/adapted/adt/adapt_adt.hpp>
#include <boost/fusion/include/adapt_adt.hpp>
[heading Example]
namespace demo
{
{
template<typename Name, typename Age>
struct employee
{
private:
Name name;
Age age;
public:
void set_name(Name const& n)
{
name=n;
}
void set_age(Age const& a)
{
age=a;
}
Name const& get_name()const
{
return name;
}
Age const& get_age()const
{
return age;
}
};
}
BOOST_FUSION_ADAPT_TPL_ADT(
(Name)(Age),
(demo::employee) (Name)(Age),
@ -753,7 +753,7 @@ namespace qualified name of the template class type to be adapted.
boost::fusion::back(e)=41;
//Prints 'Edward Norton is 41 years old'
std::cout << e.get_name() << " is " << e.get_age() << " years old" << std::endl;
[heading See also]
__adt_attribute_proxy__
@ -778,7 +778,7 @@ __random_access_sequence__ and __associative_sequence__.
[heading Expression Semantics]
The above macro generates the necessary code to adapt `type_name`
as a model of __random_access_sequence__ and __associative_sequence__.
as a model of __random_access_sequence__ and __associative_sequence__.
The sequence of
[^(attribute_type['N], attribute_const_type['N], get_expr['N], set_expr['N], key_type['N])]
5-tuples declares the types, const types, get-expressions, set-expressions and key types
@ -800,7 +800,7 @@ The actual return type of fusion's intrinsic sequence access (meta-)functions
when in invoked with (an instance of) `type_name` is a proxy type.
This type is implicitly convertible to the attribute type via [^get_expr['N]] and
forwards assignment to the underlying element via [^set_expr['N]].
The value type (that is the type returned by __result_of_value_of__, __result_of_value_of_data__,
The value type (that is the type returned by __result_of_value_of__, __result_of_value_of_data__,
__result_of_value_at__, __result_of_value_at_c__ and __result_of_value_at_key__) of the ['N]th element
is [^attribute_type['N]] with const-qualifier and reference removed.
@ -811,7 +811,7 @@ namespace qualified name of the class type to be adapted.
#include <boost/fusion/adapted/adt/adapt_assoc_adt.hpp>
#include <boost/fusion/include/adapt_assoc_adt.hpp>
[heading Example]
namespace demo
{
@ -820,47 +820,47 @@ namespace qualified name of the class type to be adapted.
private:
std::string name;
int age;
public:
void set_name(std::string const& n)
{
name=n;
}
void set_age(int a)
{
age=a;
}
std::string const& get_name()const
{
return name;
}
int get_age()const
{
return age;
}
};
}
namespace keys
{
struct name;
struct age;
}
BOOST_FUSION_ADAPT_ASSOC_ADT(
demo::employee,
(std::string const&, std::string const&, obj.get_name(), obj.set_name(val), keys::name)
(int, int, obj.get_age(), obj.set_age(val), keys::age))
demo::employee e;
at_key<keys::name>(e)="Edward Norton";
at_key<keys::age>(e)=41;
//Prints 'Edward Norton is 41 years old'
std::cout << e.get_name() << " is " << e.get_age() << " years old" << std::endl;
[heading See also]
__adt_attribute_proxy__
@ -887,7 +887,7 @@ __random_access_sequence__ and __associative_sequence__.
The above macro generates the necessary code to adapt `type_name`
or an arbitrary specialization of `type_name`
as a model of __random_access_sequence__ and __associative_sequence__.
as a model of __random_access_sequence__ and __associative_sequence__.
The sequence `(template_param0)(template_param1)...` declares the names of
the template type parameters used.
The sequence `(specialization_param0)(specialization_param1)...`
@ -914,7 +914,7 @@ The actual return type of fusion's intrinsic sequence access (meta-)functions
when in invoked with (an instance of) `type_name` is a proxy type.
This type is implicitly convertible to the attribute type via [^get_expr['N]] and
forwards assignment to the underlying element via [^set_expr['N]].
The value type (that is the type returned by __result_of_value_of__, __result_of_value_of_data__,
The value type (that is the type returned by __result_of_value_of__, __result_of_value_of_data__,
__result_of_value_at__, __result_of_value_at_c__ and __result_of_value_at_key__) of the ['N]th element
is [^attribute_type['N]] with const-qualifier and reference removed.
@ -925,7 +925,7 @@ namespace qualified name of the template class type to be adapted.
#include <boost/fusion/adapted/adt/adapt_assoc_adt.hpp>
#include <boost/fusion/include/adapt_assoc_adt.hpp>
[heading Example]
namespace demo
{
@ -935,48 +935,48 @@ namespace qualified name of the template class type to be adapted.
private:
Name name;
Age age;
public:
void set_name(Name const& n)
{
name=n;
}
void set_age(Age const& a)
{
age=a;
}
Name const& get_name()const
{
return name;
}
Age const& get_age()const
{
return age;
}
};
}
namespace keys
{
struct name;
struct age;
}
BOOST_FUSION_ADAPT_ASSOC_TPL_ADT(
(Name)(Age),
(demo::employee) (Name)(Age),
(Name const&, Name const&, obj.get_name(), obj.set_name(val), keys::name)
(Age const&, Age const&, obj.get_age(), obj.set_age(val), keys::age))
demo::employee<std::string, int> e;
at_key<keys::name>(e)="Edward Norton";
at_key<keys::age>(e)=41;
//Prints 'Edward Norton is 41 years old'
std::cout << e.get_name() << " is " << e.get_age() << " years old" << std::endl;
[heading See also]
__adt_attribute_proxy__
@ -1028,14 +1028,14 @@ defined in __random_access_sequence__.
[[`struct_name(e0, e1,... en)`] [Creates an instance of `struct_name` with elements `e0`...`en`.]]
[[`struct_name(fs)`] [Copy constructs an instance of `struct_name` from a __forward_sequence__ `fs`.]]
[[`str = fs`] [Assigns from a __forward_sequence__ `fs`.]]
[[`str.member_nameN`] [Access of struct member `member_nameN`]]
[[`str.member_nameN`] [Access of struct member `member_nameN`]]
]
[heading Header]
#include <boost/fusion/adapted/struct/define_struct.hpp>
#include <boost/fusion/include/define_struct.hpp>
[heading Example]
// demo::employee is a Fusion sequence
@ -1097,14 +1097,14 @@ defined in __random_access_sequence__.
[[`Str(e0, e1,... en)`] [Creates an instance of `Str` with elements `e0`...`en`.]]
[[`Str(fs)`] [Copy constructs an instance of `Str` from a __forward_sequence__ `fs`.]]
[[`str = fs`] [Assigns from a __forward_sequence__ `fs`.]]
[[`str.member_nameN`] [Access of struct member `member_nameN`]]
[[`str.member_nameN`] [Access of struct member `member_nameN`]]
]
[heading Header]
#include <boost/fusion/adapted/struct/define_struct.hpp>
#include <boost/fusion/include/define_struct.hpp>
[heading Example]
// Any instantiated demo::employee is a Fusion sequence
@ -1162,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
@ -1177,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,
@ -1238,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
@ -1253,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,

View File

@ -134,7 +134,7 @@ the first call) and [arg_desc] of `seq`.
>
typename result_of_name_macro<Sequence, State const, F>::type name_macro(
Sequence& seq, State const& initial_state, F f);
template<
typename Sequence,
typename State,

View File

@ -44,5 +44,6 @@ This section summarizes significant changes to the Fusion library.
* September 16, 2011: Added preprocessed files (using wave) to speed up
compilation (Joel de Guzman)
* October 8, 2011: Added adaptor for std::tuple (Joel de Guzman)
* October 10, 2011: Made map random access (Brandon Kohn)
[endsect]

View File

@ -420,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]]
@ -432,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]]
@ -682,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
@ -1039,8 +1039,8 @@ rules for __element_conversion__.
[heading Header]
#include <boost/fusion/container/generation/make_list.hpp>
#include <boost/fusion/include/make_list.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/include/make_vector.hpp>
[heading Example]

View File

@ -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.

View File

@ -9,7 +9,7 @@
===============================================================================/]
[library Fusion
[quickbook 1.3]
[version 2.1]
[version 2.2]
[authors [de Guzman, Joel], [Marsden, Dan], [Schwinger, Tobias]]
[copyright 2001 2002 2003 2004 2005 2006 2011 Joel de Guzman, Dan Marsden, Tobias Schwinger]
[purpose Statically Typed Heterogeneous Data Structures and Algorithms]

View File

@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<head>
<!-- Copyright (C) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
Distributed under the Boost Software License, Version 1.0.
@ -8,9 +8,9 @@
http://www.boost.org/LICENSE_1_0.txt) -->
<title>Redirect to generated documentation</title>
<meta http-equiv="refresh" content="0; URL=http://boost-sandbox.sourceforge.net/libs/fusion/doc/html/">
</head>
</head>
<body>
Automatic redirection failed, please go to
<a href="http://boost-sandbox.sourceforge.net/libs/fusion/doc/html/">http://boost-sandbox.sourceforge.net/libs/fusion/doc/html/</a>
</body>
</body>
</html>

View File

@ -161,6 +161,7 @@ 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__)
@ -206,6 +207,7 @@ the following expressions must be valid:
[heading Models]
* __vector__ iterator
* __map__ iterator
* __std_pair__ iterator
* __boost_array__ iterator
* __single_view__ iterator
@ -993,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]
@ -1032,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]

View File

@ -168,7 +168,7 @@ and __deref_data__) is a proxy type, an instance of
has three template arguments:
namespace boost { namespace fusion { namespace extension
{
{
template<
typename Type
, int Index
@ -176,14 +176,14 @@ has three template arguments:
>
struct adt_attribute_proxy;
}}}
When adapting a class type, `adt_attribute_proxy` is specialized for every
element of the adapted sequence, with `Type` being the class type that is
adapted, `Index` the 0-based indices of the elements, and `Const` both `true`
and `false`. The return type of fusion's intrinsic sequence access functions
for the ['N]th element of an adapted class type `type_name` is
[^adt_attribute_proxy<type_name, ['N], ['Const]>], with [^['Const]] being `true`
for constant instances of `type_name` and `false` for non-constant ones.
for constant instances of `type_name` and `false` for non-constant ones.
[variablelist Notation
[[`type_name`]
@ -205,7 +205,7 @@ for constant instances of `type_name` and `false` for non-constant ones.
]
[*Expression Semantics]
[table
[[Expression] [Semantics]]
[[[^proxy_type['N](inst)]] [Creates an instance of [^proxy_type['N]] with underlying object `inst`]]

View File

@ -189,6 +189,7 @@ 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)
@ -265,6 +266,7 @@ 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)
@ -848,7 +850,7 @@ Performs an element by element swap of the elements in 2 sequences.
[table
[[Parameters] [Requirement] [Description]]
[[`seq1`, `seq2`] [Models of __forward_sequence__][The sequences whos elements we wish to swap.]]
[[`seq1`, `seq2`][Models of __forward_sequence__][The sequences whos elements we wish to swap.]]
]
[heading Expression Semantics]
@ -1376,7 +1378,7 @@ Returns the actual element type associated with a Key from the __sequence__.
#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
#include <boost/fusion/include/value_at_key.hpp>
[heading Example]
typedef __map__<__pair__<int, char>, __pair__<char, char>, __pair__<double, char> > mymap;
BOOST_MPL_ASSERT((boost::is_same<__result_of_at_key__<mymap, int>::type, char>));

View File

@ -483,7 +483,7 @@ defined in the implemented models.
[heading Description]
`nview` presents a view which iterates over a given __sequence__ in a specified order.
`nview` presents a view which iterates over a given __sequence__ in a specified order.
An `nview` is constructed from an arbitrary __sequence__ and a list of indicies specifying
the elements to iterate over.
@ -507,15 +507,15 @@ the elements to iterate over.
[[Parameter] [Description] [Default]]
[[`Sequence`] [An arbitrary Fusion __forward_sequence__]
[]]
[[`Indicies`] [A `mpl::vector_c<int, ...>` holding the indicies defining
[[`Indicies`] [A `mpl::vector_c<int, ...>` holding the indicies defining
the required iteration order.] []]
[[`I1`, `I2`, `I3`...] [A list of integers specifying the required
[[`I1`, `I2`, `I3`...] [A list of integers specifying the required
iteration order.] [`INT_MAX` for `I2`, `I3`...]]
]
[heading Model of]
* __random_access_sequence__ (see __traversal_concept__)
* __random_access_sequence__ (see __traversal_concept__)
[variablelist Notation
[[`NV`] [A `nview` type]]

View File

@ -3,7 +3,7 @@
Copyright (c) 2011 Nathan Ridge
Copyright (c) 2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/

View File

@ -33,7 +33,7 @@ namespace boost { namespace fusion
static type
call(Seq& s)
{
return * advance<N>(s.first);
return * fusion::advance<N>(s.first);
}
};
};

View File

@ -39,11 +39,18 @@ namespace boost { namespace fusion
{
template <typename Sequence, typename T>
struct push_back;
template <typename Sequence, typename T>
struct push_front;
}
template <typename Sequence, typename T>
typename result_of::push_back<Sequence const, T>::type
push_back(Sequence const& seq, T const& x);
template <typename Sequence, typename T>
typename result_of::push_front<Sequence const, T>::type
push_front(Sequence const& seq, T const& x);
}}
namespace boost { namespace fusion { namespace detail

View File

@ -1,7 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#include <boost/detail/lightweight_test.hpp>

View File

@ -72,6 +72,8 @@ struct fobj
int operator()(int i, object &, object_nc &) { return 10 + i; }
int operator()(int i, object &, object_nc &) const { return 11 + i; }
int operator()(int i, object const &, object_nc &);
int operator()(int i, object const &, object_nc &) const;
};
struct nullary_fobj

View File

@ -75,6 +75,8 @@ struct fobj
int operator()(int i, object &, object_nc &) { return 10 + i; }
int operator()(int i, object &, object_nc &) const { return 11 + i; }
int operator()(int i, object const &, object_nc &);
int operator()(int i, object const &, object_nc &) const;
};
struct nullary_fobj

View File

@ -71,7 +71,7 @@ void result_type_tests()
typedef fusion::unfused< test_func<> > t;
BOOST_TEST(( is_same< boost::result_of< t () >::type, long >::value ));
BOOST_TEST(( is_same< boost::result_of< t (int) >::type, long >::value ));
BOOST_TEST(( is_same< boost::result_of< t (int &) >::type, long >::value ));
}
int main()

View File

@ -85,7 +85,7 @@ void result_type_tests()
typedef fusion::unfused_typed< test_func<>, types0 > t0;
BOOST_TEST(( is_same< boost::result_of< t0 () >::type, long >::value ));
typedef fusion::unfused_typed< test_func<>, types1 > t1;
BOOST_TEST(( is_same< boost::result_of< t1 (int) >::type, long >::value ));
BOOST_TEST(( is_same< boost::result_of< t1 (long &) >::type, long >::value ));
}
#if defined(BOOST_MSVC) && BOOST_MSVC < 1400

View File

@ -1,7 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#include <string>
@ -113,7 +113,7 @@ void test()
BOOST_TEST(*next(next(next(i))) == s);
next(next(next(next(i)))); // end
#ifdef FUSION_TEST_FAIL
next(next(next(next(next(i))))); // past the end: must not compile
#endif

View File

@ -1,7 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#include <boost/detail/lightweight_test.hpp>
@ -20,6 +20,8 @@
#include <boost/fusion/support/category_of.hpp>
#include <boost/static_assert.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/at.hpp>
#include <boost/typeof/typeof.hpp>
#include <iostream>
#include <string>
@ -39,18 +41,19 @@ main()
{
typedef map<
pair<int, char>
, pair<double, std::string> >
, pair<double, std::string> >
map_type;
BOOST_MPL_ASSERT((traits::is_associative<map_type>));
BOOST_MPL_ASSERT((traits::is_random_access<map_type>));
map_type m(
make_pair<int>('X')
, make_pair<double>("Men"));
std::cout << at_key<int>(m) << std::endl;
std::cout << at_key<double>(m) << std::endl;
BOOST_TEST(at_key<int>(m) == 'X');
BOOST_TEST(at_key<double>(m) == "Men");
@ -58,7 +61,7 @@ main()
boost::is_same<boost::fusion::result_of::value_at_key<map_type, int>::type, char>::value));
BOOST_STATIC_ASSERT((
boost::is_same<boost::fusion::result_of::value_at_key<map_type, double>::type, std::string>::value));
std::cout << m << std::endl;
BOOST_STATIC_ASSERT((boost::fusion::result_of::has_key<map_type, int>::value));
@ -75,8 +78,43 @@ main()
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::key_of<boost::fusion::result_of::next<boost::fusion::result_of::begin<map_type>::type>::type>::type, double>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::begin<map_type>::type>::type, char>::value));
BOOST_STATIC_ASSERT((boost::is_same<boost::fusion::result_of::value_of_data<boost::fusion::result_of::next<boost::fusion::result_of::begin<map_type>::type>::type>::type, std::string>::value));
//! Test random access interface.
pair<int, char> a = at_c<0>(m);
pair<double, std::string> b = at_c<1>(m);
}
//! iterators & random access interface.
{
typedef pair<boost::mpl::int_<0>, std::string> pair0;
typedef pair<boost::mpl::int_<1>, std::string> pair1;
typedef pair<boost::mpl::int_<2>, std::string> pair2;
typedef pair<boost::mpl::int_<3>, std::string> pair3;
typedef pair<boost::mpl::int_<4>, std::string> pair4;
typedef map< pair0, pair1, pair2, pair3, pair4 > map_type;
map_type m( pair0("zero"), pair1("one"), pair2("two"), pair3("three"), pair4("four") );
BOOST_AUTO( it0, begin(m) );
BOOST_TEST((deref(it0) == pair0("zero")));
BOOST_AUTO( it1, fusion::next(it0) );
BOOST_TEST((deref(it1) == pair1("one")));
BOOST_AUTO( it2, fusion::next(it1) );
BOOST_TEST((deref(it2) == pair2("two")));
BOOST_AUTO( it3, fusion::next(it2) );
BOOST_TEST((deref(it3) == pair3("three")));
BOOST_AUTO( it4, fusion::next(it3) );
BOOST_TEST((deref(it4) == pair4("four")));
BOOST_TEST((deref(fusion::advance_c<4>(it0)) == deref(it4)));
//! Bi-directional
BOOST_TEST((deref(fusion::prior(it4)) == deref(it3) ));
BOOST_TEST((deref(fusion::prior(it3)) == deref(it2) ));
BOOST_TEST((deref(fusion::prior(it2)) == deref(it1) ));
BOOST_TEST((deref(fusion::prior(it1)) == deref(it0) ));
}
{
std::cout << make_map<char, int>('X', 123) << std::endl;
BOOST_TEST(at_key<char>(make_map<char, int>('X', 123)) == 'X');

View File

@ -6,6 +6,7 @@
==============================================================================*/
#include <boost/detail/lightweight_test.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/container/map/map.hpp>
#include <boost/fusion/adapted/mpl.hpp>
#include <boost/fusion/sequence/io/out.hpp>
#include <boost/fusion/container/generation/make_vector.hpp>
@ -82,6 +83,27 @@ main()
));
}
//! Map
{
typedef pair<boost::mpl::int_<0>, std::string> pair0;
typedef pair<boost::mpl::int_<1>, std::string> pair1;
typedef pair<boost::mpl::int_<2>, std::string> pair2;
typedef pair<boost::mpl::int_<3>, std::string> pair3;
typedef pair<boost::mpl::int_<4>, std::string> pair4;
typedef map< pair0, pair1, pair2, pair3, pair4 > map_type;
map_type m( pair0("zero"), pair1("one"), pair2("two"), pair3("three"), pair4("four") );
typedef reverse_view<map_type> view_type;
view_type rev(m);
std::cout << rev << std::endl;
BOOST_TEST((rev == make_vector( pair4("four"), pair3("three"), pair2("two"), pair1("one"), pair0("zero"))));
BOOST_TEST((at_c<0>(rev) == pair4("four")));
BOOST_TEST((at_c<1>(rev) == pair3("three")));
BOOST_TEST((at_c<2>(rev) == pair2("two")));
BOOST_TEST((at_c<3>(rev) == pair1("one")));
BOOST_TEST((at_c<4>(rev) == pair0("zero")));
}
return boost::report_errors();
}

View File

@ -2,7 +2,7 @@
Copyright (c) 1999-2003 Jaakko Jarvi
Copyright (c) 2001-2011 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#include <boost/fusion/tuple.hpp>

View File

@ -1,7 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#include <boost/fusion/container/vector/vector.hpp>