Quickbook: Merge from trunk to quickbook-dev

[SVN r75739]
This commit is contained in:
Daniel James
2011-11-30 01:35:25 +00:00
parent 6466de2568
commit 78ca71e354
19 changed files with 128 additions and 36 deletions

View File

@ -36,7 +36,7 @@ namespace boost { namespace fusion
: vec(rhs.vec) {} : vec(rhs.vec) {}
template <typename Sequence> template <typename Sequence>
vector(Sequence const& rhs) 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>()); return vec.at_impl(mpl::int_<I::value>());
} }
private: private:
BOOST_FUSION_VECTOR_CTOR_HELPER()
vector_n vec; vector_n vec;
}; };
}} }}

View File

@ -36,7 +36,7 @@ namespace boost { namespace fusion
: vec(rhs.vec) {} : vec(rhs.vec) {}
template <typename Sequence> template <typename Sequence>
vector(Sequence const& rhs) 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>()); return vec.at_impl(mpl::int_<I::value>());
} }
private: private:
BOOST_FUSION_VECTOR_CTOR_HELPER()
vector_n vec; vector_n vec;
}; };
}} }}

View File

@ -36,7 +36,7 @@ namespace boost { namespace fusion
: vec(rhs.vec) {} : vec(rhs.vec) {}
template <typename Sequence> template <typename Sequence>
vector(Sequence const& rhs) 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>()); return vec.at_impl(mpl::int_<I::value>());
} }
private: private:
BOOST_FUSION_VECTOR_CTOR_HELPER()
vector_n vec; vector_n vec;
}; };
}} }}

View File

@ -36,7 +36,7 @@ namespace boost { namespace fusion
: vec(rhs.vec) {} : vec(rhs.vec) {}
template <typename Sequence> template <typename Sequence>
vector(Sequence const& rhs) 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>()); return vec.at_impl(mpl::int_<I::value>());
} }
private: private:
BOOST_FUSION_VECTOR_CTOR_HELPER()
vector_n vec; vector_n vec;
}; };
}} }}

View File

@ -36,7 +36,7 @@ namespace boost { namespace fusion
: vec(rhs.vec) {} : vec(rhs.vec) {}
template <typename Sequence> template <typename Sequence>
vector(Sequence const& rhs) 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>()); return vec.at_impl(mpl::int_<I::value>());
} }
private: private:
BOOST_FUSION_VECTOR_CTOR_HELPER()
vector_n vec; vector_n vec;
}; };
}} }}

View File

@ -17,6 +17,38 @@
#include <boost/type_traits/is_base_of.hpp> #include <boost/type_traits/is_base_of.hpp>
#include <boost/detail/workaround.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) #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
#include <boost/fusion/container/vector/detail/preprocessed/vector.hpp> #include <boost/fusion/container/vector/detail/preprocessed/vector.hpp>
#else #else
@ -76,11 +108,7 @@ namespace boost { namespace fusion
template <typename Sequence> template <typename Sequence>
vector(Sequence const& rhs) vector(Sequence const& rhs)
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1600) : vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
: vec(ctor_helper(rhs, is_base_of<vector, Sequence>())) {}
#else
: vec(rhs) {}
#endif
// Expand a couple of forwarding constructors for arguments // Expand a couple of forwarding constructors for arguments
// of type (T0), (T0, T1), (T0, T1, T2) etc. Example: // of type (T0), (T0, T1), (T0, T1, T2) etc. Example:
@ -149,21 +177,7 @@ namespace boost { namespace fusion
private: private:
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1600) 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;
}
#endif
vector_n vec; vector_n vec;
}; };
}} }}

View File

@ -12,6 +12,7 @@
#include <boost/fusion/support/deduce.hpp> #include <boost/fusion/support/deduce.hpp>
#include <boost/fusion/container/vector/convert.hpp> #include <boost/fusion/container/vector/convert.hpp>
#include <boost/fusion/view/transform_view.hpp> #include <boost/fusion/view/transform_view.hpp>
#include <boost/config.hpp>
namespace boost { namespace fusion { namespace traits namespace boost { namespace fusion { namespace traits
@ -29,6 +30,13 @@ namespace boost { namespace fusion { namespace traits
struct result< Self(T) > struct result< Self(T) >
: fusion::traits::deduce<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
}; };
} }

View File

@ -8,6 +8,7 @@
#if !defined(FUSION_STRICTEST_TRAVERSAL_20060123_2101) #if !defined(FUSION_STRICTEST_TRAVERSAL_20060123_2101)
#define FUSION_STRICTEST_TRAVERSAL_20060123_2101 #define FUSION_STRICTEST_TRAVERSAL_20060123_2101
#include <boost/config.hpp>
#include <boost/mpl/or.hpp> #include <boost/mpl/or.hpp>
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
#include <boost/fusion/support/category_of.hpp> #include <boost/fusion/support/category_of.hpp>
@ -53,6 +54,13 @@ namespace boost { namespace fusion
typedef typename stricter_traversal<tag1,tag2>::type type; 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> template<typename Sequence>

View File

@ -29,11 +29,21 @@
// - All other ranges point to ranges // - All other ranges point to ranges
// - The front of each range in the stack (besides the // - The front of each range in the stack (besides the
// topmost) is the range above it // topmost) is the range above it
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
template <typename First, typename Last> template <typename First, typename Last>
struct iterator_range; 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 namespace boost { namespace fusion { namespace detail
@ -117,7 +127,7 @@ namespace boost { namespace fusion { namespace detail
segment_sequence< segment_sequence<
typename result_of::push_front< typename result_of::push_front<
rest_type const rest_type const
, typename recurse::type , typename recurse::type
>::type >::type
> >
type; type;
@ -184,7 +194,7 @@ namespace boost { namespace fusion { namespace detail
{ {
return stack.cdr; return stack.cdr;
} }
}; };
//auto make_segment_sequence_back(stack_end) //auto make_segment_sequence_back(stack_end)
//{ //{
@ -260,7 +270,7 @@ namespace boost { namespace fusion { namespace detail
segment_sequence< segment_sequence<
typename result_of::push_back< typename result_of::push_back<
rest_type const rest_type const
, typename recurse::type , typename recurse::type
>::type >::type
> >
type; type;
@ -328,7 +338,7 @@ namespace boost { namespace fusion { namespace detail
return stack.cdr; return stack.cdr;
} }
}; };
//auto make_segmented_range_reduce(stack_begin, stack_end) //auto make_segmented_range_reduce(stack_begin, stack_end)
//{ //{
// if (size(stack_begin) == 1 && size(stack_end) == 1) // if (size(stack_begin) == 1 && size(stack_end) == 1)
@ -373,7 +383,7 @@ namespace boost { namespace fusion { namespace detail
template < template <
typename StackBegin typename StackBegin
, typename StackEnd , typename StackEnd
, bool SameSegment = , bool SameSegment =
result_of::equal_to< result_of::equal_to<
typename StackBegin::car_type::begin_type typename StackBegin::car_type::begin_type
, typename StackEnd::car_type::begin_type , typename StackEnd::car_type::begin_type

View File

@ -1,7 +1,7 @@
/*============================================================================= /*=============================================================================
Copyright (c) 2009 Hartmut Kaiser 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) 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 namespace boost { namespace fusion { namespace result_of
{ {
template <typename Sequence 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 struct as_nview
{ {
typedef mpl::vector_c< typedef mpl::vector_c<

View File

@ -23,6 +23,8 @@
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/container/vector.hpp>
#include <boost/fusion/view/transform_view.hpp> #include <boost/fusion/view/transform_view.hpp>
#include <boost/config.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
namespace detail namespace detail
@ -35,12 +37,21 @@ namespace boost { namespace fusion
template<typename U> template<typename U>
struct result<addref(U)> : add_reference<U> {}; struct result<addref(U)> : add_reference<U> {};
#ifdef BOOST_NO_RVALUE_REFERENCES
template <typename T> template <typename T>
typename add_reference<T>::type typename add_reference<T>::type
operator()(T& x) const operator()(T& x) const
{ {
return x; return x;
} }
#else
template <typename T>
typename result<addref(T)>::type
operator()(T&& x) const
{
return x;
}
#endif
}; };
struct addconstref struct addconstref

View File

@ -62,7 +62,7 @@ namespace boost { namespace fusion {
template<typename Seq> template<typename Seq>
typename result<endpoints(Seq const&)>::type typename result<endpoints(Seq const&)>::type
operator()(Seq const& seq) operator()(Seq const& seq) const
{ {
return fusion::advance<M>(fusion::begin(seq)); return fusion::advance<M>(fusion::begin(seq));
} }

View File

@ -16,6 +16,7 @@
#include <boost/mpl/eval_if.hpp> #include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp> #include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/config.hpp>
namespace boost { namespace fusion { namespace boost { namespace fusion {
@ -35,6 +36,13 @@ namespace boost { namespace fusion {
mpl::identity<unused_type>, mpl::identity<unused_type>,
result_of::value_at<typename remove_reference<Seq>::type, N> > 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
}; };
} }

View File

@ -16,6 +16,7 @@
#include <boost/mpl/eval_if.hpp> #include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp> #include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/config.hpp>
namespace boost { namespace fusion namespace boost { namespace fusion
{ {
@ -34,6 +35,13 @@ namespace boost { namespace fusion
mpl::identity<unused_type>, mpl::identity<unused_type>,
result_of::value_of<It> > 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
}; };
} }

View File

@ -37,6 +37,8 @@
#include <boost/type_traits/remove_reference.hpp> #include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/is_reference.hpp> #include <boost/type_traits/is_reference.hpp>
#include <boost/config.hpp>
namespace boost { namespace fusion { namespace boost { namespace fusion {
namespace detail namespace detail
@ -64,6 +66,13 @@ namespace boost { namespace fusion {
result_of::size<SeqClass>, result_of::size<SeqClass>,
mpl::int_<high_int> >::type type; 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 struct poly_min
@ -78,6 +87,13 @@ namespace boost { namespace fusion {
typedef typename remove_reference<Rhs>::type rhs; typedef typename remove_reference<Rhs>::type rhs;
typedef typename mpl::min<lhs, rhs>::type type; 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> template<typename Sequences>

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 &) { return 10 + i; }
int operator()(int i, object &, object_nc &) const { return 11 + 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 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 &) { return 10 + i; }
int operator()(int i, object &, object_nc &) const { return 11 + 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 struct nullary_fobj

View File

@ -71,7 +71,7 @@ void result_type_tests()
typedef fusion::unfused< test_func<> > t; 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 () >::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() int main()

View File

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