Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59251 - in sandbox/SOC/2009/fusion: boost/fusion/adapted/class boost/fusion/adapted/detail/class boost/fusion/container/ext_ boost/proto libs/fusion/test/algorithm/ext_ libs/fusion/test/sequence/ext_
From: mr.chr.schmidt_at_[hidden]
Date: 2010-01-24 08:47:09


Author: cschmidt
Date: 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
New Revision: 59251
URL: http://svn.boost.org/trac/boost/changeset/59251

Log:
added adapt class & friends (2)
Added:
   sandbox/SOC/2009/fusion/boost/fusion/adapted/class/
   sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_assoc_class.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_class.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/adapt_base.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/at_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/begin_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/category_of_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/deref_data_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/deref_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/end_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/extension.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/is_sequence_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/is_view_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/key_of_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/size_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/value_at_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/value_of_data_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/value_of_impl.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/fusion/container/ext_/
   sandbox/SOC/2009/fusion/boost/fusion/container/ext_/tree.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/boost/proto/
   sandbox/SOC/2009/fusion/boost/proto/fusion.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/libs/fusion/test/algorithm/ext_/
   sandbox/SOC/2009/fusion/libs/fusion/test/algorithm/ext_/find_if_s.cpp (contents, props changed)
   sandbox/SOC/2009/fusion/libs/fusion/test/algorithm/ext_/for_each_s.cpp (contents, props changed)
   sandbox/SOC/2009/fusion/libs/fusion/test/sequence/ext_/
   sandbox/SOC/2009/fusion/libs/fusion/test/sequence/ext_/iterator_range_s.cpp (contents, props changed)

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_assoc_class.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_assoc_class.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,31 @@
+/*=============================================================================
+ 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_HPP
+#define BOOST_FUSION_ADAPTED_STRUCT_ADAPT_ASSOC_STRUCT_HPP
+
+#include <boost/fusion/support/internal/ref.hpp>
+
+#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>
+
+//TODO???
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_class.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/class/adapt_class.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,44 @@
+/*=============================================================================
+ 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_HPP
+#define BOOST_FUSION_ADAPTED_STRUCT_ADAPT_STRUCT_HPP
+
+#include <boost/fusion/support/internal/ref.hpp>
+#include <boost/preprocessor/cat.hpp>
+
+#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>
+
+#define BOOST_FUSION_ADAPT_CLASS_FILLER_0(A, B, C, D)\
+ ((A, B, C, D)) BOOST_FUSION_ADAPT_CLASS_FILLER_1
+#define BOOST_FUSION_ADAPT_CLASS_FILLER_1(A, B, C, D)\
+ ((A, B, C, D)) BOOST_FUSION_ADAPT_CLASS_FILLER_0
+#define BOOST_FUSION_ADAPT_CLASS_FILLER_0_END
+#define BOOST_FUSION_ADAPT_CLASS_FILLER_1_END
+
+#define BOOST_FUSION_ADAPT_CLASS(NAME, SEQ)\
+ BOOST_FUSION_ADAPT_STRUCT_BASE(\
+ NAME,\
+ class_tag,\
+ 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)
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/adapt_base.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/adapt_base.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,60 @@
+/*=============================================================================
+ 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_CLASS_ADAPT_BASE_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_ADAPT_BASE_HPP
+
+#include <boost/fusion/adapted/detail/struct/adapt_base.hpp>
+
+#define BOOST_FUSION_ADAPT_CLASS_C_BASE(NAME, I, TUPLE, MAX_SIZE) \
+namespace boost { namespace fusion { namespace extension \
+{ \
+ template <> \
+ 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; \
+ \
+ struct proxy \
+ { \
+ typedef BOOST_PP_TUPLE_ELEM(MAX_SIZE, 0, TUPLE) type; \
+ \
+ proxy(NAME& obj) \
+ : obj(obj) \
+ {} \
+ \
+ template<class Arg> \
+ proxy& \
+ operator=(BOOST_FUSION_R_ELSE_CLREF(Arg) val) \
+ { \
+ BOOST_PP_TUPLE_ELEM(MAX_SIZE, 3, TUPLE); \
+ return *this; \
+ } \
+ \
+ operator type() \
+ { \
+ return BOOST_PP_TUPLE_ELEM(MAX_SIZE, 2, TUPLE); \
+ } \
+ \
+ NAME& obj; \
+ }; \
+ \
+ static get_type \
+ call(NAME const& obj) \
+ { \
+ return BOOST_PP_TUPLE_ELEM(MAX_SIZE, 2, TUPLE); \
+ }; \
+ \
+ static proxy \
+ call(NAME& obj) \
+ { \
+ return proxy(obj); \
+ }; \
+ }; \
+}}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/at_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/at_impl.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,57 @@
+/*=============================================================================
+ 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_CLASS_AT_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_AT_IMPL_HPP
+
+#include <boost/fusion/support/internal/ref.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/remove_const.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template<typename>
+ struct at_impl;
+
+ template <>
+ struct at_impl<class_tag>
+ {
+ template<typename Seq, typename N>
+ struct apply
+ {
+ typedef typename detail::remove_reference<Seq>::type seq;
+ typedef
+ extension::struct_member<
+ typename remove_const<seq>::type
+ , N::value
+ >
+ element;
+
+ typedef typename
+ mpl::if_<
+ is_const<seq>
+ , typename element::get_type
+ , typename element::proxy
+ >::type
+ type;
+
+ static type
+ call(Seq seq)
+ {
+ return element::call(seq);
+ }
+ };
+ };
+
+ template <>
+ struct at_impl<assoc_class_tag>
+ : at_impl<class_tag>
+ {};
+}}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/begin_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/begin_impl.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,65 @@
+/*=============================================================================
+ 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_CLASS_BEGIN_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_BEGIN_IMPL_HPP
+
+#include <boost/fusion/iterator/basic_iterator.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template<typename>
+ struct begin_impl;
+
+ template <>
+ struct begin_impl<class_tag>
+ {
+ template <typename Seq>
+ struct apply
+ {
+ typedef
+ basic_iterator<
+ class_iterator_tag
+ , random_access_traversal_tag
+ , Seq
+ , 0
+ >
+ type;
+
+ static type
+ call(Seq seq)
+ {
+ return type(seq,0);
+ }
+ };
+ };
+
+ template <>
+ struct begin_impl<assoc_struct_tag>
+ {
+ template <typename Seq>
+ struct apply
+ {
+ typedef
+ basic_iterator<
+ assoc_class_iterator_tag
+ , assoc_class_category
+ , typename detail::add_lref<Seq>::type
+ , 0
+ >
+ type;
+
+ static type
+ call(Seq seq)
+ {
+ return type(seq,0);
+ }
+ };
+ };
+}}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/category_of_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/category_of_impl.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,32 @@
+/*=============================================================================
+ 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_CLASS_CATEGORY_OF_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_CATEGORY_OF_IMPL_HPP
+
+#include <boost/fusion/adapted/detail/struct/category_of_impl.hpp>
+
+namespace boost { namespace fusion
+{
+ namespace extension
+ {
+ template<typename>
+ struct category_of_impl;
+
+ template<>
+ struct category_of_impl<class_tag>
+ : category_of_impl<struct_tag>
+ {};
+
+ template<>
+ struct category_of_impl<assoc_class_tag>
+ : category_of_impl<assoc_struct_tag>
+ {};
+ }
+}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/deref_data_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/deref_data_impl.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,22 @@
+/*=============================================================================
+ 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_CLASS_DEREF_DATA_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_DEREF_DATA_IMPL_HPP
+
+namespace boost { namespace fusion { namespace extension
+{
+ template <typename>
+ struct deref_data_impl;
+
+ template <>
+ struct deref_data_impl<assoc_class_iterator_tag>
+ : deref_impl<assoc_class_iterator_tag>
+ {};
+}}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/deref_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/deref_impl.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,60 @@
+/*=============================================================================
+ 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_CLASS_DEREF_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_DEREF_IMPL_HPP
+
+#include <boost/fusion/support/internal/ref.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/remove_const.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template <typename>
+ struct deref_impl;
+
+ template <>
+ struct deref_impl<class_iterator_tag>
+ {
+ template <typename It>
+ struct apply
+ {
+ typedef typename detail::remove_reference<It>::type it;
+ typedef typename
+ detail::remove_reference<typename it::seq_type>::type
+ seq;
+ typedef
+ extension::struct_member<
+ typename remove_const<seq>::type
+ , it::index::value
+ >
+ element;
+
+ typedef typename
+ mpl::if_<
+ is_const<seq>
+ , typename element::get_type
+ , typename element::proxy
+ >::type
+ type;
+
+ static type
+ call(It it)
+ {
+ return element::call(*it.seq);
+ }
+ };
+ };
+
+ template <>
+ struct deref_impl<assoc_class_iterator_tag>
+ : deref_impl<class_iterator_tag>
+ {};
+}}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/end_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/end_impl.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,65 @@
+/*=============================================================================
+ 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_CLASS_END_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_END_IMPL_HPP
+
+#include <boost/fusion/iterator/basic_iterator.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template <typename>
+ struct end_impl;
+
+ template <>
+ struct end_impl<class_tag>
+ {
+ template <typename Seq>
+ struct apply
+ {
+ typedef
+ basic_iterator<
+ class_iterator_tag
+ , random_access_traversal_tag
+ , Seq
+ , struct_size<typename detail::identity<Seq>::type>::value
+ >
+ type;
+
+ static type
+ call(Seq seq)
+ {
+ return type(seq,0);
+ }
+ };
+ };
+
+ template <>
+ struct end_impl<assoc_class_tag>
+ {
+ template <typename Seq>
+ struct apply
+ {
+ typedef
+ basic_iterator<
+ assoc_class_iterator_tag
+ , assoc_class_category
+ , typename detail::add_lref<Seq>::type
+ , struct_size<typename detail::identity<Seq>::type>::value
+ >
+ type;
+
+ static type
+ call(Seq seq)
+ {
+ return type(seq,0);
+ }
+ };
+ };
+}}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/extension.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/extension.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,23 @@
+/*=============================================================================
+ 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_CLASS_EXTENSION_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_EXTENSION_HPP
+
+#include <boost/fusion/adapted/detail/struct/extension.hpp>
+
+namespace boost { namespace fusion
+{
+ struct class_tag;
+ struct class_iterator_tag;
+ struct assoc_class_tag;
+ struct assoc_class_iterator_tag;
+
+ typedef assoc_struct_category assoc_class_category;
+}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/is_sequence_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/is_sequence_impl.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 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_DETAIL_CLASS_IS_SEQUENCE_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_IS_SEQUENCE_IMPL_HPP
+
+#include <boost/fusion/adapted/detail/struct/is_sequence_impl.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template<typename>
+ struct is_sequence_impl;
+
+ template<>
+ struct is_sequence_impl<class_tag>
+ : is_sequence_impl<struct_tag>
+ {};
+
+ template <>
+ struct is_sequence_impl<assoc_class_tag>
+ : is_sequence_impl<assoc_struct_tag>
+ {};
+}}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/is_view_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/is_view_impl.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 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_DETAIL_CLASS_IS_VIEW_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_IS_VIEW_IMPL_HPP
+
+#include <boost/fusion/adapted/detail/struct/is_view_impl.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template<typename>
+ struct is_view_impl;
+
+ template<>
+ struct is_view_impl<class_tag>
+ : is_view_impl<struct_tag>
+ {};
+
+ template <>
+ struct is_view_impl<assoc_class_tag>
+ : is_view_impl<assoc_struct_tag>
+ {};
+}}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/key_of_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/key_of_impl.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,24 @@
+/*=============================================================================
+ 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_CLASS_KEY_OF_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_KEY_OF_IMPL_HPP
+
+#include <boost/fusion/adapted/detail/struct/key_of_impl.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template <typename>
+ struct key_of_impl;
+
+ template <>
+ struct key_of_impl<assoc_class_iterator_tag>
+ : key_of_impl<assoc_struct_iterator_tag>
+ {};
+}}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/size_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/size_impl.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 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_DETAIL_CLASS_SIZE_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_SIZE_IMPL_HPP
+
+#include <boost/fusion/adapted/detail/struct/size_impl.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template<typename>
+ struct size_impl;
+
+ template <>
+ struct size_impl<class_tag>
+ : size_impl<struct_tag>
+ {};
+
+ template <>
+ struct size_impl<assoc_class_tag>
+ : size_impl<assoc_struct_tag>
+ {};
+}}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/value_at_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/value_at_impl.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 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_DETAIL_CLASS_VALUE_AT_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_VALUE_AT_IMPL_HPP
+
+#include <boost/fusion/adapted/detail/struct/value_at_impl.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template<typename>
+ struct value_at_impl;
+
+ template <>
+ struct value_at_impl<class_tag>
+ : value_at_impl<struct_tag>
+ {};
+
+ template <>
+ struct value_at_impl<assoc_class_tag>
+ : value_at_impl<assoc_struct_tag>
+ {};
+}}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/value_of_data_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/value_of_data_impl.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,24 @@
+/*=============================================================================
+ 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_CLASS_VALUE_OF_DATA_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_VALUE_OF_DATA_IMPL_HPP
+
+#include <boost/fusion/adapted/detail/struct/value_of_data_impl.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template <typename>
+ struct value_of_data_impl;
+
+ template <>
+ struct value_of_data_impl<assoc_class_iterator_tag>
+ : value_of_data_impl<assoc_struct_iterator_tag>
+ {};
+}}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/value_of_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/adapted/detail/class/value_of_impl.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 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_DETAIL_CLASS_VALUE_OF_IMPL_HPP
+#define BOOST_FUSION_ADAPTED_DETAIL_CLASS_VALUE_OF_IMPL_HPP
+
+#include <boost/fusion/adapted/detail/struct/value_of_impl.hpp>
+
+namespace boost { namespace fusion { namespace extension
+{
+ template <typename>
+ struct value_of_impl;
+
+ template <>
+ struct value_of_impl<class_iterator_tag>
+ : value_of_impl<struct_iterator_tag>
+ {};
+
+ template <>
+ struct value_of_impl<assoc_class_iterator_tag>
+ : value_of_impl<class_iterator_tag>
+ {};
+}}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/fusion/container/ext_/tree.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/fusion/container/ext_/tree.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,198 @@
+/*=============================================================================
+ Copyright (c) 2006 Eric Niebler
+ Copyright (c) 2010 Christopher Schmidt
+
+ Use, modification and distribution is subject to 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)
+==============================================================================*/
+
+//TODO: ctor, refactoring in detail files, make_tree in gen etc.
+
+#ifndef BOOST_FUSION_CONTAINER_EXT_TREE_HPP
+#define BOOST_FUSION_CONTAINER_EXT_TREE_HPP
+
+#include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
+#include <boost/fusion/container/list/cons.hpp>
+#ifdef BOOST_NO_VARIADIC_TEMPLATES
+# include <boost/fusion/container/vector/vector10.hpp>
+#else
+# include <boost/fusion/container/vector/vector.hpp>
+#endif
+#include <boost/fusion/view/single_view.hpp>
+#include <boost/fusion/view/ext_/segmented_iterator.hpp>
+#include <boost/fusion/support/ext_/is_segmented.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/internal/ref.hpp>
+#include <boost/fusion/support/sequence_base.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#ifdef BOOST_NO_RVALUE_REFERENCES
+# include <boost/call_traits.hpp>
+#endif
+#include <boost/type_traits/is_const.hpp>
+
+namespace boost { namespace fusion
+{
+ struct tree_tag;
+
+ namespace detail
+ {
+ template<typename T, bool IsConst>
+ struct reference : add_reference<T> {};
+
+ template<typename T>
+ struct reference<T, true> : reference<typename add_const<T>::type, false> {};
+
+ template<typename T>
+ struct reference<T &, true> : reference<T, false> {};
+ }
+
+ template<typename Data, typename Left = nil, typename Right = nil>
+ struct tree
+ : sequence_base<tree<Data, Left, Right> >
+ {
+ typedef Data data_type;
+ typedef Left left_type;
+ typedef Right right_type;
+ typedef typename
+ mpl::if_<traits::is_sequence<Data>, Data, single_view<Data> >::type
+ data_view;
+#ifdef BOOST_NO_VARIADIC_TEMPLATES
+ typedef vector3<Left, data_view, Right> segments_type;
+#else
+ typedef vector<Left, data_view, Right> segments_type;
+#endif
+
+ typedef tree_tag fusion_tag;
+ typedef forward_traversal_tag category;
+ typedef mpl::false_ is_view;
+
+ tree()
+ {}
+
+#ifdef BOOST_NO_RVALUE_REFERENCES
+ explicit
+ tree(typename call_traits<Data>::type data,
+ typename call_traits<Left>::type left = Left(),
+ typename call_traits<Right>::type right = Right())
+ : segments(left, data, right)
+ {}
+#else
+ template<class OtherData, class OtherLeft=Left, class OtherRight=Right>
+ explicit
+ tree(OtherData&& data,
+ OtherLeft&& left = Left(),
+ OtherRight&& right = Right())
+ : segments(std::forward<OtherLeft>(left),
+ std::forward<OtherData>(data),
+ std::forward<OtherRight>(right))
+ {}
+#endif
+
+ segments_type segments;
+ };
+
+ template<typename Data>
+ tree<typename traits::deduce<Data>::type>
+ make_tree(BOOST_FUSION_R_ELSE_CLREF(Data) data)
+ {
+ return tree<typename traits::deduce<Data>::type>(
+ BOOST_FUSION_FORWARD(Data,data));
+ }
+
+ template<typename Data, typename Left, typename Right>
+ tree<
+ typename traits::deduce<Data>::type
+ , typename traits::deduce<Left>::type
+ , typename traits::deduce<Right>::type
+ >
+ make_tree(BOOST_FUSION_R_ELSE_CLREF(Data) data,
+ BOOST_FUSION_R_ELSE_CLREF(Left) left,
+ BOOST_FUSION_R_ELSE_CLREF(Right) right)
+ {
+ return tree<
+ typename traits::deduce<Data>::type
+ , typename traits::deduce<Left>::type
+ , typename traits::deduce<Right>::type
+ >(BOOST_FUSION_FORWARD(Data,data),
+ BOOST_FUSION_FORWARD(Left,left),
+ BOOST_FUSION_FORWARD(Right,right));
+ }
+
+ namespace extension
+ {
+ template<typename>
+ struct empty_impl;
+
+ template<>
+ struct empty_impl<tree_tag>
+ {
+ template<typename SeqRef>
+ struct apply
+ : mpl::false_
+ {};
+ };
+
+ template<typename>
+ struct is_segmented_impl;
+
+ template<>
+ struct is_segmented_impl<tree_tag>
+ {
+ template<typename SeqRef>
+ struct apply
+ : mpl::true_
+ {};
+ };
+
+ template<typename>
+ struct segments_impl;
+
+ template<>
+ struct segments_impl<tree_tag>
+ {
+ template<typename SeqRef>
+ struct apply
+ {
+ typedef typename detail::remove_reference<SeqRef>::type seq;
+
+ typedef typename
+ detail::forward_as<SeqRef,typename seq::segments_type>::type
+ type;
+
+ static type
+ call(SeqRef seq)
+ {
+ return seq.segments;
+ }
+ };
+ };
+
+ template<typename>
+ struct begin_impl;
+
+ template<>
+ struct begin_impl<tree_tag>
+ {
+ template<typename SeqRef>
+ struct apply
+ : segmented_begin<SeqRef>
+ {};
+ };
+
+ template<typename>
+ struct end_impl;
+
+ template<>
+ struct end_impl<tree_tag>
+ {
+ template<typename SeqRef>
+ struct apply
+ : segmented_end<SeqRef>
+ {};
+ };
+ }
+}}
+
+#endif

Added: sandbox/SOC/2009/fusion/boost/proto/fusion.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/boost/proto/fusion.hpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,767 @@
+///////////////////////////////////////////////////////////////////////////////
+/// \file fusion.hpp
+/// Make any Proto expression a valid Fusion sequence
+//
+// Copyright 2008 Eric Niebler. 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_PROTO_FUSION_HPP_EAN_11_04_2006
+#define BOOST_PROTO_FUSION_HPP_EAN_11_04_2006
+
+#include <boost/config.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/long.hpp>
+#include <boost/mpl/sequence_tag_fwd.hpp>
+#include <boost/fusion/include/is_view.hpp>
+#include <boost/fusion/include/tag_of_fwd.hpp>
+#include <boost/fusion/include/category_of.hpp>
+#include <boost/fusion/include/iterator_base.hpp>
+#include <boost/fusion/include/intrinsic.hpp>
+#include <boost/fusion/include/pop_front.hpp>
+#include <boost/fusion/include/reverse.hpp>
+#include <boost/fusion/include/single_view.hpp>
+#include <boost/fusion/include/transform_view.hpp>
+#include <boost/fusion/support/ext_/is_segmented.hpp>
+#include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
+#include <boost/fusion/sequence/intrinsic/ext_/size_s.hpp>
+#include <boost/fusion/view/ext_/segmented_iterator.hpp>
+#include <boost/proto/proto_fwd.hpp>
+#include <boost/proto/traits.hpp>
+#include <boost/proto/eval.hpp>
+
+#if BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable : 4510) // default constructor could not be generated
+#pragma warning(disable : 4512) // assignment operator could not be generated
+#pragma warning(disable : 4610) // can never be instantiated - user defined constructor required
+#endif
+
+namespace boost { namespace proto
+{
+
+ namespace detail
+ {
+
+ template<typename Expr, long Pos>
+ struct expr_iterator
+ : fusion::iterator_base<expr_iterator<Expr, Pos> >
+ {
+ typedef Expr expr_type;
+ typedef typename Expr::proto_tag proto_tag;
+ BOOST_STATIC_CONSTANT(long, index = Pos);
+ typedef fusion::random_access_traversal_tag category;
+ typedef tag::proto_expr_iterator fusion_tag;
+
+ expr_iterator(Expr const &e)
+ : expr(e)
+ {}
+
+ Expr const &expr;
+ };
+
+ template<typename Expr>
+ struct flat_view
+ {
+ typedef Expr expr_type;
+ typedef typename Expr::proto_tag proto_tag;
+ typedef fusion::forward_traversal_tag category;
+ typedef tag::proto_flat_view fusion_tag;
+
+ explicit flat_view(Expr &e)
+ : expr_(e)
+ {}
+
+ Expr &expr_;
+ };
+
+ template<typename Tag>
+ struct as_element
+ {
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ : result<This(Expr const &)>
+ {};
+
+ template<typename This, typename Expr>
+ struct result<This(Expr &)>
+ : mpl::if_c<
+ is_same<Tag, typename Expr::proto_tag>::value
+ , flat_view<Expr>
+ , fusion::single_view<Expr &>
+ >
+ {};
+
+ template<typename Expr>
+ typename result<as_element(Expr &)>::type const
+ operator ()(Expr &e) const
+ {
+ return typename result<as_element(Expr &)>::type(e);
+ }
+
+ template<typename Expr>
+ typename result<as_element(Expr const &)>::type const
+ operator ()(Expr const &e) const
+ {
+ return typename result<as_element(Expr const &)>::type(e);
+ }
+ };
+ }
+
+ namespace result_of
+ {
+ template<typename Expr>
+ struct flatten
+ : flatten<Expr const &>
+ {};
+
+ template<typename Expr>
+ struct flatten<Expr &>
+ {
+ typedef detail::flat_view<Expr> type;
+ };
+ }
+
+ namespace functional
+ {
+ /// \brief A PolymorphicFunctionObject type that returns a "flattened"
+ /// view of a Proto expression tree.
+ ///
+ /// A PolymorphicFunctionObject type that returns a "flattened"
+ /// view of a Proto expression tree. For a tree with a top-most node
+ /// tag of type \c T, the elements of the flattened sequence are
+ /// determined by recursing into each child node with the same
+ /// tag type and returning those nodes of different type. So for
+ /// instance, the Proto expression tree corresponding to the
+ /// expression <tt>a | b | c</tt> has a flattened view with elements
+ /// [a, b, c], even though the tree is grouped as
+ /// <tt>((a | b) | c)</tt>.
+ struct flatten
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ : result<This(Expr const &)>
+ {};
+
+ template<typename This, typename Expr>
+ struct result<This(Expr &)>
+ {
+ typedef proto::detail::flat_view<Expr> type;
+ };
+
+ template<typename Expr>
+ proto::detail::flat_view<Expr> const
+ operator ()(Expr &e) const
+ {
+ return proto::detail::flat_view<Expr>(e);
+ }
+
+ template<typename Expr>
+ proto::detail::flat_view<Expr const> const
+ operator ()(Expr const &e) const
+ {
+ return proto::detail::flat_view<Expr const>(e);
+ }
+ };
+
+ /// \brief A PolymorphicFunctionObject type that invokes the
+ /// \c fusion::pop_front() algorithm on its argument.
+ ///
+ /// A PolymorphicFunctionObject type that invokes the
+ /// \c fusion::pop_front() algorithm on its argument. This is
+ /// useful for defining a CallableTransform like \c pop_front(_)
+ /// which removes the first child from a Proto expression node.
+ /// Such a transform might be used as the first argument to the
+ /// \c proto::fold\<\> transform; that is, fold all but
+ /// the first child.
+ struct pop_front
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ : result<This(Expr const &)>
+ {};
+
+ template<typename This, typename Expr>
+ struct result<This(Expr &)>
+ : fusion::result_of::pop_front<Expr>
+ {};
+
+ template<typename Expr>
+ typename fusion::result_of::pop_front<Expr>::type
+ operator ()(Expr &e) const
+ {
+ return fusion::pop_front(e);
+ }
+
+ template<typename Expr>
+ typename fusion::result_of::pop_front<Expr const>::type
+ operator ()(Expr const &e) const
+ {
+ return fusion::pop_front(e);
+ }
+ };
+
+ /// \brief A PolymorphicFunctionObject type that invokes the
+ /// \c fusion::reverse() algorithm on its argument.
+ ///
+ /// A PolymorphicFunctionObject type that invokes the
+ /// \c fusion::reverse() algorithm on its argument. This is
+ /// useful for defining a CallableTransform like \c reverse(_)
+ /// which reverses the order of the children of a Proto
+ /// expression node.
+ struct reverse
+ {
+ BOOST_PROTO_CALLABLE()
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ : result<This(Expr const &)>
+ {};
+
+ template<typename This, typename Expr>
+ struct result<This(Expr &)>
+ : fusion::result_of::reverse<Expr>
+ {};
+
+ template<typename Expr>
+ typename fusion::result_of::reverse<Expr>::type
+ operator ()(Expr &e) const
+ {
+ return fusion::reverse(e);
+ }
+
+ template<typename Expr>
+ typename fusion::result_of::reverse<Expr const>::type
+ operator ()(Expr const &e) const
+ {
+ return fusion::reverse(e);
+ }
+ };
+ }
+
+ /// \brief A function that returns a "flattened"
+ /// view of a Proto expression tree.
+ ///
+ /// For a tree with a top-most node
+ /// tag of type \c T, the elements of the flattened sequence are
+ /// determined by recursing into each child node with the same
+ /// tag type and returning those nodes of different type. So for
+ /// instance, the Proto expression tree corresponding to the
+ /// expression <tt>a | b | c</tt> has a flattened view with elements
+ /// [a, b, c], even though the tree is grouped as
+ /// <tt>((a | b) | c)</tt>.
+ template<typename Expr>
+ proto::detail::flat_view<Expr> const
+ flatten(Expr &e)
+ {
+ return proto::detail::flat_view<Expr>(e);
+ }
+
+ /// \overload
+ ///
+ template<typename Expr>
+ proto::detail::flat_view<Expr const> const
+ flatten(Expr const &e)
+ {
+ return proto::detail::flat_view<Expr const>(e);
+ }
+
+ /// INTERNAL ONLY
+ ///
+ template<>
+ struct is_callable<functional::flatten>
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<>
+ struct is_callable<functional::pop_front>
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<>
+ struct is_callable<functional::reverse>
+ : mpl::true_
+ {};
+
+ /// INTERNAL ONLY
+ ///
+ template<typename Context>
+ struct eval_fun
+ {
+ explicit eval_fun(Context &ctx)
+ : ctx_(ctx)
+ {}
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr>
+ struct result<This(Expr)>
+ : result<This(Expr const &)>
+ {};
+
+ template<typename This, typename Expr>
+ struct result<This(Expr &)>
+ : proto::result_of::eval<Expr, Context>
+ {};
+
+ template<typename Expr>
+ typename proto::result_of::eval<Expr, Context>::type
+ operator ()(Expr &e) const
+ {
+ return proto::eval(e, this->ctx_);
+ }
+
+ template<typename Expr>
+ typename proto::result_of::eval<Expr const, Context>::type
+ operator ()(Expr const &e) const
+ {
+ return proto::eval(e, this->ctx_);
+ }
+
+ private:
+ Context &ctx_;
+ };
+}}
+
+namespace boost { namespace fusion
+{
+ namespace extension
+ {
+
+ template<typename Tag>
+ struct is_view_impl;
+
+ template<>
+ struct is_view_impl<proto::tag::proto_flat_view>
+ {
+ template<typename Sequence>
+ struct apply
+ : mpl::true_
+ {};
+ };
+
+ template<>
+ struct is_view_impl<proto::tag::proto_expr>
+ {
+ template<typename Sequence>
+ struct apply
+ : mpl::false_
+ {};
+ };
+
+ template<typename Tag>
+ struct equal_to_impl;
+
+ template<>
+ struct equal_to_impl<proto::tag::proto_expr_iterator>
+ {
+ template<class It1, class It2>
+ class apply
+ : public is_same<
+ typename remove_const<typename remove_reference<It1>::type>::type
+ , typename remove_const<typename remove_reference<It2>::type>::type
+ >
+ {};
+ };
+
+ template<typename Tag>
+ struct value_of_impl;
+
+ template<>
+ struct value_of_impl<proto::tag::proto_expr_iterator>
+ {
+ template<
+ typename Iterator
+ , long Arity = proto::arity_of<typename remove_reference<Iterator>::type::expr_type>::value
+ >
+ struct apply
+ {
+
+ typedef typename detail::remove_reference<Iterator>::type it;
+
+ typedef
+ typename proto::result_of::child_c<
+ typename it::expr_type
+ , it::index
+ >::value_type
+ type;
+ };
+
+ template<typename Iterator>
+ struct apply<Iterator, 0>
+ {
+ typedef typename detail::remove_reference<Iterator>::type it;
+
+ typedef
+ typename proto::result_of::value<
+ typename it::expr_type
+ >::value_type
+ type;
+ };
+ };
+
+ template<typename Tag>
+ struct deref_impl;
+
+ template<>
+ struct deref_impl<proto::tag::proto_expr_iterator>
+ {
+ template<
+ typename Iterator
+ , long Arity = proto::arity_of<typename remove_reference<Iterator>::type::expr_type>::value
+ >
+ struct apply
+ {
+ typedef typename detail::remove_reference<Iterator>::type it;
+
+ typedef
+ typename proto::result_of::child_c<
+ typename it::expr_type const &
+ , it::index
+ >::type
+ type;
+
+ static type call(Iterator iter)
+ {
+ return proto::child_c<it::index>(iter.expr);
+ }
+ };
+
+ template<typename Iterator>
+ struct apply<Iterator, 0>
+ {
+ typedef typename detail::remove_reference<Iterator>::type it;
+
+ typedef
+ typename proto::result_of::value<
+ typename it::expr_type const &
+ >::type
+ type;
+
+ static type call(Iterator iter)
+ {
+ return proto::value(iter.expr);
+ }
+ };
+ };
+
+ template<typename Tag>
+ struct advance_impl;
+
+ template<>
+ struct advance_impl<proto::tag::proto_expr_iterator>
+ {
+ template<typename Iterator, typename N>
+ struct apply
+ {
+ typedef typename detail::remove_reference<Iterator>::type it;
+
+ typedef
+ typename proto::detail::expr_iterator<
+ typename it::expr_type
+ , it::index + N::value
+ >
+ type;
+
+ static type call(Iterator iter)
+ {
+ return type(iter.expr);
+ }
+ };
+ };
+
+ template<typename Tag>
+ struct distance_impl;
+
+ template<>
+ struct distance_impl<proto::tag::proto_expr_iterator>
+ {
+ template<typename IteratorFrom, typename IteratorTo>
+ struct apply
+ : mpl::long_<remove_reference<IteratorTo>::type::index - remove_reference<IteratorFrom>::type::index>
+ {};
+ };
+
+ template<typename Tag>
+ struct next_impl;
+
+ template<>
+ struct next_impl<proto::tag::proto_expr_iterator>
+ {
+ template<typename Iterator>
+ struct apply
+ : advance_impl<proto::tag::proto_expr_iterator>::template apply<Iterator, mpl::long_<1> >
+ {};
+ };
+
+ template<typename Tag>
+ struct prior_impl;
+
+ template<>
+ struct prior_impl<proto::tag::proto_expr_iterator>
+ {
+ template<typename Iterator>
+ struct apply
+ : advance_impl<proto::tag::proto_expr_iterator>::template apply<Iterator, mpl::long_<-1> >
+ {};
+ };
+
+ template<typename Tag>
+ struct category_of_impl;
+
+ template<>
+ struct category_of_impl<proto::tag::proto_expr>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ typedef random_access_traversal_tag type;
+ };
+ };
+
+ template<typename Tag>
+ struct size_impl;
+
+ template<>
+ struct size_impl<proto::tag::proto_expr>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ typedef typename detail::remove_reference<Sequence>::type seq;
+
+ typedef mpl::long_<0 == seq::proto_arity_c ? 1 : seq::proto_arity_c> type;
+ };
+ };
+
+ template<typename Tag>
+ struct begin_impl;
+
+ template<>
+ struct begin_impl<proto::tag::proto_expr>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ typedef typename detail::remove_reference<Sequence>::type seq;
+ typedef proto::detail::expr_iterator<seq, 0> type;
+
+ static type call(Sequence seq)
+ {
+ return type(seq);
+ }
+ };
+ };
+
+ template<typename Tag>
+ struct end_impl;
+
+ template<>
+ struct end_impl<proto::tag::proto_expr>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ typedef typename detail::remove_reference<Sequence>::type seq;
+
+ typedef
+ proto::detail::expr_iterator<
+ seq
+ , 0 == seq::proto_arity_c ? 1 : seq::proto_arity_c
+ >
+ type;
+
+ static type call(Sequence seq)
+ {
+ return type(seq);
+ }
+ };
+ };
+
+ template<typename Tag>
+ struct value_at_impl;
+
+ template<>
+ struct value_at_impl<proto::tag::proto_expr>
+ {
+ template<
+ typename Sequence
+ , typename Index
+ , long Arity = proto::arity_of<typename remove_reference<Sequence>::type>::value
+ >
+ struct apply
+ {
+ typedef typename detail::remove_reference<Sequence>::type seq;
+
+ typedef
+ typename proto::result_of::child_c<
+ seq
+ , Index::value
+ >::value_type
+ type;
+ };
+
+ template<typename Sequence, typename Index>
+ struct apply<Sequence, Index, 0>
+ {
+ typedef typename detail::remove_reference<Sequence>::type seq;
+
+ typedef
+ typename proto::result_of::value<
+ seq
+ >::value_type
+ type;
+ };
+ };
+
+ template<typename Tag>
+ struct at_impl;
+
+ template<>
+ struct at_impl<proto::tag::proto_expr>
+ {
+ template<
+ typename Sequence
+ , typename Index
+ , long Arity = proto::arity_of<Sequence>::value
+ >
+ struct apply
+ {
+ typedef
+ typename proto::result_of::child_c<
+ Sequence &
+ , Index::value
+ >::type
+ type;
+
+ static type call(Sequence &seq)
+ {
+ return proto::child_c<Index::value>(seq);
+ }
+ };
+
+ template<typename Sequence, typename Index>
+ struct apply<Sequence, Index, 0>
+ {
+ typedef
+ typename proto::result_of::value<
+ Sequence
+ >::type
+ type;
+
+ static type call(Sequence seq)
+ {
+ return proto::value(seq);
+ }
+ };
+ };
+
+ template<typename Tag>
+ struct is_segmented_impl;
+
+ template<>
+ struct is_segmented_impl<proto::tag::proto_flat_view>
+ {
+ template<typename Iterator>
+ struct apply
+ : mpl::true_
+ {};
+ };
+
+ template<typename Tag>
+ struct segments_impl;
+
+ template<>
+ struct segments_impl<proto::tag::proto_flat_view>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ typedef typename Sequence::proto_tag proto_tag;
+
+ typedef fusion::transform_view<
+ typename Sequence::expr_type
+ , proto::detail::as_element<proto_tag>
+ > type;
+
+ static type call(Sequence &sequence)
+ {
+ return type(sequence.expr_, proto::detail::as_element<proto_tag>());
+ }
+ };
+ };
+
+ template<>
+ struct category_of_impl<proto::tag::proto_flat_view>
+ {
+ template<typename Sequence>
+ struct apply
+ {
+ typedef forward_traversal_tag type;
+ };
+ };
+
+ template<>
+ struct begin_impl<proto::tag::proto_flat_view>
+ {
+ template<typename Sequence>
+ struct apply
+ : fusion::segmented_begin<typename fusion::detail::remove_reference<Sequence>::type>
+ {};
+ };
+
+ template<>
+ struct end_impl<proto::tag::proto_flat_view>
+ {
+ template<typename Sequence>
+ struct apply
+ : fusion::segmented_end<typename fusion::detail::remove_reference<Sequence>::type>
+ {};
+ };
+
+ template<>
+ struct size_impl<proto::tag::proto_flat_view>
+ {
+ template<typename Sequence>
+ struct apply
+ : fusion::result_of::segmented_size<typename fusion::detail::remove_reference<Sequence>::type>
+ {};
+ };
+ }
+}}
+
+namespace boost { namespace mpl
+{
+ template<typename Tag, typename Args, long Arity>
+ struct sequence_tag< proto::expr<Tag, Args, Arity> >
+ {
+ typedef fusion::fusion_sequence_tag type;
+ };
+}}
+
+#if BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+#endif

Added: sandbox/SOC/2009/fusion/libs/fusion/test/algorithm/ext_/find_if_s.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/algorithm/ext_/find_if_s.cpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,109 @@
+/*=============================================================================
+ Copyright (c) 2001-2006 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/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/algorithm/query/ext_/find_if_s.hpp>
+#include <boost/fusion/container/ext_/tree.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <boost/mpl/less.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+struct X
+{
+ operator int() const
+ {
+ return 12345;
+ }
+};
+
+template<typename Tree>
+void
+process_tree(Tree const &tree)
+{
+ using namespace boost;
+ using mpl::_;
+
+ typedef typename fusion::result_of::find_if_s<Tree const, is_same<_,short> >::type short_iter;
+ typedef typename fusion::result_of::find_if_s<Tree const, is_same<_,float> >::type float_iter;
+
+ // find_if_s of a segmented data structure returns generic
+ // segmented iterators
+ short_iter si = fusion::find_if_s<is_same<_,short> >(tree);
+ float_iter fi = fusion::find_if_s<is_same<_,float> >(tree);
+
+ // they behave like ordinary Fusion iterators ...
+ BOOST_TEST((*si == short('d')));
+ BOOST_TEST((*fi == float(1)));
+}
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ {
+ using boost::is_same;
+ using boost::mpl::_;
+
+ typedef vector<int, char, int, double> vector_type;
+ vector_type v(12345, 'x', 678910, 3.36);
+
+ std::cout << *find_if_s<is_same<_, char> >(v) << std::endl;
+ BOOST_TEST((*find_if_s<is_same<_, char> >(v) == 'x'));
+
+ std::cout << *find_if_s<is_same<_, int> >(v) << std::endl;
+ BOOST_TEST((*find_if_s<is_same<_, int> >(v) == 12345));
+
+ std::cout << *find_if_s<is_same<_, double> >(v) << std::endl;
+ BOOST_TEST((*find_if_s<is_same<_, double> >(v) == 3.36));
+ }
+
+ {
+ using boost::mpl::vector;
+ using boost::is_same;
+ using boost::mpl::_;
+
+ typedef vector<int, char, X, double> mpl_vec;
+ BOOST_TEST((*find_if_s<is_same<_, X> >(mpl_vec()) == 12345));
+ }
+
+ {
+ using boost::mpl::vector_c;
+ using boost::mpl::less;
+ using boost::mpl::int_;
+ using boost::is_same;
+ using boost::mpl::_;
+
+ typedef vector_c<int, 1, 2, 3, 4> mpl_vec;
+ BOOST_TEST((*find_if_s<less<_, int_<3> > >(mpl_vec()) == 1));
+ }
+
+ {
+ process_tree(
+ make_tree(
+ make_vector(double(0),'B')
+ , make_tree(
+ make_vector(1,2,long(3))
+ , make_tree(make_vector('a','b','c'))
+ , make_tree(make_vector(short('d'),'e','f'))
+ )
+ , make_tree(
+ make_vector(4,5,6)
+ , make_tree(make_vector(float(1),'h','i'))
+ , make_tree(make_vector('j','k','l'))
+ )
+ )
+ );
+ }
+
+ return boost::report_errors();
+}
+

Added: sandbox/SOC/2009/fusion/libs/fusion/test/algorithm/ext_/for_each_s.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/algorithm/ext_/for_each_s.cpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,82 @@
+/*=============================================================================
+ Copyright (c) 2001-2006 Joel de Guzman, Eric Niebler
+
+ 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/container/vector/vector.hpp>
+#include <boost/fusion/adapted/mpl.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/algorithm/iteration/ext_/for_each_s.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/container/ext_/tree.hpp>
+
+struct print
+{
+ template <typename T>
+ void operator()(T const& v) const
+ {
+ std::cout << "[ " << v << " ] ";
+ }
+};
+
+struct increment
+{
+ template <typename T>
+ void operator()(T& v) const
+ {
+ ++v;
+ }
+};
+
+int
+main()
+{
+ using namespace boost::fusion;
+ using boost::mpl::vector_c;
+ namespace fusion = boost::fusion;
+
+ {
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type v(1, 'x', 3.3, "Ruby");
+ for_each_s(v, print());
+ std::cout << std::endl;
+ }
+
+ {
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type v(1, 'x', 3.3, "Ruby");
+ for_each_s(v, increment());
+ std::cout << v << std::endl;
+ }
+
+ {
+ typedef vector_c<int, 2, 3, 4, 5, 6> mpl_vec;
+ fusion::for_each_s(mpl_vec(), print());
+ std::cout << std::endl;
+ }
+
+ {
+ fusion::for_each_s(
+ make_tree(
+ make_vector(double(0),'B')
+ , make_tree(
+ make_vector(1,2,long(3))
+ , make_tree(make_vector('a','b','c'))
+ , make_tree(make_vector(short('d'),'e','f'))
+ )
+ , make_tree(
+ make_vector(4,5,6)
+ , make_tree(make_vector(float(1),'h','i'))
+ , make_tree(make_vector('j','k','l'))
+ )
+ )
+ , print()
+ );
+ }
+
+ return boost::report_errors();
+}
+

Added: sandbox/SOC/2009/fusion/libs/fusion/test/sequence/ext_/iterator_range_s.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/sequence/ext_/iterator_range_s.cpp 2010-01-24 08:47:07 EST (Sun, 24 Jan 2010)
@@ -0,0 +1,146 @@
+/*=============================================================================
+ Copyright (c) 2001-2006 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/algorithm/iteration/ext_/for_each_s.hpp>
+#include <boost/fusion/algorithm/query/ext_/find_if_s.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/container/ext_/tree.hpp>
+#include <boost/fusion/container/generation/make_vector.hpp>
+#include <boost/fusion/view/iterator_range/iterator_range.hpp>
+#include <boost/fusion/view/ext_/segmented_iterator_range.hpp>
+#include <boost/fusion/sequence/comparison/equal_to.hpp>
+#include <boost/fusion/sequence/io/out.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/mpl/vector_c.hpp>
+#include <boost/mpl/begin.hpp>
+#include <boost/mpl/next.hpp>
+#include <boost/static_assert.hpp>
+#include <sstream>
+
+struct ostream_fun
+{
+ ostream_fun(std::ostream &sout)
+ : sout_(sout)
+ {}
+ template<typename T>
+ void operator ()(T const &t) const
+ {
+ sout_ << t << ' ';
+ }
+private:
+ std::ostream & sout_;
+};
+
+template<typename Tree>
+void
+process_tree(Tree const &tree)
+{
+ using namespace boost;
+ using namespace fusion;
+ using mpl::_;
+
+ typedef typename fusion::result_of::find_if_s<Tree const, is_same<_,short> >::type short_iter;
+ typedef typename fusion::result_of::find_if_s<Tree const, is_same<_,float> >::type float_iter;
+
+ typedef iterator_range<short_iter, float_iter> slice_t;
+ BOOST_STATIC_ASSERT(traits::is_segmented<slice_t>::value);
+
+ // find_if_s of a segmented data structure returns generic
+ // segmented iterators
+ short_iter si = find_if_s<is_same<_,short> >(tree);
+ float_iter fi = find_if_s<is_same<_,float> >(tree);
+
+ // If you put them in an iterator range, the range
+ // is automatically a segmented data structure.
+ slice_t slice(si, fi);
+
+ std::stringstream sout;
+ fusion::for_each_s(slice, ostream_fun(sout));
+ BOOST_TEST((sout.str() == "100 e f 0 B "));
+}
+
+int
+main()
+{
+ using namespace boost::fusion;
+
+ std::cout << tuple_open('[');
+ std::cout << tuple_close(']');
+ std::cout << tuple_delimiter(", ");
+
+ {
+ char const* s = "Ruby";
+ typedef vector<int, char, double, char const*> vector_type;
+ vector_type vec(1, 'x', 3.3, s);
+
+ {
+ typedef vector_iterator<vector_type, 1> i1t;
+ typedef vector_iterator<vector_type, 3> i3t;
+
+ i1t i1(vec);
+ i3t i3(vec);
+
+ typedef iterator_range<i1t, i3t> slice_t;
+ slice_t slice(i1, i3);
+ std::cout << slice << std::endl;
+ BOOST_TEST((slice == make_vector('x', 3.3)));
+ BOOST_STATIC_ASSERT(result_of::size<slice_t>::value == 2);
+ }
+
+ {
+ typedef vector_iterator<vector_type, 0> i1t;
+ typedef vector_iterator<vector_type, 0> i3t;
+
+ i1t i1(vec);
+ i3t i3(vec);
+
+ typedef iterator_range<i1t, i3t> slice_t;
+ slice_t slice(i1, i3);
+ std::cout << slice << std::endl;
+ BOOST_TEST(slice == make_vector());
+ BOOST_STATIC_ASSERT(result_of::size<slice_t>::value == 0);
+ }
+ }
+
+ {
+ typedef boost::mpl::vector_c<int, 2, 3, 4, 5, 6> mpl_vec;
+ typedef boost::mpl::begin<mpl_vec>::type it0;
+ typedef boost::mpl::next<it0>::type it1;
+ typedef boost::mpl::next<it1>::type it2;
+ typedef boost::mpl::next<it2>::type it3;
+
+ it1 f;
+ it3 l;
+
+ typedef iterator_range<it1, it3> slice_t;
+ slice_t slice(f, l);
+ std::cout << slice << std::endl;
+ BOOST_TEST((slice == make_vector(3, 4)));
+ BOOST_STATIC_ASSERT(result_of::size<slice_t>::value == 2);
+ }
+
+ {
+ process_tree(
+ make_tree(
+ make_vector(double(0),'B')
+ , make_tree(
+ make_vector(1,2,long(3))
+ , make_tree(make_vector('a','b','c'))
+ , make_tree(make_vector(short('d'),'e','f'))
+ )
+ , make_tree(
+ make_vector(4,5,6)
+ , make_tree(make_vector(float(1),'h','i'))
+ , make_tree(make_vector('j','k','l'))
+ )
+ )
+ );
+ }
+
+ 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