Merge pull request #188 from boostorg/develop

Post beta merge
This commit is contained in:
Kohei Takahashi
2018-07-17 21:12:08 +09:00
committed by GitHub
10 changed files with 100 additions and 90 deletions

View File

@ -23,19 +23,6 @@ various data structures, non-intrusively, as full fledged Fusion sequences.
#include <boost/fusion/adapted.hpp> #include <boost/fusion/adapted.hpp>
#include <boost/fusion/include/adapted.hpp> #include <boost/fusion/include/adapted.hpp>
Fusion sequences may also be adapted as fully conforming __mpl__ sequences (see
__intrinsics__). That way, we can have 2-way adaptation to and from __mpl__ and
Fusion. To make Fusion sequences fully conforming __mpl__ sequences, include:
#include <boost/fusion/mpl.hpp>
If you want bi-directional adaptation to and from __mpl__ and Fusion, simply
include:
#include <boost/fusion/include/mpl.hpp>
The header includes all the necessary headers.
[section:array Array] [section:array Array]
This module provides adapters for arrays. Including the module This module provides adapters for arrays. Including the module
@ -145,6 +132,21 @@ header makes all __mpl__ sequences fully conforming fusion sequences.
std::cout << __at_c__<0>(v) << std::endl; std::cout << __at_c__<0>(v) << std::endl;
std::cout << __at_c__<1>(v) << std::endl; std::cout << __at_c__<1>(v) << std::endl;
[heading Bi-directional adaptation]
Fusion sequences may also be adapted as fully conforming __mpl__ sequences (see
__intrinsics__). That way, we can have 2-way adaptation to and from __mpl__ and
Fusion. To make Fusion sequences fully conforming __mpl__ sequences, include:
#include <boost/fusion/mpl.hpp>
If you want bi-directional adaptation to and from __mpl__ and Fusion, simply
include:
#include <boost/fusion/include/mpl.hpp>
The header includes all the necessary headers.
[heading See also] [heading See also]
__mpl__ __mpl__

View File

@ -1522,6 +1522,16 @@ each element. Analogously, the global `operator>>` has been overloaded
to extract __sequence__(s) from generic input streams by recursively to extract __sequence__(s) from generic input streams by recursively
calling `operator>>` for each element. calling `operator>>` for each element.
Please note that, to display your adapted types via fusion IO system,
corresponding overloaded operators should be introduced to same namespace
of the type.
namespace your_awesome_library
{
using boost::fusion::operators::operator>>; // for input
using boost::fusion::operators::operator<<; // for output
...
The default delimiter between the elements is space, and the __sequence__ The default delimiter between the elements is space, and the __sequence__
is enclosed in parenthesis. For Example: is enclosed in parenthesis. For Example:

View File

@ -93,10 +93,9 @@ presents only those elements for which its predicate evaluates to
[heading Template parameters] [heading Template parameters]
[table [table
[[Parameter] [Description] [Default]] [[Parameter] [Description] [Default]]
[[`Sequence`] [A __forward_sequence__] []] [[`Sequence`] [A __forward_sequence__] []]
[[`Pred`] [Unary Metafunction [[`Pred`] [A unary __mpl_lambda_expression__] []]
returning an `mpl::bool_`] []]
] ]
[heading Model of] [heading Model of]
@ -271,7 +270,7 @@ defined in the implemented models.
[heading Description] [heading Description]
`zip_view` presents a view which iterates over a collection of __sequence__(s) in parallel. A `zip_view` `zip_view` presents a view which iterates over a collection of __sequence__(s) in parallel. A `zip_view`
is constructed from a __sequence__ of references to the component __sequence__s. is constructed from a __sequence__ of references to the component `__sequence__`s.
[heading Header] [heading Header]
@ -287,7 +286,7 @@ is constructed from a __sequence__ of references to the component __sequence__s.
[table [table
[[Parameter] [Description] [Default]] [[Parameter] [Description] [Default]]
[[`Sequences`] [A __forward_sequence__ of references to other Fusion __sequence__s] []] [[`Sequences`] [A __forward_sequence__ of references to other Fusion `__sequence__`s] []]
] ]
[heading Model of] [heading Model of]
@ -309,7 +308,7 @@ defined in __forward_sequence__.
[table [table
[[Expression] [Semantics]] [[Expression] [Semantics]]
[[`ZV(s)`] [Creates a `zip_view` given a sequence of references to the component __sequence__s.]] [[`ZV(s)`] [Creates a `zip_view` given a sequence of references to the component `__sequence__`s.]]
[[`ZV(zv1)`] [Copy constructs a `zip_view` from another `zip_view`, `zv`.]] [[`ZV(zv1)`] [Copy constructs a `zip_view` from another `zip_view`, `zv`.]]
[[`zv1 = zv2`] [Assigns to a `zip_view`, `zv`, from another `zip_view`, `zv2`.]] [[`zv1 = zv2`] [Assigns to a `zip_view`, `zv`, from another `zip_view`, `zv2`.]]
] ]

View File

@ -1,38 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2007 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_APPLY_TRANSFORM_RESULT_02092006_1936)
#define BOOST_FUSION_APPLY_TRANSFORM_RESULT_02092006_1936
#include <boost/fusion/support/config.hpp>
#include <boost/utility/result_of.hpp>
namespace boost { namespace fusion
{
struct void_;
namespace detail
{
template <typename F>
struct apply_transform_result
{
template <typename T0, typename T1 = void_>
struct apply
: boost::result_of<F(T0, T1)>
{};
template <typename T0>
struct apply<T0, void_>
: boost::result_of<F(T0)>
{};
};
}
}}
#endif

View File

@ -1,6 +1,7 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2018 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -9,9 +10,8 @@
#define BOOST_FUSION_AT_IMPL_20061029_1946 #define BOOST_FUSION_AT_IMPL_20061029_1946
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/fusion/view/transform_view/detail/apply_transform_result.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp> #include <boost/fusion/sequence/intrinsic/at.hpp>
#include <boost/utility/result_of.hpp>
namespace boost { namespace fusion { namespace boost { namespace fusion {
struct transform_view_tag; struct transform_view_tag;
@ -29,9 +29,8 @@ namespace boost { namespace fusion {
struct apply struct apply
{ {
typedef typename Seq::transform_type F; typedef typename Seq::transform_type F;
typedef detail::apply_transform_result<F> transform_type; typedef typename result_of::at<typename Seq::sequence_type, N>::type value_type;
typedef typename boost::fusion::result_of::at<typename Seq::sequence_type, N>::type value_type; typedef typename boost::result_of<F(value_type)>::type type;
typedef typename mpl::apply<transform_type, value_type>::type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Seq& seq) static type call(Seq& seq)
@ -48,10 +47,9 @@ namespace boost { namespace fusion {
struct apply struct apply
{ {
typedef typename Seq::transform_type F; typedef typename Seq::transform_type F;
typedef detail::apply_transform_result<F> transform_type; typedef typename result_of::at<typename Seq::sequence1_type, N>::type value1_type;
typedef typename boost::fusion::result_of::at<typename Seq::sequence1_type, N>::type value1_type; typedef typename result_of::at<typename Seq::sequence2_type, N>::type value2_type;
typedef typename boost::fusion::result_of::at<typename Seq::sequence2_type, N>::type value2_type; typedef typename boost::result_of<F(value1_type, value2_type)>::type type;
typedef typename mpl::apply<transform_type, value1_type, value2_type>::type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Seq& seq) static type call(Seq& seq)

View File

@ -1,5 +1,6 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2018 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -8,10 +9,8 @@
#define FUSION_DEREF_IMPL_07162005_1026 #define FUSION_DEREF_IMPL_07162005_1026
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/fusion/iterator/deref.hpp> #include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/value_of.hpp> #include <boost/utility/result_of.hpp>
#include <boost/fusion/view/transform_view/detail/apply_transform_result.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -34,8 +33,8 @@ namespace boost { namespace fusion
result_of::deref<typename Iterator::first_type>::type result_of::deref<typename Iterator::first_type>::type
value_type; value_type;
typedef detail::apply_transform_result<typename Iterator::transform_type> transform_type; typedef typename Iterator::transform_type F;
typedef typename mpl::apply<transform_type, value_type>::type type; typedef typename boost::result_of<F(value_type)>::type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type static type
@ -60,8 +59,8 @@ namespace boost { namespace fusion
result_of::deref<typename Iterator::first2_type>::type result_of::deref<typename Iterator::first2_type>::type
value2_type; value2_type;
typedef detail::apply_transform_result<typename Iterator::transform_type> transform_type; typedef typename Iterator::transform_type F;
typedef typename mpl::apply<transform_type, value1_type, value2_type>::type type; typedef typename boost::result_of<F(value1_type, value2_type)>::type type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type static type
@ -70,7 +69,7 @@ namespace boost { namespace fusion
return i.f(*i.first1, *i.first2); return i.f(*i.first1, *i.first2);
} }
}; };
}; };
} }
}} }}

View File

@ -1,6 +1,7 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden Copyright (c) 2005-2006 Dan Marsden
Copyright (c) 2018 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -9,9 +10,8 @@
#define BOOST_FUSION_VALUE_AT_IMPL_20061101_0745 #define BOOST_FUSION_VALUE_AT_IMPL_20061101_0745
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/fusion/view/transform_view/detail/apply_transform_result.hpp>
#include <boost/fusion/sequence/intrinsic/value_at.hpp> #include <boost/fusion/sequence/intrinsic/value_at.hpp>
#include <boost/utility/result_of.hpp>
namespace boost { namespace fusion { namespace boost { namespace fusion {
struct transform_view_tag; struct transform_view_tag;
@ -29,9 +29,8 @@ namespace boost { namespace fusion {
struct apply struct apply
{ {
typedef typename Seq::transform_type F; typedef typename Seq::transform_type F;
typedef detail::apply_transform_result<F> transform_type; typedef typename result_of::value_at<typename Seq::sequence_type, N>::type value_type;
typedef typename boost::fusion::result_of::value_at<typename Seq::sequence_type, N>::type value_type; typedef typename boost::result_of<F(value_type)>::type type;
typedef typename mpl::apply<transform_type, value_type>::type type;
}; };
}; };
@ -42,10 +41,9 @@ namespace boost { namespace fusion {
struct apply struct apply
{ {
typedef typename Seq::transform_type F; typedef typename Seq::transform_type F;
typedef detail::apply_transform_result<F> transform_type; typedef typename result_of::value_at<typename Seq::sequence1_type, N>::type value1_type;
typedef typename boost::fusion::result_of::value_at<typename Seq::sequence1_type, N>::type value1_type; typedef typename result_of::value_at<typename Seq::sequence2_type, N>::type value2_type;
typedef typename boost::fusion::result_of::value_at<typename Seq::sequence2_type, N>::type value2_type; typedef typename boost::result_of<F(value1_type, value2_type)>::type type;
typedef typename mpl::apply<transform_type, value1_type, value2_type>::type type;
}; };
}; };
} }

View File

@ -1,5 +1,6 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2018 Kohei Takahashi
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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -8,9 +9,8 @@
#define FUSION_VALUE_OF_IMPL_07162005_1030 #define FUSION_VALUE_OF_IMPL_07162005_1030
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/fusion/iterator/value_of.hpp> #include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/view/transform_view/detail/apply_transform_result.hpp> #include <boost/utility/result_of.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -33,8 +33,8 @@ namespace boost { namespace fusion
result_of::value_of<typename Iterator::first_type>::type result_of::value_of<typename Iterator::first_type>::type
value_type; value_type;
typedef detail::apply_transform_result<typename Iterator::transform_type> transform_type; typedef typename Iterator::transform_type F;
typedef typename mpl::apply<transform_type, value_type>::type type; typedef typename boost::result_of<F(value_type)>::type type;
}; };
}; };
@ -52,8 +52,8 @@ namespace boost { namespace fusion
result_of::value_of<typename Iterator::first2_type>::type result_of::value_of<typename Iterator::first2_type>::type
value2_type; value2_type;
typedef detail::apply_transform_result<typename Iterator::transform_type> transform_type; typedef typename Iterator::transform_type F;
typedef typename mpl::apply<transform_type, value1_type, value2_type>::type type; typedef typename boost::result_of<F(value1_type, value2_type)>::type type;
}; };
}; };
} }

View File

@ -66,6 +66,7 @@ project
[ run algorithm/zip2.cpp ] [ run algorithm/zip2.cpp ]
[ run algorithm/zip_ignore.cpp ] [ run algorithm/zip_ignore.cpp ]
[ run algorithm/flatten.cpp ] [ run algorithm/flatten.cpp ]
[ compile algorithm/ticket-5490.cpp ]
[ run sequence/as_deque.cpp ] [ run sequence/as_deque.cpp ]
[ run sequence/as_list.cpp ] [ run sequence/as_list.cpp ]

View File

@ -0,0 +1,41 @@
/*=============================================================================
Copyright (c) 2018 Kohei Takahashi
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/include/vector.hpp>
#include <boost/fusion/include/transform.hpp>
#include <boost/mpl/quote.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/core/ignore_unused.hpp>
using namespace boost::fusion;
template <typename>
struct predicate {};
struct unique {};
template <typename>
struct meta_func
{
typedef unique result_type;
template <typename T>
unique operator()(const T&) const;
};
int main()
{
vector<int> v;
typedef predicate<boost::mpl::_1> lambda_t;
typedef boost::mpl::quote1<predicate> quote_t;
vector<unique> l = transform(v, meta_func<lambda_t>());
vector<unique> q = transform(v, meta_func<quote_t>());
boost::ignore_unused(l, q);
}