|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r79958 - in branches/release: boost/fusion boost/fusion/adapted/struct/detail boost/fusion/container/deque/detail boost/fusion/include boost/fusion/tuple/detail/preprocessed libs/fusion libs/fusion/doc libs/fusion/test/sequence
From: joel_at_[hidden]
Date: 2012-08-10 22:36:09
Author: djowel
Date: 2012-08-10 22:36:08 EDT (Fri, 10 Aug 2012)
New Revision: 79958
URL: http://svn.boost.org/trac/boost/changeset/79958
Log:
update from trunk fixing http://boost.2283326.n4.nabble.com/fusion-g-4-6-deque-and-c-0x-compile-error-td4632499.html
Added:
branches/release/boost/fusion/include/repetitive_view.hpp
- copied unchanged from r79957, /branches/release/boost/fusion/include/repetetive_view.hpp
Removed:
branches/release/boost/fusion/container/deque/detail/deque_keyed_values.hpp
branches/release/boost/fusion/include/repetetive_view.hpp
Properties modified:
branches/release/boost/fusion/ (props changed)
branches/release/libs/fusion/ (props changed)
Text files modified:
branches/release/boost/fusion/adapted/struct/detail/define_struct_inline.hpp | 45 ++++++++++++-----
branches/release/boost/fusion/tuple/detail/preprocessed/make_tuple.hpp | 2
branches/release/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp | 2
branches/release/boost/fusion/tuple/detail/preprocessed/tuple_tie.hpp | 2
branches/release/libs/fusion/doc/adapted.qbk | 96 +++++++++++++++++++++++++++++++++++++++
branches/release/libs/fusion/test/sequence/adapt_adt.cpp | 38 +++++++++++++++
branches/release/libs/fusion/test/sequence/adapt_tpl_adt.cpp | 15 ++++++
7 files changed, 182 insertions(+), 18 deletions(-)
Modified: branches/release/boost/fusion/adapted/struct/detail/define_struct_inline.hpp
==============================================================================
--- branches/release/boost/fusion/adapted/struct/detail/define_struct_inline.hpp (original)
+++ branches/release/boost/fusion/adapted/struct/detail/define_struct_inline.hpp 2012-08-10 22:36:08 EDT (Fri, 10 Aug 2012)
@@ -29,6 +29,27 @@
#define BOOST_FUSION_MAKE_DEFAULT_INIT_LIST_ENTRY(R, DATA, N, ATTRIBUTE) \
BOOST_PP_COMMA_IF(N) BOOST_PP_TUPLE_ELEM(2, 1, ATTRIBUTE)()
+#define BOOST_FUSION_MAKE_DEFAULT_INIT_LIST(ATTRIBUTES_SEQ) \
+ : BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_FUSION_MAKE_DEFAULT_INIT_LIST_ENTRY, \
+ ~, \
+ ATTRIBUTES_SEQ) \
+
+#define BOOST_FUSION_IGNORE_1(ARG1)
+#define BOOST_FUSION_IGNORE_2(ARG1, ARG2)
+
+#define BOOST_FUSION_MAKE_COPY_CONSTRUCTOR(NAME, ATTRIBUTES_SEQ) \
+ NAME(BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_FUSION_MAKE_CONST_REF_PARAM, \
+ ~, \
+ ATTRIBUTES_SEQ)) \
+ : BOOST_PP_SEQ_FOR_EACH_I( \
+ BOOST_FUSION_MAKE_INIT_LIST_ENTRY, \
+ ~, \
+ ATTRIBUTES_SEQ) \
+ { \
+ } \
+
#define BOOST_FUSION_MAKE_CONST_REF_PARAM(R, DATA, N, ATTRIBUTE) \
BOOST_PP_COMMA_IF(N) \
BOOST_PP_TUPLE_ELEM(2, 0, ATTRIBUTE) const& \
@@ -162,23 +183,19 @@
NAME, ATTRIBUTES_SEQ, ATTRIBUTES_SEQ_SIZE) \
\
NAME() \
- : BOOST_PP_SEQ_FOR_EACH_I( \
- BOOST_FUSION_MAKE_DEFAULT_INIT_LIST_ENTRY, \
- ~, \
- ATTRIBUTES_SEQ) \
+ BOOST_PP_IF( \
+ BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ), \
+ BOOST_FUSION_MAKE_DEFAULT_INIT_LIST, \
+ BOOST_FUSION_IGNORE_1) \
+ (ATTRIBUTES_SEQ) \
{ \
} \
\
- NAME(BOOST_PP_SEQ_FOR_EACH_I( \
- BOOST_FUSION_MAKE_CONST_REF_PARAM, \
- ~, \
- ATTRIBUTES_SEQ)) \
- : BOOST_PP_SEQ_FOR_EACH_I( \
- BOOST_FUSION_MAKE_INIT_LIST_ENTRY, \
- ~, \
- ATTRIBUTES_SEQ) \
- { \
- } \
+ BOOST_PP_IF( \
+ BOOST_PP_SEQ_SIZE(ATTRIBUTES_SEQ), \
+ BOOST_FUSION_MAKE_COPY_CONSTRUCTOR, \
+ BOOST_FUSION_IGNORE_2) \
+ (NAME, ATTRIBUTES_SEQ) \
\
template <typename boost_fusion_uglified_Seq> \
NAME(const boost_fusion_uglified_Seq& rhs) \
Deleted: branches/release/boost/fusion/container/deque/detail/deque_keyed_values.hpp
==============================================================================
--- branches/release/boost/fusion/container/deque/detail/deque_keyed_values.hpp 2012-08-10 22:36:08 EDT (Fri, 10 Aug 2012)
+++ (empty file)
@@ -1,102 +0,0 @@
-/*=============================================================================
- Copyright (c) 2005-2011 Joel de Guzman
- Copyright (c) 2005-2006 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_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330)
-#define BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330
-
-#include <boost/fusion/container/deque/limits.hpp>
-#include <boost/fusion/container/deque/detail/keyed_element.hpp>
-
-#include <boost/preprocessor/iterate.hpp>
-#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
-#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
-#include <boost/preprocessor/repetition/enum.hpp>
-#include <boost/preprocessor/repetition/enum_params.hpp>
-#include <boost/type_traits/add_reference.hpp>
-
-#include <boost/mpl/plus.hpp>
-#include <boost/mpl/int.hpp>
-#include <boost/mpl/print.hpp>
-
-#define FUSION_VOID(z, n, _) void_
-
-namespace boost { namespace fusion
-{
- struct void_;
-}}
-
-#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
-#include <boost/fusion/container/deque/detail/preprocessed/deque_keyed_values.hpp>
-#else
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(preserve: 2, line: 0, output: "preprocessed/deque_keyed_values" FUSION_MAX_DEQUE_SIZE_STR ".hpp")
-#endif
-
-/*=============================================================================
- Copyright (c) 2001-2011 Joel de Guzman
-
- 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)
-
- This is an auto-generated file. Do not edit!
-==============================================================================*/
-
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(preserve: 1)
-#endif
-
-namespace boost { namespace fusion { namespace detail
-{
- template<typename Key, typename Value, typename Rest>
- struct keyed_element;
-
- struct nil_keyed_element;
-
- template<typename N, BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(FUSION_MAX_DEQUE_SIZE, typename T, void_)>
- struct deque_keyed_values_impl;
-
- template<typename N>
- struct deque_keyed_values_impl<N, BOOST_PP_ENUM(FUSION_MAX_DEQUE_SIZE, FUSION_VOID, _)>
- {
- typedef nil_keyed_element type;
-
- static type call()
- {
- return type();
- }
- };
-
- template<typename N, BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename T)>
- struct deque_keyed_values_impl
- {
- typedef mpl::int_<mpl::plus<N, mpl::int_<1> >::value> next_index;
-
- typedef typename deque_keyed_values_impl<
- next_index,
- BOOST_PP_ENUM_SHIFTED_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type tail;
- typedef keyed_element<N, T0, tail> type;
-
-#include <boost/fusion/container/deque/detail/deque_keyed_values_call.hpp>
-
- };
-
- template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(FUSION_MAX_DEQUE_SIZE, typename T, void_)>
- struct deque_keyed_values
- : deque_keyed_values_impl<mpl::int_<0>, BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>
- {};
-
-}}}
-
-#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
-#pragma wave option(output: null)
-#endif
-
-#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
-
-#undef FUSION_VOID
-
-#endif
Deleted: branches/release/boost/fusion/include/repetetive_view.hpp
==============================================================================
--- branches/release/boost/fusion/include/repetetive_view.hpp 2012-08-10 22:36:08 EDT (Fri, 10 Aug 2012)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
- Copyright (c) 2001-2007 Joel de Guzman
-
- 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(FUSION_INCLUDE_REPETETIVE_VIEW)
-#define FUSION_INCLUDE_REPETETIVE_VIEW
-
-#include <boost/fusion/view/repetitive_view.hpp>
-
-#endif
Modified: branches/release/boost/fusion/tuple/detail/preprocessed/make_tuple.hpp
==============================================================================
--- branches/release/boost/fusion/tuple/detail/preprocessed/make_tuple.hpp (original)
+++ branches/release/boost/fusion/tuple/detail/preprocessed/make_tuple.hpp 2012-08-10 22:36:08 EDT (Fri, 10 Aug 2012)
@@ -18,4 +18,4 @@
#include <boost/fusion/tuple/detail/preprocessed/make_tuple50.hpp>
#else
#error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
-#endif
\ No newline at end of file
+#endif
Modified: branches/release/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp
==============================================================================
--- branches/release/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp (original)
+++ branches/release/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp 2012-08-10 22:36:08 EDT (Fri, 10 Aug 2012)
@@ -18,4 +18,4 @@
#include <boost/fusion/tuple/detail/preprocessed/tuple50_fwd.hpp>
#else
#error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
-#endif
\ No newline at end of file
+#endif
Modified: branches/release/boost/fusion/tuple/detail/preprocessed/tuple_tie.hpp
==============================================================================
--- branches/release/boost/fusion/tuple/detail/preprocessed/tuple_tie.hpp (original)
+++ branches/release/boost/fusion/tuple/detail/preprocessed/tuple_tie.hpp 2012-08-10 22:36:08 EDT (Fri, 10 Aug 2012)
@@ -18,4 +18,4 @@
#include <boost/fusion/tuple/detail/preprocessed/tuple_tie50.hpp>
#else
#error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
-#endif
\ No newline at end of file
+#endif
Modified: branches/release/libs/fusion/doc/adapted.qbk
==============================================================================
--- branches/release/libs/fusion/doc/adapted.qbk (original)
+++ branches/release/libs/fusion/doc/adapted.qbk 2012-08-10 22:36:08 EDT (Fri, 10 Aug 2012)
@@ -658,7 +658,7 @@
[heading Synopsis]
- BOOST_FUSION_ADAPT_ADT(
+ BOOST_FUSION_ADAPT_TPL_ADT(
(template_param0)(template_param1)...,
(type_name) (specialization_param0)(specialization_param1)...,
(attribute_type0, attribute_const_type0, get_expr0, set_expr0)
@@ -1115,6 +1115,100 @@
[endsect]
+[section:define_struct_inline BOOST_FUSION_DEFINE_STRUCT_INLINE]
+
+[heading Description]
+
+BOOST_FUSION_DEFINE_STRUCT_INLINE is a macro that can be used to generate all
+the necessary boilerplate to define and adapt an arbitrary struct as a model of
+__random_access_sequence__. Unlike BOOST_FUSION_DEFINE_STRUCT, it can be used
+at class or namespace scope.
+
+[heading Synopsis]
+
+ BOOST_FUSION_DEFINE_STRUCT_INLINE(
+ struct_name,
+ (member_type0, member_name0)
+ (member_type1, member_name1)
+ ...
+ )
+
+[heading Expression Semantics]
+
+The semantics of BOOST_FUSION_DEFINE_STRUCT_INLINE are identical to those of
+BOOST_FUSION_DEFINE_STRUCT, with two differences:
+
+# BOOST_FUSION_DEFINE_STRUCT_INLINE can be used at class or namespace scope, and
+ thus does not take a namespace list parameter.
+# The structure generated by BOOST_FUSION_DEFINE_STRUCT_INLINE has a base class,
+ and is thus not POD in C++03.
+
+[heading Header]
+
+ #include <boost/fusion/adapted/struct/define_struct_inline.hpp>
+ #include <boost/fusion/include/define_struct_inline.hpp>
+
+[heading Example]
+
+ // enclosing::employee is a Fusion sequence
+ class enclosing
+ {
+ BOOST_FUSION_DEFINE_STRUCT_INLINE(
+ employee,
+ (std::string, name)
+ (int, age))
+ };
+
+
+[endsect]
+
+[section:define_tpl_struct_inline BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE]
+
+[heading Description]
+
+BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE is a macro that can be used to generate
+all the necessary boilerplate to define and adapt an arbitrary template struct
+as a model of __random_access_sequence__. Unlike BOOST_FUSION_DEFINE_TPL_STRUCT,
+it can be used at class or namespace scope.
+
+[heading Synopsis]
+
+ BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE(
+ (template_param0)(template_param1)...,
+ struct_name,
+ (member_type0, member_name0)
+ (member_type1, member_name1)
+ ...
+ )
+
+[heading Expression Semantics]
+
+The semantics of BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE are identical to those of
+BOOST_FUSION_DEFINE_TPL_STRUCT, with two differences:
+
+# BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE can be used at class or namespace scope,
+ and thus does not take a namespace list parameter.
+# The structure generated by BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE has a base
+ class, and is thus not POD in C++03.
+
+[heading Header]
+
+ #include <boost/fusion/adapted/struct/define_struct_inline.hpp>
+ #include <boost/fusion/include/define_struct_inline.hpp>
+
+[heading Example]
+
+ // Any instantiated enclosing::employee is a Fusion sequence
+ class enclosing
+ {
+ BOOST_FUSION_DEFINE_TPL_STRUCT(
+ (Name)(Age), employee,
+ (Name, name)
+ (Age, age))
+ };
+
+[endsect]
+
[section:define_assoc_struct BOOST_FUSION_DEFINE_ASSOC_STRUCT]
[heading Description]
Modified: branches/release/libs/fusion/test/sequence/adapt_adt.cpp
==============================================================================
--- branches/release/libs/fusion/test/sequence/adapt_adt.cpp (original)
+++ branches/release/libs/fusion/test/sequence/adapt_adt.cpp 2012-08-10 22:36:08 EDT (Fri, 10 Aug 2012)
@@ -71,6 +71,24 @@
int y;
};
#endif
+
+ // A sequence that has data members defined in an unrelated namespace
+ // (std, in this case). This allows testing ADL issues.
+ class name
+ {
+ public:
+ name() {}
+ name(const std::string& last, const std::string& first)
+ : last(last), first(first) {}
+
+ const std::string& get_last() const { return last; }
+ const std::string& get_first() const { return first; }
+ void set_last(const std::string& last_) { last = last_; }
+ void set_first(const std::string& first_) { first = first_; }
+ private:
+ std::string last;
+ std::string first;
+ };
}
BOOST_FUSION_ADAPT_ADT(
@@ -87,6 +105,12 @@
)
#endif
+BOOST_FUSION_ADAPT_ADT(
+ ns::name,
+ (const std::string&, const std::string&, obj.get_last(), obj.set_last(val))
+ (const std::string&, const std::string&, obj.get_first(), obj.set_first(val))
+)
+
int
main()
{
@@ -132,6 +156,20 @@
}
{
+ fusion::vector<std::string, std::string> v1("Lincoln", "Abraham");
+ ns::name v2("Roosevelt", "Franklin");
+ ns::name v3("Roosevelt", "Theodore");
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
// conversion from ns::point to vector
ns::point p(5, 3);
fusion::vector<int, long> v(p);
Modified: branches/release/libs/fusion/test/sequence/adapt_tpl_adt.cpp
==============================================================================
--- branches/release/libs/fusion/test/sequence/adapt_tpl_adt.cpp (original)
+++ branches/release/libs/fusion/test/sequence/adapt_tpl_adt.cpp 2012-08-10 22:36:08 EDT (Fri, 10 Aug 2012)
@@ -67,6 +67,7 @@
using namespace boost::fusion;
typedef ns::point<int, int> point;
+ typedef ns::point<std::string, std::string> name;
std::cout << tuple_open('[');
std::cout << tuple_close(']');
@@ -107,6 +108,20 @@
}
{
+ boost::fusion::vector<std::string, std::string> v1("Lincoln", "Abraham");
+ name v2("Roosevelt", "Franklin");
+ name v3("Roosevelt", "Theodore");
+ BOOST_TEST(v1 < v2);
+ BOOST_TEST(v1 <= v2);
+ BOOST_TEST(v2 > v1);
+ BOOST_TEST(v2 >= v1);
+ BOOST_TEST(v2 < v3);
+ BOOST_TEST(v2 <= v3);
+ BOOST_TEST(v3 > v2);
+ BOOST_TEST(v3 >= v2);
+ }
+
+ {
// conversion from point to vector
point p(5, 3);
boost::fusion::vector<int, long> v(p);
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk