forked from boostorg/fusion
Quickbook: Merge from trunk to quickbook-dev
[SVN r75739]
This commit is contained in:
@ -36,7 +36,7 @@ namespace boost { namespace fusion
|
||||
: vec(rhs.vec) {}
|
||||
template <typename Sequence>
|
||||
vector(Sequence const& rhs)
|
||||
: vec(rhs) {}
|
||||
: vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
|
||||
|
||||
|
||||
|
||||
@ -116,6 +116,7 @@ namespace boost { namespace fusion
|
||||
return vec.at_impl(mpl::int_<I::value>());
|
||||
}
|
||||
private:
|
||||
BOOST_FUSION_VECTOR_CTOR_HELPER()
|
||||
vector_n vec;
|
||||
};
|
||||
}}
|
||||
|
@ -36,7 +36,7 @@ namespace boost { namespace fusion
|
||||
: vec(rhs.vec) {}
|
||||
template <typename Sequence>
|
||||
vector(Sequence const& rhs)
|
||||
: vec(rhs) {}
|
||||
: vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
|
||||
|
||||
|
||||
|
||||
@ -136,6 +136,7 @@ namespace boost { namespace fusion
|
||||
return vec.at_impl(mpl::int_<I::value>());
|
||||
}
|
||||
private:
|
||||
BOOST_FUSION_VECTOR_CTOR_HELPER()
|
||||
vector_n vec;
|
||||
};
|
||||
}}
|
||||
|
@ -36,7 +36,7 @@ namespace boost { namespace fusion
|
||||
: vec(rhs.vec) {}
|
||||
template <typename Sequence>
|
||||
vector(Sequence const& rhs)
|
||||
: vec(rhs) {}
|
||||
: vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
|
||||
|
||||
|
||||
|
||||
@ -156,6 +156,7 @@ namespace boost { namespace fusion
|
||||
return vec.at_impl(mpl::int_<I::value>());
|
||||
}
|
||||
private:
|
||||
BOOST_FUSION_VECTOR_CTOR_HELPER()
|
||||
vector_n vec;
|
||||
};
|
||||
}}
|
||||
|
@ -36,7 +36,7 @@ namespace boost { namespace fusion
|
||||
: vec(rhs.vec) {}
|
||||
template <typename Sequence>
|
||||
vector(Sequence const& rhs)
|
||||
: vec(rhs) {}
|
||||
: vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
|
||||
|
||||
|
||||
|
||||
@ -176,6 +176,7 @@ namespace boost { namespace fusion
|
||||
return vec.at_impl(mpl::int_<I::value>());
|
||||
}
|
||||
private:
|
||||
BOOST_FUSION_VECTOR_CTOR_HELPER()
|
||||
vector_n vec;
|
||||
};
|
||||
}}
|
||||
|
@ -36,7 +36,7 @@ namespace boost { namespace fusion
|
||||
: vec(rhs.vec) {}
|
||||
template <typename Sequence>
|
||||
vector(Sequence const& rhs)
|
||||
: vec(rhs) {}
|
||||
: vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
|
||||
|
||||
|
||||
|
||||
@ -196,6 +196,7 @@ namespace boost { namespace fusion
|
||||
return vec.at_impl(mpl::int_<I::value>());
|
||||
}
|
||||
private:
|
||||
BOOST_FUSION_VECTOR_CTOR_HELPER()
|
||||
vector_n vec;
|
||||
};
|
||||
}}
|
||||
|
@ -17,6 +17,38 @@
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if !defined(__WAVE__)
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1600)
|
||||
|
||||
#define BOOST_FUSION_VECTOR_COPY_INIT() \
|
||||
ctor_helper(rhs, is_base_of<vector, Sequence>()) \
|
||||
|
||||
#define BOOST_FUSION_VECTOR_CTOR_HELPER() \
|
||||
static vector_n const& \
|
||||
ctor_helper(vector const& rhs, mpl::true_) \
|
||||
{ \
|
||||
return rhs.vec; \
|
||||
} \
|
||||
\
|
||||
template <typename T> \
|
||||
static T const& \
|
||||
ctor_helper(T const& rhs, mpl::false_) \
|
||||
{ \
|
||||
return rhs; \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_FUSION_VECTOR_COPY_INIT() \
|
||||
rhs \
|
||||
|
||||
#define BOOST_FUSION_VECTOR_CTOR_HELPER()
|
||||
|
||||
#endif
|
||||
|
||||
#endif // !defined(__WAVE__)
|
||||
|
||||
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
|
||||
#include <boost/fusion/container/vector/detail/preprocessed/vector.hpp>
|
||||
#else
|
||||
@ -76,11 +108,7 @@ namespace boost { namespace fusion
|
||||
|
||||
template <typename Sequence>
|
||||
vector(Sequence const& rhs)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1600)
|
||||
: vec(ctor_helper(rhs, is_base_of<vector, Sequence>())) {}
|
||||
#else
|
||||
: vec(rhs) {}
|
||||
#endif
|
||||
: vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
|
||||
|
||||
// Expand a couple of forwarding constructors for arguments
|
||||
// of type (T0), (T0, T1), (T0, T1, T2) etc. Example:
|
||||
@ -149,21 +177,7 @@ namespace boost { namespace fusion
|
||||
|
||||
private:
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1600)
|
||||
static vector_n const&
|
||||
ctor_helper(vector const& rhs, mpl::true_)
|
||||
{
|
||||
return rhs.vec;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static T const&
|
||||
ctor_helper(T const& rhs, mpl::false_)
|
||||
{
|
||||
return rhs;
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOST_FUSION_VECTOR_CTOR_HELPER()
|
||||
vector_n vec;
|
||||
};
|
||||
}}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <boost/fusion/support/deduce.hpp>
|
||||
#include <boost/fusion/container/vector/convert.hpp>
|
||||
#include <boost/fusion/view/transform_view.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace fusion { namespace traits
|
||||
@ -29,6 +30,13 @@ namespace boost { namespace fusion { namespace traits
|
||||
struct result< Self(T) >
|
||||
: fusion::traits::deduce<T>
|
||||
{ };
|
||||
|
||||
// never called, but needed for decltype-based result_of (C++0x)
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template <typename T>
|
||||
typename result< deducer(T) >::type
|
||||
operator()(T&&) const;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#if !defined(FUSION_STRICTEST_TRAVERSAL_20060123_2101)
|
||||
#define FUSION_STRICTEST_TRAVERSAL_20060123_2101
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/fusion/support/category_of.hpp>
|
||||
@ -53,6 +54,13 @@ namespace boost { namespace fusion
|
||||
|
||||
typedef typename stricter_traversal<tag1,tag2>::type type;
|
||||
};
|
||||
|
||||
// never called, but needed for decltype-based result_of (C++0x)
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template<typename StrictestSoFar, typename Next>
|
||||
typename result<strictest_traversal_impl(StrictestSoFar, Next)>::type
|
||||
operator()(StrictestSoFar&&, Next&&) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename Sequence>
|
||||
|
@ -29,11 +29,21 @@
|
||||
// - All other ranges point to ranges
|
||||
// - The front of each range in the stack (besides the
|
||||
// topmost) is the range above it
|
||||
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
template <typename First, typename Last>
|
||||
struct iterator_range;
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template <typename Sequence, typename T>
|
||||
struct push_back;
|
||||
}
|
||||
|
||||
template <typename Sequence, typename T>
|
||||
typename result_of::push_back<Sequence const, T>::type
|
||||
push_back(Sequence const& seq, T const& x);
|
||||
}}
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
@ -117,7 +127,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
segment_sequence<
|
||||
typename result_of::push_front<
|
||||
rest_type const
|
||||
, typename recurse::type
|
||||
, typename recurse::type
|
||||
>::type
|
||||
>
|
||||
type;
|
||||
@ -184,7 +194,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
return stack.cdr;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//auto make_segment_sequence_back(stack_end)
|
||||
//{
|
||||
@ -260,7 +270,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
segment_sequence<
|
||||
typename result_of::push_back<
|
||||
rest_type const
|
||||
, typename recurse::type
|
||||
, typename recurse::type
|
||||
>::type
|
||||
>
|
||||
type;
|
||||
@ -328,7 +338,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
return stack.cdr;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//auto make_segmented_range_reduce(stack_begin, stack_end)
|
||||
//{
|
||||
// if (size(stack_begin) == 1 && size(stack_end) == 1)
|
||||
@ -373,7 +383,7 @@ namespace boost { namespace fusion { namespace detail
|
||||
template <
|
||||
typename StackBegin
|
||||
, typename StackEnd
|
||||
, bool SameSegment =
|
||||
, bool SameSegment =
|
||||
result_of::equal_to<
|
||||
typename StackBegin::car_type::begin_type
|
||||
, typename StackEnd::car_type::begin_type
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2009 Hartmut Kaiser
|
||||
|
||||
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)
|
||||
==============================================================================*/
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
namespace boost { namespace fusion { namespace result_of
|
||||
{
|
||||
template <typename Sequence
|
||||
, BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(FUSION_MAX_VECTOR_SIZE, int I, LONG_MAX)>
|
||||
, BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(FUSION_MAX_VECTOR_SIZE, int I, INT_MAX)>
|
||||
struct as_nview
|
||||
{
|
||||
typedef mpl::vector_c<
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <boost/fusion/container/vector.hpp>
|
||||
#include <boost/fusion/view/transform_view.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
namespace detail
|
||||
@ -35,12 +37,21 @@ namespace boost { namespace fusion
|
||||
template<typename U>
|
||||
struct result<addref(U)> : add_reference<U> {};
|
||||
|
||||
#ifdef BOOST_NO_RVALUE_REFERENCES
|
||||
template <typename T>
|
||||
typename add_reference<T>::type
|
||||
operator()(T& x) const
|
||||
{
|
||||
return x;
|
||||
}
|
||||
#else
|
||||
template <typename T>
|
||||
typename result<addref(T)>::type
|
||||
operator()(T&& x) const
|
||||
{
|
||||
return x;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
struct addconstref
|
||||
|
@ -62,7 +62,7 @@ namespace boost { namespace fusion {
|
||||
|
||||
template<typename Seq>
|
||||
typename result<endpoints(Seq const&)>::type
|
||||
operator()(Seq const& seq)
|
||||
operator()(Seq const& seq) const
|
||||
{
|
||||
return fusion::advance<M>(fusion::begin(seq));
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
@ -35,6 +36,13 @@ namespace boost { namespace fusion {
|
||||
mpl::identity<unused_type>,
|
||||
result_of::value_at<typename remove_reference<Seq>::type, N> >
|
||||
{};
|
||||
|
||||
// never called, but needed for decltype-based result_of (C++0x)
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template<typename Seq>
|
||||
typename result<poly_value_at(Seq)>::type
|
||||
operator()(Seq&&) const;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
@ -34,6 +35,13 @@ namespace boost { namespace fusion
|
||||
mpl::identity<unused_type>,
|
||||
result_of::value_of<It> >
|
||||
{};
|
||||
|
||||
// never called, but needed for decltype-based result_of (C++0x)
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template<typename It>
|
||||
typename result<poly_value_of(It)>::type
|
||||
operator()(It&&) const;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,8 @@
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace fusion {
|
||||
|
||||
namespace detail
|
||||
@ -64,6 +66,13 @@ namespace boost { namespace fusion {
|
||||
result_of::size<SeqClass>,
|
||||
mpl::int_<high_int> >::type type;
|
||||
};
|
||||
|
||||
// never called, but needed for decltype-based result_of (C++0x)
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template<typename Seq>
|
||||
typename result<seq_ref_size(Seq)>::type
|
||||
operator()(Seq&&) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct poly_min
|
||||
@ -78,6 +87,13 @@ namespace boost { namespace fusion {
|
||||
typedef typename remove_reference<Rhs>::type rhs;
|
||||
typedef typename mpl::min<lhs, rhs>::type type;
|
||||
};
|
||||
|
||||
// never called, but needed for decltype-based result_of (C++0x)
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template<typename Lhs, typename Rhs>
|
||||
typename result<poly_min(Lhs, Rhs)>::type
|
||||
operator()(Lhs&&, Rhs&&) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename Sequences>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -71,7 +71,7 @@ void result_type_tests()
|
||||
|
||||
typedef fusion::unfused< test_func<> > t;
|
||||
BOOST_TEST(( is_same< boost::result_of< t () >::type, long >::value ));
|
||||
BOOST_TEST(( is_same< boost::result_of< t (int) >::type, long >::value ));
|
||||
BOOST_TEST(( is_same< boost::result_of< t (int &) >::type, long >::value ));
|
||||
}
|
||||
|
||||
int main()
|
||||
|
@ -85,7 +85,7 @@ void result_type_tests()
|
||||
typedef fusion::unfused_typed< test_func<>, types0 > t0;
|
||||
BOOST_TEST(( is_same< boost::result_of< t0 () >::type, long >::value ));
|
||||
typedef fusion::unfused_typed< test_func<>, types1 > t1;
|
||||
BOOST_TEST(( is_same< boost::result_of< t1 (int) >::type, long >::value ));
|
||||
BOOST_TEST(( is_same< boost::result_of< t1 (long &) >::type, long >::value ));
|
||||
}
|
||||
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC < 1400
|
||||
|
Reference in New Issue
Block a user