Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59482 - in sandbox/SOC/2009/fusion: boost/fusion/adapted boost/fusion/adapted/class boost/fusion/adapted/detail/class boost/fusion/adapted/detail/struct boost/fusion/adapted/struct boost/fusion/include boost/fusion/sequence/intrinsic/ext_ boost/fusion/support boost/fusion/view/repetitive_view boost/fusion/view/repetitive_view/detail libs/fusion/test libs/fusion/test/sequence
From: mr.chr.schmidt_at_[hidden]
Date: 2010-02-04 16:30:12


Author: cschmidt
Date: 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
New Revision: 59482
URL: http://svn.boost.org/trac/boost/changeset/59482

Log:
adapt named
Added:
   sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_assoc_class_named.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_class_named.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/proxy_type.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/struct/adapt_struct_named.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/include/adapt_assoc_class_named.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/include/adapt_assoc_struct.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/include/adapt_assoc_struct_named.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/include/adapt_class_named.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/include/adapt_struct_named.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/libs/fusion/test/sequence/adapt_class_named.cpp (contents, props changed)
   sandbox/SOC/2009/fusion/libs/fusion/test/sequence/adapt_struct_named.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2009/fusion/boost/fusion/adapted/class.hpp | 2 +
   sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_assoc_class.hpp | 44 ++++++++++++++++++++++-----------------
   sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_class.hpp | 8 +++---
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/adapt_base.hpp | 2
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/begin_impl.hpp | 2
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/adapt_base.hpp | 10 ++++----
   sandbox/SOC/2009/fusion/boost/fusion/adapted/struct.hpp | 4 ++
   sandbox/SOC/2009/fusion/boost/fusion/adapted/struct/adapt_assoc_struct.hpp | 11 +++++++--
   sandbox/SOC/2009/fusion/boost/fusion/adapted/struct/adapt_struct.hpp | 5 ++-
   sandbox/SOC/2009/fusion/boost/fusion/sequence/intrinsic/ext_/segments.hpp | 8 +++---
   sandbox/SOC/2009/fusion/boost/fusion/support/pair.hpp | 6 +++-
   sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/advance_impl.hpp | 2
   sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/begin_impl.hpp | 2
   sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/end_impl.hpp | 2
   sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/next_impl.hpp | 3 +
   sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/prior_impl.hpp | 3 +
   sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/repetitive_view_iterator.hpp | 6 ++--
   sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/repetitive_view.hpp | 24 +++++++++++++--------
   sandbox/SOC/2009/fusion/libs/fusion/test/Jamfile | 6 +++-
   19 files changed, 89 insertions(+), 61 deletions(-)

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/class.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/class.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/class.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -10,7 +10,9 @@
 #ifndef BOOST_FUSION_ADAPTED_CLASS_HPP
 #define BOOST_FUSION_ADAPTED_CLASS_HPP
 
+#include <boost/fusion/adapted/class/adapt_assoc_class_named.hpp>
 #include <boost/fusion/adapted/class/adapt_assoc_class.hpp>
+#include <boost/fusion/adapted/class/adapt_class_named.hpp>
 #include <boost/fusion/adapted/class/adapt_class.hpp>
 
 #endif

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_assoc_class.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_assoc_class.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_assoc_class.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -5,27 +5,33 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
-#ifndef BOOST_FUSION_ADAPTED_STRUCT_ADAPT_ASSOC_STRUCT_HPP
-#define BOOST_FUSION_ADAPTED_STRUCT_ADAPT_ASSOC_STRUCT_HPP
+#ifndef BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_NAMED_HPP
+#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_NAMED_HPP
 
-#include <boost/fusion/support/internal/ref.hpp>
+#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0(A, B, C, D, E)\
+ ((A, B, C, D, E)) BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_1
+#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_1(A, B, C, D, E)\
+ ((A, B, C, D, E)) BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0
+#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0_END
+#define BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_1_END
 
-#include <boost/fusion/adapted/detail/class/extension.hpp>
-#include <boost/fusion/adapted/detail/class/adapt_base.hpp>
-#include <boost/fusion/adapted/detail/class/at_impl.hpp>
-#include <boost/fusion/adapted/detail/class/is_view_impl.hpp>
-#include <boost/fusion/adapted/detail/class/is_sequence_impl.hpp>
-#include <boost/fusion/adapted/detail/class/value_at_impl.hpp>
-#include <boost/fusion/adapted/detail/class/category_of_impl.hpp>
-#include <boost/fusion/adapted/detail/class/size_impl.hpp>
-#include <boost/fusion/adapted/detail/class/begin_impl.hpp>
-#include <boost/fusion/adapted/detail/class/end_impl.hpp>
-#include <boost/fusion/adapted/detail/class/value_of_impl.hpp>
-#include <boost/fusion/adapted/detail/class/deref_impl.hpp>
-#include <boost/fusion/adapted/detail/class/deref_data_impl.hpp>
-#include <boost/fusion/adapted/detail/class/key_of_impl.hpp>
-#include <boost/fusion/adapted/detail/class/value_of_data_impl.hpp>
+#define BOOST_FUSION_ADAPT_ASSOC_CLASS(NAME, SEQ)\
+ BOOST_FUSION_ADAPT_STRUCT_BASE(\
+ NAME,\
+ assoc_class_tag,\
+ BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_FILLER_0 SEQ,_END),\
+ BOOST_FUSION_ADAPT_ASSOC_CLASS_C)
 
-//TODO???
+#define BOOST_FUSION_ADAPT_ASSOC_CLASS_C(R, NAME, I, TUPLE)\
+ BOOST_FUSION_ADAPT_STRUCT_C_BASE(NAME, I, PREFIX, TUPLE, 5) \
+ \
+namespace boost { namespace fusion { namespace extension \
+{ \
+ template<> \
+ struct struct_assoc_key<NAME, I> \
+ { \
+ typedef BOOST_PP_TUPLE_ELEM(5, 4, TUPLE) type; \
+ }; \
+}}}
 
 #endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_assoc_class_named.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_assoc_class_named.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -0,0 +1,29 @@
+/*=============================================================================
+ 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_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_NAMED_HPP
+#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_ASSOC_CLASS_NAMED_HPP
+
+#include <boost/fusion/adapted/class/adapt_assoc_class.hpp>
+#include <boost/fusion/adapted/detail/struct/proxy_type.hpp>
+
+#define BOOST_FUSION_ADAPT_ASSOC_CLASS_NAMED(WRAPPED_TYPE, NAME, SEQ)\
+ BOOST_FUSION_ADAPT_ASSOC_CLASS_NAMED_NS(\
+ WRAPPED_TYPE,\
+ (boost)(fusion)(adapted),\
+ NAME,\
+ SEQ)
+
+#define BOOST_FUSION_ADAPT_ASSOC_CLASS_NAMED_NS(\
+ WRAPPED_TYPE, NAMESPACE, NAME, SEQ)\
+ \
+ BOOST_FUSION_DEFINE_PROXY_TYPE(WRAPPED_TYPE,NAMESPACE,NAME)\
+ BOOST_FUSION_ASSOC_ADAPT_CLASS(\
+ BOOST_FUSION_NAMESPACE_DECLARATION(NAMESPACE)NAME,\
+ SEQ)
+
+#endif

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_class.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_class.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_class.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -5,8 +5,8 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
-#ifndef BOOST_FUSION_ADAPTED_STRUCT_ADAPT_STRUCT_HPP
-#define BOOST_FUSION_ADAPTED_STRUCT_ADAPT_STRUCT_HPP
+#ifndef BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_HPP
+#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_HPP
 
 #include <boost/fusion/support/internal/ref.hpp>
 #include <boost/preprocessor/cat.hpp>
@@ -38,7 +38,7 @@
         BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_FILLER_0 SEQ,_END),\
         BOOST_FUSION_ADAPT_CLASS_C)
 
-#define BOOST_FUSION_ADAPT_CLASS_C(R, NAME, I, XY)\
- BOOST_FUSION_ADAPT_CLASS_C_BASE(NAME, I, XY, 4)
+#define BOOST_FUSION_ADAPT_CLASS_C(R, NAME, I, TUPLE)\
+ BOOST_FUSION_ADAPT_CLASS_C_BASE(NAME, I, TUPLE, 4)
 
 #endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_class_named.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_class_named.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -0,0 +1,27 @@
+/*=============================================================================
+ 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_ADAPTED_CLASS_ADAPT_CLASS_NAMED_HPP
+#define BOOST_FUSION_ADAPTED_CLASS_ADAPT_CLASS_NAMED_HPP
+
+#include <boost/fusion/adapted/class/adapt_class.hpp>
+#include <boost/fusion/adapted/detail/struct/proxy_type.hpp>
+
+#define BOOST_FUSION_ADAPT_CLASS_NAMED(WRAPPED_TYPE, NAME, SEQ)\
+ BOOST_FUSION_ADAPT_CLASS_NAMED_NS(\
+ WRAPPED_TYPE,\
+ (boost)(fusion)(adapted),\
+ NAME,\
+ SEQ)
+
+#define BOOST_FUSION_ADAPT_CLASS_NAMED_NS(WRAPPED_TYPE, NAMESPACE, NAME, SEQ)\
+ BOOST_FUSION_DEFINE_PROXY_TYPE(WRAPPED_TYPE,NAMESPACE,NAME)\
+ BOOST_FUSION_ADAPT_CLASS(\
+ BOOST_FUSION_NAMESPACE_DECLARATION(NAMESPACE)NAME,\
+ SEQ)
+
+#endif

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/adapt_base.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/adapt_base.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/adapt_base.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -14,7 +14,7 @@
 namespace boost { namespace fusion { namespace extension \
 { \
     template <> \
- struct struct_member<NAME, I> \
+ struct struct_member<NAME, I> \
     { \
         typedef BOOST_PP_TUPLE_ELEM(MAX_SIZE, 0, TUPLE) type; \
         typedef BOOST_PP_TUPLE_ELEM(MAX_SIZE, 1, TUPLE) get_type; \

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/begin_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/begin_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/begin_impl.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -39,7 +39,7 @@
     };
 
     template <>
- struct begin_impl<assoc_struct_tag>
+ struct begin_impl<assoc_class_tag>
     {
         template <typename Seq>
         struct apply

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/adapt_base.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/adapt_base.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/adapt_base.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -33,8 +33,8 @@
     };
 #endif
 
-#define BOOST_FUSION_ADAPT_STRUCT_BASE(NAME,TAG,TUPLE_SEQ,CALLBACK) \
- BOOST_PP_SEQ_FOR_EACH_I(CALLBACK,NAME,TUPLE_SEQ) \
+#define BOOST_FUSION_ADAPT_STRUCT_BASE(NAME,TAG,SEQ,CALLBACK) \
+ BOOST_PP_SEQ_FOR_EACH_I(CALLBACK,NAME,SEQ) \
                                                                                 \
 namespace boost \
 { \
@@ -50,7 +50,7 @@
         { \
             template <> \
             struct struct_size<NAME> \
- : mpl::int_<BOOST_PP_SEQ_SIZE(TUPLE_SEQ)> \
+ : mpl::int_<BOOST_PP_SEQ_SIZE(SEQ)> \
             {}; \
         } \
     } \
@@ -74,7 +74,7 @@
     } \
 }
 
-#define BOOST_FUSION_ADAPT_STRUCT_C_BASE(NAME, I, TUPLE, MAX_SIZE) \
+#define BOOST_FUSION_ADAPT_STRUCT_C_BASE(NAME, I, PREFIX, TUPLE, MAX_SIZE) \
 namespace boost { namespace fusion { namespace extension \
 { \
     template <> \
@@ -86,7 +86,7 @@
         static typename detail::forward_as<Seq&,type>::type \
         call(Seq& seq) \
         { \
- return seq.BOOST_PP_TUPLE_ELEM(MAX_SIZE, 1, TUPLE); \
+ return seq.PREFIX BOOST_PP_TUPLE_ELEM(MAX_SIZE, 1, TUPLE); \
         } \
     }; \
 }}}

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/proxy_type.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/struct/proxy_type.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -0,0 +1,42 @@
+/*=============================================================================
+ 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_ADAPTED_DETAIL_STRUCT_PROXY_TYPE_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_STRUCT_PROXY_TYPE_HPP
+
+#include <boost/preprocessor/seq/for_each.hpp>
+#include <boost/preprocessor/seq/size.hpp>
+#include <boost/preprocessor/repetition/repeat.hpp>
+
+#define BOOST_FUSION_PROXY_TYPE_NS_BEGIN(R,DATA,ELEM) namespace ELEM {
+#define BOOST_FUSION_PROXY_TYPE_NS_END(Z,I,DATA) }
+#define BOOST_FUSION_NAMESPACE_DECLARATION_I(Z,I,ELEM) ELEM::
+
+#define BOOST_FUSION_DEFINE_PROXY_TYPE(WRAPPED_TYPE,NAMESPACE,NAME) \
+ BOOST_PP_SEQ_FOR_EACH_R(1, BOOST_FUSION_PROXY_TYPE_NS_BEGIN, _, NAMESPACE) \
+ \
+ struct NAME \
+ { \
+ NAME(WRAPPED_TYPE& obj) \
+ : obj(obj) \
+ {} \
+ \
+ WRAPPED_TYPE& obj; \
+ }; \
+ \
+ BOOST_PP_REPEAT_1(BOOST_PP_SEQ_SIZE(NAMESPACE), \
+ BOOST_FUSION_PROXY_TYPE_NS_END, \
+ _)
+
+#define BOOST_FUSION_NAMESPACE_DECLARATION(NAMESPACE)\
+ BOOST_PP_SEQ_FOR_EACH_R(\
+ 1,\
+ BOOST_FUSION_NAMESPACE_DECLARATION_I,\
+ _,\
+ NAMESPACE)
+
+#endif

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/struct.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/struct.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/struct.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -1,7 +1,7 @@
 /*=============================================================================
     Copyright (c) 2001-2006 Joel de Guzman
     Copyright (c) 2005-2006 Dan Marsden
- Copyright (c) 2009 Christopher Schmidt
+ Copyright (c) 2009-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)
@@ -10,7 +10,9 @@
 #ifndef BOOST_FUSION_ADAPTED_STRUCT_HPP
 #define BOOST_FUSION_ADAPTED_STRUCT_HPP
 
+#include <boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp>
 #include <boost/fusion/adapted/struct/adapt_assoc_struct.hpp>
+#include <boost/fusion/adapted/struct/adapt_struct_named.hpp>
 #include <boost/fusion/adapted/struct/adapt_struct.hpp>
 
 #endif

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/struct/adapt_assoc_struct.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/struct/adapt_assoc_struct.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/struct/adapt_assoc_struct.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -12,6 +12,7 @@
 
 #include <boost/fusion/support/internal/ref.hpp>
 #include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/empty.hpp>
 #include <boost/preprocessor/tuple/elem.hpp>
 
 #include <boost/fusion/adapted/detail/struct/extension.hpp>
@@ -44,16 +45,20 @@
         BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_STRUCT_FILLER_0 SEQ,_END),\
         BOOST_FUSION_ADAPT_ASSOC_STRUCT_C)
 
-#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_C(R, NAME, I, XYZ) \
- BOOST_FUSION_ADAPT_STRUCT_C_BASE(NAME, I, XYZ, 3) \
+#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_C(R, NAME, I, TUPLE)\
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT_C_BASE(NAME, I, BOOST_PP_EMPTY(), TUPLE)
+
+#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_C_BASE(NAME, I, PREFIX, TUPLE) \
+ BOOST_FUSION_ADAPT_STRUCT_C_BASE(NAME, I, PREFIX, TUPLE, 3) \
                                                                                 \
 namespace boost { namespace fusion { namespace extension \
 { \
     template<> \
     struct struct_assoc_key<NAME, I> \
     { \
- typedef BOOST_PP_TUPLE_ELEM(3, 2, XYZ) type; \
+ typedef BOOST_PP_TUPLE_ELEM(3, 2, TUPLE) type; \
     }; \
 }}}
 
+
 #endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -0,0 +1,35 @@
+/*=============================================================================
+ 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_ADAPTED_STRUCT_ADAPT_ASSOC_STRUCT_NAMED_HPP
+#define BOOST_FUSION_ADAPTED_STRUCT_ADAPT_ASSOC_STRUCT_NAMED_HPP
+
+#include <boost/fusion/adapted/struct/adapt_assoc_struct.hpp>
+#include <boost/fusion/adapted/detail/struct/proxy_type.hpp>
+
+#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED(WRAPPED_TYPE, NAME, SEQ)\
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_NS(\
+ WRAPPED_TYPE,\
+ (boost)(fusion)(adapted),\
+ NAME,\
+ SEQ)
+
+#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_NS(\
+ WRAPPED_TYPE, NAMESPACE, NAME, SEQ)\
+ \
+ BOOST_FUSION_DEFINE_PROXY_TYPE(WRAPPED_TYPE,NAMESPACE,NAME)\
+ \
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT_BASE(\
+ BOOST_FUSION_NAMESPACE_DECLARATION(NAMESPACE)NAME,\
+ struct_tag,\
+ BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 SEQ,_END),\
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_C)
+
+#define BOOST_FUSION_ADAPT_ASSOC_STRUCT_NAMED_C(R, NAME, I, SEQ)\
+ BOOST_FUSION_ADAPT_ASSOC_STRUCT_C_BASE(NAME, I, obj., SEQ)
+
+#endif

Modified: sandbox/SOC/2009/fusion/boost/fusion/adapted/struct/adapt_struct.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/adapted/struct/adapt_struct.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/struct/adapt_struct.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -11,6 +11,7 @@
 
 #include <boost/fusion/support/internal/ref.hpp>
 #include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/empty.hpp>
 
 #include <boost/fusion/adapted/detail/struct/extension.hpp>
 #include <boost/fusion/adapted/detail/struct/adapt_base.hpp>
@@ -39,7 +40,7 @@
         BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 SEQ,_END),\
         BOOST_FUSION_ADAPT_STRUCT_C)
 
-#define BOOST_FUSION_ADAPT_STRUCT_C(R, NAME, I, XY)\
- BOOST_FUSION_ADAPT_STRUCT_C_BASE(NAME, I, XY, 2)
+#define BOOST_FUSION_ADAPT_STRUCT_C(R, NAME, I, TUPLE)\
+ BOOST_FUSION_ADAPT_STRUCT_C_BASE(NAME, I, BOOST_PP_EMPTY(), TUPLE, 2)
 
 #endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/struct/adapt_struct_named.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/struct/adapt_struct_named.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -0,0 +1,33 @@
+/*=============================================================================
+ 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_ADAPTED_STRUCT_ADAPT_STRUCT_NAMED_HPP
+#define BOOST_FUSION_ADAPTED_STRUCT_ADAPT_STRUCT_NAMED_HPP
+
+#include <boost/fusion/adapted/struct/adapt_struct.hpp>
+#include <boost/fusion/adapted/detail/struct/proxy_type.hpp>
+
+#define BOOST_FUSION_ADAPT_STRUCT_NAMED(WRAPPED_TYPE, NAME, SEQ)\
+ BOOST_FUSION_ADAPT_STRUCT_NAMED_NS(\
+ WRAPPED_TYPE,\
+ (boost)(fusion)(adapted),\
+ NAME,\
+ SEQ)
+
+#define BOOST_FUSION_ADAPT_STRUCT_NAMED_NS(WRAPPED_TYPE, NAMESPACE, NAME, SEQ)\
+ BOOST_FUSION_DEFINE_PROXY_TYPE(WRAPPED_TYPE,NAMESPACE,NAME)\
+ \
+ BOOST_FUSION_ADAPT_STRUCT_BASE(\
+ BOOST_FUSION_NAMESPACE_DECLARATION(NAMESPACE)NAME,\
+ struct_tag,\
+ BOOST_PP_CAT(BOOST_FUSION_ADAPT_STRUCT_FILLER_0 SEQ,_END),\
+ BOOST_FUSION_ADAPT_STRUCT_NAMED_C)
+
+#define BOOST_FUSION_ADAPT_STRUCT_NAMED_C(R, NAME, I, TUPLE)\
+ BOOST_FUSION_ADAPT_STRUCT_C_BASE(NAME, I, obj., TUPLE, 2)
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/include/adapt_assoc_class_named.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/include/adapt_assoc_class_named.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -0,0 +1,13 @@
+/*=============================================================================
+ 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/adapted/class/adapt_assoc_class_named.hpp>
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/include/adapt_assoc_struct.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/include/adapt_assoc_struct.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -0,0 +1,13 @@
+/*=============================================================================
+ 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_STRUCT_HPP
+#define BOOST_FUSION_INCLUDE_ADAPT_ASSOC_STRUCT_HPP
+
+#include <boost/fusion/adapted/struct/adapt_assoc_struct.hpp>
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/include/adapt_assoc_struct_named.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/include/adapt_assoc_struct_named.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -0,0 +1,13 @@
+/*=============================================================================
+ 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_STRUCT_NAMED_HPP
+#define BOOST_FUSION_INCLUDE_ADAPT_ASSOC_STRUCT_NAMED_HPP
+
+#include <boost/fusion/adapted/struct/adapt_assoc_struct_named.hpp>
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/include/adapt_class_named.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/include/adapt_class_named.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -0,0 +1,13 @@
+/*=============================================================================
+ 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_CLASS_NAMED_HPP
+#define BOOST_FUSION_INCLUDE_ADAPT_CLASS_NAMED_HPP
+
+#include <boost/fusion/adapted/class/adapt_class_named.hpp>
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/include/adapt_struct_named.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/include/adapt_struct_named.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -0,0 +1,13 @@
+/*=============================================================================
+ 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_STRUCT_NAMED_HPP
+#define BOOST_FUSION_INCLUDE_ADAPT_STRUCT_NAMED_HPP
+
+#include <boost/fusion/adapted/struct/adapt_struct_named.hpp>
+
+#endif

Modified: sandbox/SOC/2009/fusion/boost/fusion/sequence/intrinsic/ext_/segments.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/sequence/intrinsic/ext_/segments.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/sequence/intrinsic/ext_/segments.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -36,7 +36,7 @@
         };
     }
 
- /*template<typename Seq>
+ template<typename Seq>
     typename result_of::segments<Seq>::type
     segments(Seq& seq)
     {
@@ -48,9 +48,9 @@
     segments(Seq const& seq)
     {
         return result_of::segments<Seq const>::call(seq);
- }*/
+ }
 
- template<typename Seq>
+ /*template<typename Seq>
     typename result_of::segments<BOOST_FUSION_R_ELSE_CLREF(Seq)>::type
     segments(BOOST_FUSION_R_ELSE_CLREF(Seq) seq)
     {
@@ -65,7 +65,7 @@
     {
         return result_of::segments<Seq&>::call(seq);
     }
-#endif
+#endif*/
 }}
 
 #endif

Modified: sandbox/SOC/2009/fusion/boost/fusion/support/pair.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/support/pair.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/support/pair.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -21,6 +21,8 @@
 # include <boost/type_traits/is_convertible.hpp>
 #endif
 
+//TODO is_convertible -> is_explicitly_convertible
+
 namespace boost { namespace fusion
 {
     // A half runtime pair where the first type does not have data
@@ -59,9 +61,9 @@
 #else
         template<typename Arg>
         pair(BOOST_FUSION_R_ELSE_CLREF(Arg) arg
- , typename enable_if<
+ /*, typename enable_if<
                 is_convertible<BOOST_FUSION_R_ELSE_CLREF(Arg),second_type>
- >::type* =0)
+ >::type* =0*/)
           : second(BOOST_FUSION_FORWARD(Arg,arg))
         {}
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/advance_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/advance_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/advance_impl.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -90,7 +90,7 @@
                     repetitive_view_iterator<
                         typename it::seq_type
                       , typename gen::type
- , mpl::plus<typename it::index, N>::value
+ , typename mpl::plus<typename it::index, N>::type
>
                 type;
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/begin_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/begin_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/begin_impl.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -31,7 +31,7 @@
                       , typename seq::seq_type
>::type
                   , typename result_of::begin<typename seq::seq_type>::type
- , 0
+ , mpl::int_<0>
>
             type;
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/end_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/end_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/end_impl.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -96,7 +96,7 @@
                           , typename seq::seq_type
>::type
                       , typename gen::type
- , seq::size::value
+ , typename seq::size
>
                 type;
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/next_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/next_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/next_impl.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -15,6 +15,7 @@
 #include <boost/fusion/iterator/equal_to.hpp>
 
 #include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/next.hpp>
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/equal_to.hpp>
 #include <boost/mpl/identity.hpp>
@@ -46,7 +47,7 @@
                       , result_of::begin<typename it::seq_type>
                       , mpl::identity<next_it>
>::type
- , it::index::value+1
+ , typename boost::mpl::next<typename it::index>::type
>
             type;
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/prior_impl.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/prior_impl.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/prior_impl.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -13,6 +13,7 @@
 #include <boost/fusion/iterator/prior.hpp>
 #include <boost/fusion/iterator/equal_to.hpp>
 
+#include <boost/mpl/prior.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/mpl/equal_to.hpp>
 
@@ -45,7 +46,7 @@
                           , typename it::it_type
>::type
>::type
- , it::index::value-1
+ , typename boost::mpl::prior<typename it::index>::type
>
             type;
 

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/repetitive_view_iterator.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/repetitive_view_iterator.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/detail/repetitive_view_iterator.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -19,13 +19,13 @@
 {
     struct repetitive_view_iterator_tag;
 
- template<typename SeqRef, typename It, int I>
+ template<typename SeqRef, typename It, typename Index>
     struct repetitive_view_iterator
- : iterator_base<repetitive_view_iterator<SeqRef, It, I> >
+ : iterator_base<repetitive_view_iterator<SeqRef, It, Index> >
     {
         typedef SeqRef seq_type;
         typedef It it_type;
- typedef mpl::int_<I> index;
+ typedef Index index;
 
         typedef repetitive_view_iterator_tag fusion_tag;
         typedef typename traits::category_of<It>::type category;

Modified: sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/repetitive_view.hpp
==============================================================================
--- sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/repetitive_view.hpp (original)
+++ sandbox/SOC/2009/fusion/boost/fusion/view/repetitive_view/repetitive_view.hpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -23,12 +23,12 @@
 #include <boost/fusion/view/detail/view_storage.hpp>
 
 #include <boost/mpl/bool.hpp>
-#include <boost/mpl/long.hpp>
+#include <boost/mpl/int.hpp>
 #ifdef BOOST_FUSION_ENABLE_STATIC_ASSERTS
 # include <boost/mpl/eqaul_to.hpp>
 # include <boost/mpl/not.hpp>
 # include <boost/mpl/or_.hpp>
-# include <boost/mpl/bool.hpp>
+# include <boost/mpl/not.hpp>
 #endif
 #include <boost/integer_traits.hpp>
 
@@ -51,7 +51,10 @@
 {
     struct fusion_sequence_tag;
 
- template<typename Seq, int Size=integer_traits<int>::const_max-1>
+ template<
+ typename Seq
+ , typename Size=mpl::int_<integer_traits<int>::const_max-1>
+ >
     struct repetitive_view
       : sequence_base<repetitive_view<Seq> >
     {
@@ -59,14 +62,14 @@
         BOOST_FUSION_MPL_ASSERT((traits::is_forward<Seq>));
         BOOST_FUSION_MPL_ASSERT((mpl::or_<
                             mpl:not_<result_of::empty<Seq> >
- , mpl::bool_<!Size>
+ , mpl::not_<Size>
>));
 
         typedef detail::view_storage<Seq> storage_type;
         typedef typename storage_type::type seq_type;
 
         typedef typename traits::category_of<seq_type>::type category;
- typedef mpl::int_<Size> size;
+ typedef Size size;
         typedef repetitive_view_tag fusion_tag;
         typedef fusion_sequence_tag tag;
         typedef mpl::true_ is_view;
@@ -115,14 +118,17 @@
 
     namespace result_of
     {
- template<typename Seq, int Size=integer_traits<int>::const_max-1>
+ template<
+ typename Seq
+ , typename Size=mpl::int_<integer_traits<int>::const_max-1>
+ >
         struct repeat
         {
             BOOST_FUSION_MPL_ASSERT((traits::is_sequence<Seq>));
             BOOST_FUSION_MPL_ASSERT((traits::is_forward<Seq>));
             BOOST_FUSION_MPL_ASSERT((mpl::or_<
                                 mpl:not_<result_of::empty<Seq> >
- , mpl::bool_<!Size>
+ , mpl::not_<Size>
>));
 
             typedef
@@ -131,7 +137,7 @@
         };
     };
 
- template<int Size, typename Seq>
+ template<typename Size, typename Seq>
     inline typename
         result_of::repeat<BOOST_FUSION_R_ELSE_CLREF(Seq),Size>::type
     repeat(BOOST_FUSION_R_ELSE_CLREF(Seq) seq)
@@ -143,7 +149,7 @@
     }
 
 #ifdef BOOST_NO_RVALUE_REFERENCES
- template<int Size, typename Seq>
+ template<typename Size, typename Seq>
     inline BOOST_FUSION_EXPLICIT_TEMPLATE_NON_CONST_ARG_OVERLOAD(
             result_of::repeat<,Seq,&, Size>)
     repeat(Seq& seq)

Modified: sandbox/SOC/2009/fusion/libs/fusion/test/Jamfile
==============================================================================
--- sandbox/SOC/2009/fusion/libs/fusion/test/Jamfile (original)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/Jamfile 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -96,10 +96,12 @@
     [ run sequence/zip_view_ignore.cpp : : : : ]
     [ run sequence/repetitive_view.cpp : : : : ]
     [ run sequence/deduce_sequence.cpp : : : : ]
- [ run sequence/adapt_class.cpp : : : : ]
     [ run sequence/adapt_struct.cpp : : : : ]
     [ run sequence/adapt_assoc_struct.cpp : : : : ]
-
+ [ run sequence/adapt_struct_named.cpp : : : : ]
+ [ run sequence/adapt_class.cpp : : : : ]
+ [ run sequence/adapt_class_named.cpp : : : : ]
+
     [ run functional/fused.cpp : : : : ]
     [ run functional/fused_function_object.cpp : : : : ]
     [ run functional/fused_procedure.cpp : : : : ]

Added: sandbox/SOC/2009/fusion/libs/fusion/test/sequence/adapt_class_named.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/sequence/adapt_class_named.cpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -0,0 +1,136 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 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)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/class/adapt_class_named.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+namespace ns
+{
+ class point
+ {
+ public:
+
+ point() : x(0), y(0) {}
+ point(int x, int y) : x(x), y(y) {}
+
+ int get_x() const { return x; }
+ int get_y() const { return y; }
+ void set_x(int x_) { x = x_; }
+ void set_y(int y_) { y = y_; }
+
+ private:
+
+ int x;
+ int y;
+ };
+}
+
+// this creates a fusion view: boost::fusion::adapted::point
+BOOST_FUSION_ADAPT_CLASS_NAMED(
+ ns::point, point,
+ (int, int, obj.obj.get_x(), obj.obj.set_x(val))
+ (int, int, obj.obj.get_y(), obj.obj.set_y(val))
+)
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<adapted::point>));
+ ns::point basep(123, 456);
+ adapted::point p(basep);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ BOOST_TEST(p == make_vector(6, 9));
+
+ BOOST_STATIC_ASSERT(result_of::size<adapted::point>::value == 2);
+ BOOST_STATIC_ASSERT(!result_of::empty<adapted::point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 9);
+ }
+
+ {
+ vector<int, float> v1(4, 2);
+ ns::point basep(5, 3);
+ adapted::point v2(basep);
+
+ vector<long, double> v3(5, 4);
+ 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 basep(5, 3);
+ adapted::point p(basep);
+
+ vector<int, short> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from ns::point to list
+ ns::point basep(5, 3);
+ adapted::point p(basep);
+
+ list<int, short> l(p);
+ l = p;
+ }
+
+ {
+ BOOST_MPL_ASSERT((boost::mpl::is_sequence<adapted::point>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ result_of::value_at_c<adapted::point,0>::type
+ , boost::mpl::front<adapted::point>::type>));
+ }
+
+ return boost::report_errors();
+}
+

Added: sandbox/SOC/2009/fusion/libs/fusion/test/sequence/adapt_struct_named.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/sequence/adapt_struct_named.cpp 2010-02-04 16:30:08 EST (Thu, 04 Feb 2010)
@@ -0,0 +1,137 @@
+/*=============================================================================
+ 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)
+==============================================================================*/
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/fusion/adapted/struct/adapt_struct_named.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/empty.hpp>
+#include <boost/fusion/sequence/intrinsic/front.hpp>
+#include <boost/fusion/sequence/intrinsic/back.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/list/list.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/vector/convert.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/comparison/not_equal_to.hpp>
+#include <boost/fusion/sequence/comparison/less.hpp>
+#include <boost/fusion/sequence/comparison/less_equal.hpp>
+#include <boost/fusion/sequence/comparison/greater.hpp>
+#include <boost/fusion/sequence/comparison/greater_equal.hpp>
+#include <boost/fusion/mpl.hpp>
+#include <boost/fusion/support/is_view.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/is_sequence.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <iostream>
+#include <string>
+
+namespace ns
+{
+ struct point
+ {
+ int x;
+ int y;
+ };
+}
+
+// this creates a fusion view: boost::fusion::adapted::point
+BOOST_FUSION_ADAPT_STRUCT_NAMED(
+ ns::point, point,
+ (int, x)
+ (int, y)
+)
+
+// this creates a fusion view: ns1::s1
+struct s { int m; };
+BOOST_FUSION_ADAPT_STRUCT_NAMED_NS(s, (ns1), s1, (int, m))
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ BOOST_MPL_ASSERT_NOT((traits::is_view<adapted::point>));
+ ns::point basep = {123, 456};
+ adapted::point p(basep);
+
+ std::cout << at_c<0>(p) << std::endl;
+ std::cout << at_c<1>(p) << std::endl;
+ std::cout << p << std::endl;
+ BOOST_TEST(p == make_vector(123, 456));
+
+ at_c<0>(p) = 6;
+ at_c<1>(p) = 9;
+ BOOST_TEST(p == make_vector(6, 9));
+
+ BOOST_STATIC_ASSERT(result_of::size<adapted::point>::value == 2);
+ BOOST_STATIC_ASSERT(!result_of::empty<adapted::point>::value);
+
+ BOOST_TEST(front(p) == 6);
+ BOOST_TEST(back(p) == 9);
+ }
+
+ {
+ vector<int, float> v1(4, 2);
+ ns::point p = {5, 3};
+ adapted::point v2(p);
+
+ vector<long, double> v3(5, 4);
+ 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 adapted::point to vector
+ ns::point basep = {5, 3};
+ adapted::point p(basep);
+ vector<int, short> v(p);
+ v = p;
+ }
+
+ {
+ // conversion from adapted::point to list
+ ns::point basep = {5, 3};
+ adapted::point p(basep);
+ list<int, short> l(p);
+ l = p;
+ }
+
+ { // begin/end
+ using namespace boost::fusion;
+ using boost::is_same;
+
+ typedef result_of::begin<ns1::s1>::type b;
+ typedef result_of::end<ns1::s1>::type e;
+ // this fails
+ BOOST_MPL_ASSERT((is_same<result_of::next<b>::type, e>));
+ }
+
+
+ {
+ BOOST_MPL_ASSERT((boost::mpl::is_sequence<adapted::point>));
+ BOOST_MPL_ASSERT((boost::is_same<
+ result_of::value_at_c<adapted::point,0>::type
+ , boost::mpl::front<adapted::point>::type>));
+ }
+
+ return boost::report_errors();
+}
+


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