Merge pull request #34 from Flast/develop

Misc...
This commit is contained in:
Joel de Guzman
2014-11-09 07:26:20 +08:00
22 changed files with 95 additions and 82 deletions

View File

@ -536,13 +536,13 @@ Finds the first element of a given type within a sequence.
typename T, typename T,
typename Sequence typename Sequence
> >
__unspecified__ find(Sequence const& seq); typename __result_of_find__<Sequence const, T>::type find(Sequence const& seq);
template< template<
typename T, typename T,
typename Sequence typename Sequence
> >
__unspecified__ find(Sequence& seq); typename __result_of_find__<Sequence, T>::type find(Sequence& seq);
[table Parameters [table Parameters
[[Parameter][Requirement][Description]] [[Parameter][Requirement][Description]]
@ -574,23 +574,23 @@ Linear. At most `__result_of_size__<Sequence>::value` comparisons.
[endsect] [endsect]
[section find_if] [section find_if]
Finds the first element within a sequence with a type for which a given __mpl_lambda_expression__ evaluates to
`boost::mpl::true_`.
[heading Description] [heading Description]
Finds the first element within a sequence with a type for which a given __mpl_lambda_expression__ evaluates to
`boost::mpl::true_`.
[heading Synopsis] [heading Synopsis]
template< template<
typename F, typename F,
typename Sequence typename Sequence
> >
__unspecified__ find_if(Sequence const& seq); typename __result_of_find_if__<Sequence const, F>::type find_if(Sequence const& seq);
template< template<
typename F, typename F,
typename Sequence typename Sequence
> >
__unspecified__ find_if(Sequence& seq); typename __result_of_find_if__<Sequence, F>::type find_if(Sequence& seq);
[table Parameters [table Parameters
[[Parameter][Requirement][Description]] [[Parameter][Requirement][Description]]

View File

@ -42,12 +42,18 @@ namespace boost { namespace fusion
struct boost_tuple_is_empty<tuples::tuple<> const> : mpl::true_ {}; struct boost_tuple_is_empty<tuples::tuple<> const> : mpl::true_ {};
} }
template <typename Cons>
struct boost_tuple_iterator_identity;
template <typename Cons = tuples::null_type> template <typename Cons = tuples::null_type>
struct boost_tuple_iterator struct boost_tuple_iterator
: iterator_facade<boost_tuple_iterator<Cons>, forward_traversal_tag> : iterator_facade<boost_tuple_iterator<Cons>, forward_traversal_tag>
{ {
typedef Cons cons_type; typedef Cons cons_type;
typedef boost_tuple_iterator_identity<
typename add_const<Cons>::type> identity;
BOOST_FUSION_GPU_ENABLED BOOST_FUSION_GPU_ENABLED
explicit boost_tuple_iterator(Cons& in_cons) explicit boost_tuple_iterator(Cons& in_cons)
: cons(in_cons) {} : cons(in_cons) {}
@ -98,7 +104,7 @@ namespace boost { namespace fusion
return type(iter.cons.get_tail()); return type(iter.cons.get_tail());
} }
}; };
template <typename I1, typename I2> template <typename I1, typename I2>
struct distance; struct distance;
@ -115,7 +121,7 @@ namespace boost { namespace fusion
>::type >::type
>::type type; >::type type;
}; };
template <typename I1, typename I2> template <typename I1, typename I2>
struct distance struct distance
{ {
@ -124,7 +130,7 @@ namespace boost { namespace fusion
mpl::int_<0>, mpl::int_<0>,
lazy_next_distance<I1, I2> lazy_next_distance<I1, I2>
>::type type; >::type type;
BOOST_FUSION_GPU_ENABLED BOOST_FUSION_GPU_ENABLED
static type static type
call(I1 const&, I2 const&) call(I1 const&, I2 const&)
@ -133,6 +139,11 @@ namespace boost { namespace fusion
} }
}; };
template <typename I1, typename I2>
struct equal_to
: is_same<typename I1::identity, typename I2::identity>
{};
private: private:
// silence MSVC warning C4512: assignment operator could not be generated // silence MSVC warning C4512: assignment operator could not be generated
boost_tuple_iterator& operator= (boost_tuple_iterator const&); boost_tuple_iterator& operator= (boost_tuple_iterator const&);
@ -144,6 +155,9 @@ namespace boost { namespace fusion
{ {
typedef Null cons_type; typedef Null cons_type;
typedef boost_tuple_iterator_identity<
typename add_const<Null>::type> identity;
template <typename I1, typename I2> template <typename I1, typename I2>
struct equal_to struct equal_to
: mpl::or_< : mpl::or_<

View File

@ -16,7 +16,7 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/type_traits/ice.hpp> #include <boost/mpl/and.hpp>
#if defined (BOOST_MSVC) #if defined (BOOST_MSVC)
# pragma warning(push) # pragma warning(push)
@ -62,15 +62,10 @@ namespace boost { namespace fusion
template <typename Seq1, typename Seq2> template <typename Seq1, typename Seq2>
BOOST_FUSION_GPU_ENABLED BOOST_FUSION_GPU_ENABLED
inline inline typename enable_if<mpl::and_<
typename traits::is_sequence<Seq1>,
enable_if_c< traits::is_sequence<Seq2>
type_traits::ice_and< > >::type
traits::is_sequence<Seq1>::value
, traits::is_sequence<Seq2>::value
>::value,
void
>::type
copy(Seq1 const& src, Seq2& dest) copy(Seq1 const& src, Seq2& dest)
{ {
BOOST_STATIC_ASSERT( BOOST_STATIC_ASSERT(

View File

@ -16,7 +16,7 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/type_traits/ice.hpp> #include <boost/mpl/and_.hpp>
#if defined (BOOST_MSVC) #if defined (BOOST_MSVC)
# pragma warning(push) # pragma warning(push)
@ -62,15 +62,10 @@ namespace boost { namespace fusion
template <typename Seq1, typename Seq2> template <typename Seq1, typename Seq2>
BOOST_FUSION_GPU_ENABLED BOOST_FUSION_GPU_ENABLED
inline inline typename enable_if<mpl::and_<
typename traits::is_sequence<Seq1>,
enable_if_c< traits::is_sequence<Seq2>
type_traits::ice_and< > >::type
traits::is_sequence<Seq1>::value
, traits::is_sequence<Seq2>::value
>::value,
void
>::type
move(Seq1&& src, Seq2& dest) move(Seq1&& src, Seq2& dest)
{ {
BOOST_STATIC_ASSERT( BOOST_STATIC_ASSERT(

View File

@ -1,14 +0,0 @@
/*=============================================================================
Copyright (c) 2010 Christopher Schmidt
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef BOOST_FUSION_INCLUDE_ADAPT_ASSOC_CLASS_NAMED_HPP
#define BOOST_FUSION_INCLUDE_ADAPT_ASSOC_CLASS_NAMED_HPP
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/adapted/class/adapt_assoc_class_named.hpp>
#endif

View File

@ -132,7 +132,7 @@ namespace boost { namespace fusion
{} {}
template<typename OtherSeq> template<typename OtherSeq>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
basic_iterator& basic_iterator&
operator=(basic_iterator<Tag,Category,OtherSeq,Index> const& it) operator=(basic_iterator<Tag,Category,OtherSeq,Index> const& it)
{ {

View File

@ -8,14 +8,21 @@
#define FUSION_ITERATOR_ADAPTER_08112011_0942 #define FUSION_ITERATOR_ADAPTER_08112011_0942
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/fusion/iterator/detail/advance.hpp> #include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/iterator/advance.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/distance.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/iterator/iterator_facade.hpp> #include <boost/fusion/iterator/iterator_facade.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/prior.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/type_traits/remove_const.hpp> #include <boost/type_traits/remove_const.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
template <typename Derived_, typename Iterator_, template <typename Derived_, typename Iterator_,
typename Category = typename Iterator_::category> typename Category = typename traits::category_of<Iterator_>::type>
struct iterator_adapter struct iterator_adapter
: iterator_facade<Derived_, Category> : iterator_facade<Derived_, Category>
{ {

View File

@ -14,6 +14,7 @@
#include <boost/fusion/support/category_of.hpp> #include <boost/fusion/support/category_of.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/mpl/assert.hpp> #include <boost/mpl/assert.hpp>
#include <boost/mpl/if.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {

View File

@ -8,8 +8,8 @@
#define FUSION_BEGIN_04052005_1132 #define FUSION_BEGIN_04052005_1132
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/blank.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/mpl/empty_base.hpp>
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp> #include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/support/tag_of.hpp> #include <boost/fusion/support/tag_of.hpp>
@ -36,7 +36,7 @@ namespace boost { namespace fusion
: mpl::if_< : mpl::if_<
traits::is_segmented<Sequence> traits::is_segmented<Sequence>
, detail::segmented_begin<Sequence> , detail::segmented_begin<Sequence>
, blank , mpl::empty_base
>::type >::type
{}; {};
}; };

View File

@ -48,11 +48,18 @@ namespace boost { namespace fusion { namespace detail
typedef iterator_range<end_type, end_type> pair_type; typedef iterator_range<end_type, end_type> pair_type;
typedef cons<pair_type, Stack> type; typedef cons<pair_type, Stack> type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static pair_type make_pair(end_type end)
{
return pair_type(end, end);
}
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type call(Sequence & seq, Stack stack) static type call(Sequence & seq, Stack stack)
{ {
end_type end = fusion::end(fusion::segments(seq)); return type(
return type(pair_type(end, end), stack); make_pair(fusion::end(fusion::segments(seq))),
stack);
} }
}; };

View File

@ -8,8 +8,8 @@
#define FUSION_END_04052005_1141 #define FUSION_END_04052005_1141
#include <boost/fusion/support/config.hpp> #include <boost/fusion/support/config.hpp>
#include <boost/blank.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/mpl/empty_base.hpp>
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp> #include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/support/tag_of.hpp> #include <boost/fusion/support/tag_of.hpp>
@ -36,7 +36,7 @@ namespace boost { namespace fusion
: mpl::if_< : mpl::if_<
traits::is_segmented<Sequence> traits::is_segmented<Sequence>
, detail::segmented_end<Sequence> , detail::segmented_end<Sequence>
, blank , mpl::empty_base
>::type >::type
{}; {};
}; };

View File

@ -60,6 +60,7 @@ project
[ run sequence/as_set.cpp : : : : ] [ run sequence/as_set.cpp : : : : ]
[ run sequence/as_vector.cpp : : : : ] [ run sequence/as_vector.cpp : : : : ]
[ run sequence/boost_tuple.cpp : : : : ] [ run sequence/boost_tuple.cpp : : : : ]
[ run sequence/boost_tuple_iterator.cpp : : : : ]
[ run sequence/cons.cpp : : : : ] [ run sequence/cons.cpp : : : : ]
[ run sequence/filter_view.cpp : : : : ] [ run sequence/filter_view.cpp : : : : ]
[ run sequence/hash.cpp : : : : ] [ run sequence/hash.cpp : : : : ]

View File

@ -10,18 +10,18 @@
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/blank.hpp>
#include <boost/fusion/container/generation/make_vector.hpp> #include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/container/vector.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/mpl/assert.hpp> #include <boost/mpl/assert.hpp>
#include <boost/mpl/empty_base.hpp>
namespace fusion = boost::fusion; namespace fusion = boost::fusion;
using boost::noncopyable; using boost::noncopyable;
template <class Base = boost::blank> template <class Base = boost::mpl::empty_base>
struct test_func struct test_func
: Base : Base
{ {

View File

@ -10,7 +10,7 @@
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/blank.hpp> #include <boost/mpl/empty_base.hpp>
#include <boost/fusion/container/generation/make_vector.hpp> #include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/container/vector.hpp>
@ -18,7 +18,7 @@
namespace fusion = boost::fusion; namespace fusion = boost::fusion;
using boost::noncopyable; using boost::noncopyable;
template <class Base = boost::blank> template <class Base = boost::mpl::empty_base>
struct test_func struct test_func
: Base : Base
{ {

View File

@ -10,7 +10,7 @@
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/blank.hpp> #include <boost/mpl/empty_base.hpp>
#include <boost/fusion/container/generation/make_vector.hpp> #include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/container/vector.hpp>
@ -26,7 +26,7 @@ int effect;
BOOST_TEST(effect == e); \ BOOST_TEST(effect == e); \
} }
template <class Base = boost::blank> template <class Base = boost::mpl::empty_base>
struct test_func struct test_func
: Base : Base
{ {

View File

@ -10,7 +10,7 @@
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/blank.hpp> #include <boost/mpl/empty_base.hpp>
#include <boost/fusion/container/generation/make_vector.hpp> #include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/container/vector.hpp>
@ -20,7 +20,7 @@ using boost::noncopyable;
using boost::cref; using boost::cref;
using boost::ref; using boost::ref;
template <class Base = boost::blank> template <class Base = boost::mpl::empty_base>
struct test_func struct test_func
: Base : Base
{ {

View File

@ -10,7 +10,7 @@
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/blank.hpp> #include <boost/mpl/empty_base.hpp>
#include <boost/fusion/container/generation/make_vector.hpp> #include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/container/vector.hpp>
@ -20,7 +20,7 @@ using boost::noncopyable;
using boost::cref; using boost::cref;
using boost::ref; using boost::ref;
template <class Base = boost::blank> template <class Base = boost::mpl::empty_base>
struct test_func struct test_func
: Base : Base
{ {

View File

@ -10,7 +10,7 @@
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/blank.hpp> #include <boost/mpl/empty_base.hpp>
#include <boost/fusion/container/generation/make_vector.hpp> #include <boost/fusion/container/generation/make_vector.hpp>
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/container/vector.hpp>
@ -28,7 +28,7 @@ int effect;
BOOST_TEST(effect == e); \ BOOST_TEST(effect == e); \
} }
template <class Base = boost::blank> template <class Base = boost::mpl::empty_base>
struct test_func struct test_func
: Base : Base
{ {

View File

@ -10,14 +10,15 @@
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/blank.hpp>
#include <boost/mpl/empty_base.hpp>
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
#include <boost/mpl/and.hpp> #include <boost/mpl/and.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/bool.hpp> #include <boost/mpl/bool.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/utility/result_of.hpp> #include <boost/utility/result_of.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/fusion/sequence/intrinsic/empty.hpp> #include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/algorithm/iteration/fold.hpp> #include <boost/fusion/algorithm/iteration/fold.hpp>
@ -33,17 +34,18 @@ typedef mpl::true_ no_nullary_call;
using boost::ref; using boost::ref;
using boost::cref; using boost::cref;
template <class Base = boost::blank, class RemoveNullary = mpl::false_> template <class Base = mpl::empty_base, class RemoveNullary = mpl::false_>
struct test_func struct test_func
: Base : Base
{ {
template <typename Sig> template <typename Sig>
struct result; struct result;
template <class Self, class Seq> template <class Self, class Seq>
struct result< Self(Seq &) > struct result< Self(Seq &) >
: mpl::if_< mpl::and_< boost::fusion::result_of::empty<Seq>, RemoveNullary >, : boost::enable_if<
boost::blank, mpl::identity<long> >::type mpl::not_<mpl::and_<boost::fusion::result_of::empty<Seq>, RemoveNullary> >,
long>
{ }; { };
template <typename Seq> template <typename Seq>

View File

@ -10,8 +10,8 @@
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/blank.hpp>
#include <boost/mpl/empty_base.hpp>
#include <boost/mpl/identity.hpp> #include <boost/mpl/identity.hpp>
#include <boost/utility/result_of.hpp> #include <boost/utility/result_of.hpp>
@ -24,7 +24,7 @@ namespace mpl = boost::mpl;
using boost::noncopyable; using boost::noncopyable;
template <class Base = boost::blank> template <class Base = boost::mpl::empty_base>
struct test_func struct test_func
: Base : Base
{ {

View File

@ -9,11 +9,9 @@
#include <boost/fusion/functional/adapter/unfused_typed.hpp> #include <boost/fusion/functional/adapter/unfused_typed.hpp>
#include <boost/detail/lightweight_test.hpp> #include <boost/detail/lightweight_test.hpp>
#include <boost/blank.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/utility/result_of.hpp> #include <boost/mpl/empty_base.hpp>
#include <boost/mpl/identity.hpp> #include <boost/mpl/identity.hpp>
#include <boost/mpl/placeholders.hpp> #include <boost/mpl/placeholders.hpp>
@ -31,7 +29,7 @@ typedef fusion::vector<> types0;
typedef fusion::vector<long &> types1; typedef fusion::vector<long &> types1;
typedef fusion::vector<long &,int,char> types3; typedef fusion::vector<long &,int,char> types3;
template <class Base = boost::blank> template <class Base = boost::mpl::empty_base>
struct test_func struct test_func
: Base : Base
{ {

View File

@ -1,14 +1,21 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2010 Christopher Schmidt Copyright (c) 2014 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)
==============================================================================*/ ==============================================================================*/
#ifndef BOOST_FUSION_INCLUDE_ADAPT_ASSOC_CLASS_HPP #include <boost/fusion/adapted/boost_tuple.hpp>
#define BOOST_FUSION_INCLUDE_ADAPT_ASSOC_CLASS_HPP
#include <boost/fusion/support/config.hpp> #define FUSION_SEQUENCE boost::tuple
#include <boost/fusion/adapted/class/adapt_assoc_class.hpp> #define FUSION_TRAVERSAL_TAG forward_traversal_tag
#define FUSION_NO_PRIOR
#include "./iterator.hpp"
int
main()
{
test();
return boost::report_errors();
}
#endif