From 178973a05c1ded735be5188e7cf49592457ec7db Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Sun, 4 Oct 2009 16:59:37 +0000 Subject: [PATCH] BOOST_FUSION_ADAPT_CLASS [SVN r56575] --- include/boost/fusion/adapted/class.hpp | 28 +++++ .../adapted/class/adapt_assoc_class.hpp | 94 ++++++++++++++++ .../fusion/adapted/class/adapt_class.hpp | 104 +++++++++++++++++ .../fusion/adapted/class/class_iterator.hpp | 105 ++++++++++++++++++ .../fusion/adapted/class/detail/at_impl.hpp | 70 ++++++++++++ .../adapted/class/detail/at_key_impl.hpp | 54 +++++++++ .../adapted/class/detail/begin_impl.hpp | 40 +++++++ .../adapted/class/detail/category_of_impl.hpp | 35 ++++++ .../fusion/adapted/class/detail/end_impl.hpp | 48 ++++++++ .../adapted/class/detail/has_key_impl.hpp | 40 +++++++ .../adapted/class/detail/is_sequence_impl.hpp | 31 ++++++ .../adapted/class/detail/is_view_impl.hpp | 32 ++++++ .../fusion/adapted/class/detail/size_impl.hpp | 37 ++++++ .../adapted/class/detail/value_at_impl.hpp | 47 ++++++++ .../class/detail/value_at_key_impl.hpp | 39 +++++++ .../boost/fusion/adapted/class/extension.hpp | 68 ++++++++++++ include/boost/fusion/include/adapt_class.hpp | 12 ++ 17 files changed, 884 insertions(+) create mode 100644 include/boost/fusion/adapted/class.hpp create mode 100644 include/boost/fusion/adapted/class/adapt_assoc_class.hpp create mode 100644 include/boost/fusion/adapted/class/adapt_class.hpp create mode 100644 include/boost/fusion/adapted/class/class_iterator.hpp create mode 100644 include/boost/fusion/adapted/class/detail/at_impl.hpp create mode 100644 include/boost/fusion/adapted/class/detail/at_key_impl.hpp create mode 100644 include/boost/fusion/adapted/class/detail/begin_impl.hpp create mode 100644 include/boost/fusion/adapted/class/detail/category_of_impl.hpp create mode 100644 include/boost/fusion/adapted/class/detail/end_impl.hpp create mode 100644 include/boost/fusion/adapted/class/detail/has_key_impl.hpp create mode 100644 include/boost/fusion/adapted/class/detail/is_sequence_impl.hpp create mode 100644 include/boost/fusion/adapted/class/detail/is_view_impl.hpp create mode 100644 include/boost/fusion/adapted/class/detail/size_impl.hpp create mode 100644 include/boost/fusion/adapted/class/detail/value_at_impl.hpp create mode 100644 include/boost/fusion/adapted/class/detail/value_at_key_impl.hpp create mode 100644 include/boost/fusion/adapted/class/extension.hpp create mode 100644 include/boost/fusion/include/adapt_class.hpp diff --git a/include/boost/fusion/adapted/class.hpp b/include/boost/fusion/adapted/class.hpp new file mode 100644 index 00000000..be973831 --- /dev/null +++ b/include/boost/fusion/adapted/class.hpp @@ -0,0 +1,28 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_CLASS_OCTOBER_4_2009_839PM) +#define BOOST_FUSION_CLASS_OCTOBER_4_2009_839PM + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/boost/fusion/adapted/class/adapt_assoc_class.hpp b/include/boost/fusion/adapted/class/adapt_assoc_class.hpp new file mode 100644 index 00000000..11f40ade --- /dev/null +++ b/include/boost/fusion/adapted/class/adapt_assoc_class.hpp @@ -0,0 +1,94 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2007 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_ADAPT_ASSOC_CLASS_OCTOBER_4_2009_840PM) +#define BOOST_FUSION_ADAPT_ASSOC_CLASS_OCTOBER_4_2009_840PM + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion { namespace extension { + template + struct class_assoc_member; +}}} + + +#define BOOST_FUSION_ADAPT_ASSOC_CLASS(name, bseq) \ + BOOST_FUSION_ADAPT_ASSOC_CLASS_I( \ + name, BOOST_PP_CAT(BOOST_FUSION_ADAPT_ASSOC_CLASS_X bseq, 0)) \ + /***/ + +#define BOOST_FUSION_ADAPT_ASSOC_CLASS_X(x, y, z) ((x, y, z)) BOOST_FUSION_ADAPT_ASSOC_CLASS_Y +#define BOOST_FUSION_ADAPT_ASSOC_CLASS_Y(x, y, z) ((x, y, z)) BOOST_FUSION_ADAPT_ASSOC_CLASS_X +#define BOOST_FUSION_ADAPT_ASSOC_CLASS_X0 +#define BOOST_FUSION_ADAPT_ASSOC_CLASS_Y0 + +// BOOST_FUSION_ADAPT_ASSOC_CLASS_I generates the overarching structure and uses +// SEQ_FOR_EACH_I to generate the "linear" substructures. +// Thanks to Paul Mensonides for the PP macro help + +#define BOOST_FUSION_ADAPT_ASSOC_CLASS_I(name, seq) \ + namespace boost { namespace fusion { namespace traits \ + { \ + template <> \ + struct tag_of \ + { \ + typedef class_tag type; \ + }; \ + }}} \ + namespace boost { namespace fusion { namespace extension \ + { \ + template <> \ + struct class_size : mpl::int_ {}; \ + BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_ADAPT_ASSOC_CLASS_C, name, seq) \ + }}} \ + /***/ + +#define BOOST_FUSION_ADAPT_ASSOC_CLASS_C(r, name, i, xy) \ + template <> \ + struct class_member \ + { \ + typedef BOOST_PP_TUPLE_ELEM(3, 0, xy) type; \ + static type& call(name& class_) \ + { \ + return class_.BOOST_PP_TUPLE_ELEM(3, 1, xy); \ + }; \ + }; \ + template<> \ + struct class_assoc_member \ + { \ + typedef BOOST_PP_TUPLE_ELEM(3, 0, xy) type; \ + static type& call(name& class_) \ + { \ + return class_.BOOST_PP_TUPLE_ELEM(3, 1, xy); \ + }; \ + }; + /***/ + +#endif diff --git a/include/boost/fusion/adapted/class/adapt_class.hpp b/include/boost/fusion/adapted/class/adapt_class.hpp new file mode 100644 index 00000000..c4e5c29f --- /dev/null +++ b/include/boost/fusion/adapted/class/adapt_class.hpp @@ -0,0 +1,104 @@ +/*============================================================================= + 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) +==============================================================================*/ +#if !defined(BOOST_FUSION_ADAPT_CLASS_OCTOBER_4_2009_840PM) +#define BOOST_FUSION_ADAPT_CLASS_OCTOBER_4_2009_840PM + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BOOST_FUSION_ADAPT_CLASS(name, bseq) \ + BOOST_FUSION_ADAPT_CLASS_I( \ + name, BOOST_PP_CAT(BOOST_FUSION_ADAPT_CLASS_X bseq, 0)) \ + /***/ + +#define BOOST_FUSION_ADAPT_CLASS_X(w, x, y, z) ((w, x, y, z)) BOOST_FUSION_ADAPT_CLASS_Y +#define BOOST_FUSION_ADAPT_CLASS_Y(w, x, y, z) ((w, x, y, z)) BOOST_FUSION_ADAPT_CLASS_X +#define BOOST_FUSION_ADAPT_CLASS_X0 +#define BOOST_FUSION_ADAPT_CLASS_Y0 + +// BOOST_FUSION_ADAPT_CLASS_I generates the overarching structure and uses +// SEQ_FOR_EACH_I to generate the "linear" substructures. +// Thanks to Paul Mensonides for the PP macro help + +#define BOOST_FUSION_ADAPT_CLASS_I(name, seq) \ + namespace boost { namespace fusion { namespace traits \ + { \ + template <> \ + struct tag_of \ + { \ + typedef class_tag type; \ + }; \ + }}} \ + namespace boost { namespace fusion { namespace extension \ + { \ + template <> \ + struct class_size : mpl::int_ {}; \ + BOOST_PP_SEQ_FOR_EACH_I(BOOST_FUSION_ADAPT_CLASS_C, name, seq) \ + }}} \ + /***/ + +#define BOOST_FUSION_ADAPT_CLASS_C(r, name, i, xy) \ + template <> \ + struct class_member \ + { \ + typedef BOOST_PP_TUPLE_ELEM(4, 0, xy) type; \ + typedef BOOST_PP_TUPLE_ELEM(4, 1, xy) get_type; \ + struct proxy \ + { \ + typedef BOOST_PP_TUPLE_ELEM(4, 0, xy) type; \ + typedef BOOST_PP_TUPLE_ELEM(4, 1, xy) get_type; \ + typedef \ + add_reference::type>::type \ + cref_type; \ + \ + proxy(name& obj) : obj(obj) {} \ + name& obj; \ + \ + proxy& operator=(cref_type val) \ + { \ + BOOST_PP_TUPLE_ELEM(4, 3, xy); \ + return *this; \ + } \ + \ + operator get_type() \ + { \ + return BOOST_PP_TUPLE_ELEM(4, 2, xy); \ + } \ + }; \ + \ + static get_type call(name const& obj) \ + { \ + return BOOST_PP_TUPLE_ELEM(4, 2, xy); \ + }; \ + \ + static proxy call(name& obj) \ + { \ + return proxy(obj); \ + }; \ + }; \ + /***/ + +#endif diff --git a/include/boost/fusion/adapted/class/class_iterator.hpp b/include/boost/fusion/adapted/class/class_iterator.hpp new file mode 100644 index 00000000..639ee927 --- /dev/null +++ b/include/boost/fusion/adapted/class/class_iterator.hpp @@ -0,0 +1,105 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(FUSION_CLASS_ITERATOR_OCTOBER_4_2009_839M) +#define FUSION_CLASS_ITERATOR_OCTOBER_4_2009_839M + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace fusion +{ + struct random_access_traversal_tag; + + template + struct class_iterator + : iterator_facade, random_access_traversal_tag> + { + BOOST_MPL_ASSERT_RELATION(N_, >=, 0); + BOOST_MPL_ASSERT_RELATION(N_, <=, extension::class_size::value); + + typedef mpl::int_ index; + typedef Class class_type; + + class_iterator(Class& class_) + : class_(class_) {} + Class& class_; + + template + struct value_of + : extension::class_member + { + }; + + template + struct deref + { + typedef typename + mpl::if_< + is_const + , typename extension::class_member::get_type + , typename extension::class_member::proxy + >::type + type; + + static type + call(Iterator const& iter) + { + return extension::class_member:: + call(iter.class_); + } + }; + + template + struct advance + { + typedef typename Iterator::index index; + typedef typename Iterator::class_type class_type; + typedef class_iterator type; + + static type + call(Iterator const& iter) + { + return type(iter.class_); + } + }; + + template + struct next : advance > {}; + + template + struct prior : advance > {}; + + template + struct distance : mpl::minus + { + typedef typename + mpl::minus< + typename I2::index, typename I1::index + >::type + type; + + static type + call(I1 const&, I2 const&) + { + return type(); + } + }; + }; +}} + +#endif + + diff --git a/include/boost/fusion/adapted/class/detail/at_impl.hpp b/include/boost/fusion/adapted/class/detail/at_impl.hpp new file mode 100644 index 00000000..12b5171f --- /dev/null +++ b/include/boost/fusion/adapted/class/detail/at_impl.hpp @@ -0,0 +1,70 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_AT_IMPL_OCTOBER_4_2009_920PM) +#define BOOST_FUSION_AT_IMPL_OCTOBER_4_2009_920PM + +#include +#include +#include + +namespace boost { namespace fusion +{ + struct class_tag; + + namespace extension + { + template + struct at_impl; + + template + struct class_member; + + template + struct class_size; + + template <> + struct at_impl + { + template + struct apply + { + static int const n_value = N::value; + BOOST_MPL_ASSERT_RELATION( + n_value, <=, extension::class_size::value); + + typedef typename + extension::class_member + element; + + typedef typename + mpl::if_< + is_const + , typename class_member::get_type + , typename class_member::proxy + >::type + type; + + static type + call(Sequence& seq) + { + return extension:: + class_member::call(seq); + } + + //~ static typename class_member::get_type + //~ call(Sequence const& seq) + //~ { + //~ return extension:: + //~ class_member::call(seq); + //~ } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/class/detail/at_key_impl.hpp b/include/boost/fusion/adapted/class/detail/at_key_impl.hpp new file mode 100644 index 00000000..9df985bf --- /dev/null +++ b/include/boost/fusion/adapted/class/detail/at_key_impl.hpp @@ -0,0 +1,54 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2007 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_AT_KEY_IMPL_OCTOBER_4_2009_920PM) +#define BOOST_FUSION_AT_KEY_IMPL_OCTOBER_4_2009_920PM + +#include + +namespace boost { namespace fusion +{ + struct class_tag; + + namespace extension + { + template + struct at_key_impl; + + template + struct class_assoc_member; + + template <> + struct at_key_impl + { + template + struct apply + { + typedef typename + extension::class_assoc_member + element; + + typedef typename + mpl::eval_if< + is_const + , detail::cref_result + , detail::ref_result + >::type + type; + + static type + call(Sequence& seq) + { + return extension:: + class_assoc_member::call(seq); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/class/detail/begin_impl.hpp b/include/boost/fusion/adapted/class/detail/begin_impl.hpp new file mode 100644 index 00000000..4fadac4e --- /dev/null +++ b/include/boost/fusion/adapted/class/detail/begin_impl.hpp @@ -0,0 +1,40 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_BEGIN_IMPL_OCTOBER_4_2009_920PM) +#define BOOST_FUSION_BEGIN_IMPL_OCTOBER_4_2009_920PM + +#include + +namespace boost { namespace fusion +{ + struct class_tag; + + namespace extension + { + template + struct begin_impl; + + template <> + struct begin_impl + { + template + struct apply + { + typedef class_iterator type; + + static type + call(Sequence& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/class/detail/category_of_impl.hpp b/include/boost/fusion/adapted/class/detail/category_of_impl.hpp new file mode 100644 index 00000000..821cf38b --- /dev/null +++ b/include/boost/fusion/adapted/class/detail/category_of_impl.hpp @@ -0,0 +1,35 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_CATEGORY_OF_IMPL_OCTOBER_4_2009_919PM) +#define BOOST_FUSION_CATEGORY_OF_IMPL_OCTOBER_4_2009_919PM + +#include + +namespace boost { namespace fusion +{ + struct class_tag; + struct random_access_traversal_tag; + + namespace extension + { + template + struct category_of_impl; + + template<> + struct category_of_impl + { + template + struct apply + { + typedef random_access_traversal_tag type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/class/detail/end_impl.hpp b/include/boost/fusion/adapted/class/detail/end_impl.hpp new file mode 100644 index 00000000..81c02c30 --- /dev/null +++ b/include/boost/fusion/adapted/class/detail/end_impl.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_END_IMPL_OCTOBER_4_2009_919PM) +#define BOOST_FUSION_END_IMPL_OCTOBER_4_2009_919PM + +#include + +namespace boost { namespace fusion +{ + struct class_tag; + + namespace extension + { + template + struct end_impl; + + template + struct class_size; + + template <> + struct end_impl + { + template + struct apply + { + typedef + class_iterator< + Sequence + , class_size::value + > + type; + + static type + call(Sequence& v) + { + return type(v); + } + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/class/detail/has_key_impl.hpp b/include/boost/fusion/adapted/class/detail/has_key_impl.hpp new file mode 100644 index 00000000..27f1adce --- /dev/null +++ b/include/boost/fusion/adapted/class/detail/has_key_impl.hpp @@ -0,0 +1,40 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2007 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_HAS_KEY_IMPL_OCTOBER_4_2009_919PM) +#define BOOST_FUSION_HAS_KEY_IMPL_OCTOBER_4_2009_919PM + +#include +#include + +namespace boost { namespace fusion { + + struct class_tag; + + namespace extension + { + struct no_such_member; + + template + struct has_key_impl; + + template + struct class_assoc_member; + + template<> + struct has_key_impl + { + template + struct apply + : mpl::not_::type> > + { + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/class/detail/is_sequence_impl.hpp b/include/boost/fusion/adapted/class/detail/is_sequence_impl.hpp new file mode 100644 index 00000000..c1d35de1 --- /dev/null +++ b/include/boost/fusion/adapted/class/detail/is_sequence_impl.hpp @@ -0,0 +1,31 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_IS_SEQUENCE_IMPL_OCTOBER_4_2009_919PM) +#define BOOST_FUSION_IS_SEQUENCE_IMPL_OCTOBER_4_2009_919PM + +#include + +namespace boost { namespace fusion +{ + struct class_tag; + + namespace extension + { + template + struct is_sequence_impl; + + template<> + struct is_sequence_impl + { + template + struct apply : mpl::true_ {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/class/detail/is_view_impl.hpp b/include/boost/fusion/adapted/class/detail/is_view_impl.hpp new file mode 100644 index 00000000..86ce0074 --- /dev/null +++ b/include/boost/fusion/adapted/class/detail/is_view_impl.hpp @@ -0,0 +1,32 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_IS_VIEW_IMPL_OCTOBER_4_2009_919PM) +#define BOOST_FUSION_IS_VIEW_IMPL_OCTOBER_4_2009_919PM + +#include + +namespace boost { namespace fusion +{ + struct class_tag; + + namespace extension + { + template + struct is_view_impl; + + template<> + struct is_view_impl + { + template + struct apply : mpl::false_ + {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/class/detail/size_impl.hpp b/include/boost/fusion/adapted/class/detail/size_impl.hpp new file mode 100644 index 00000000..de34a3b1 --- /dev/null +++ b/include/boost/fusion/adapted/class/detail/size_impl.hpp @@ -0,0 +1,37 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_SIZE_IMPL_OCTOBER_4_2009_919PM) +#define BOOST_FUSION_SIZE_IMPL_OCTOBER_4_2009_919PM + +#include + +namespace boost { namespace fusion +{ + namespace extension + { + template + struct class_size; + } + + struct class_tag; + + namespace extension + { + template + struct size_impl; + + template <> + struct size_impl + { + template + struct apply : extension::class_size {}; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/class/detail/value_at_impl.hpp b/include/boost/fusion/adapted/class/detail/value_at_impl.hpp new file mode 100644 index 00000000..64d2fc3a --- /dev/null +++ b/include/boost/fusion/adapted/class/detail/value_at_impl.hpp @@ -0,0 +1,47 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_VALUE_AT_IMPL_OCTOBER_4_2009_918PM) +#define BOOST_FUSION_VALUE_AT_IMPL_OCTOBER_4_2009_918PM + +#include +#include + +namespace boost { namespace fusion +{ + struct class_tag; + + namespace extension + { + template + struct value_at_impl; + + template + struct class_member; + + template + struct class_size; + + template <> + struct value_at_impl + { + template + struct apply + { + static int const n_value = N::value; + BOOST_MPL_ASSERT_RELATION( + n_value, <=, extension::class_size::value); + + typedef typename + extension::class_member::type + type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/class/detail/value_at_key_impl.hpp b/include/boost/fusion/adapted/class/detail/value_at_key_impl.hpp new file mode 100644 index 00000000..f9adc104 --- /dev/null +++ b/include/boost/fusion/adapted/class/detail/value_at_key_impl.hpp @@ -0,0 +1,39 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2007 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(BOOST_FUSION_VALUE_AT_KEY_IMPL_OCTOBER_4_2009_918PM) +#define BOOST_FUSION_VALUE_AT_KEY_IMPL_OCTOBER_4_2009_918PM + +#include + +namespace boost { namespace fusion +{ + struct class_tag; + + namespace extension + { + template + struct value_at_key_impl; + + template + struct class_assoc_member; + + template <> + struct value_at_key_impl + { + template + struct apply + { + typedef typename + extension::class_assoc_member::type + type; + }; + }; + } +}} + +#endif diff --git a/include/boost/fusion/adapted/class/extension.hpp b/include/boost/fusion/adapted/class/extension.hpp new file mode 100644 index 00000000..28d0a223 --- /dev/null +++ b/include/boost/fusion/adapted/class/extension.hpp @@ -0,0 +1,68 @@ +/*============================================================================= + Copyright (c) 2001-2009 Joel de Guzman + Copyright (c) 2005-2006 Dan Marsden + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(FUSION_CLASS_EXTENSION_OCTOBER_4_2009_839PM) +#define FUSION_CLASS_EXTENSION_OCTOBER_4_2009_839PM + +#include + +namespace boost { namespace fusion { namespace extension +{ + template + struct class_member; + + template + struct class_size; + + template + struct class_member : class_member {}; + //~ { + //~ typedef typename class_member::type type; + //~ typedef typename class_member::get_type get_type; + //~ typedef typename class_member::proxy proxy; + + //~ static get_type& + //~ call(Class const& class_) + //~ { + //~ return class_member::call( + //~ const_cast(class_)); + //~ } + //~ }; + + template + struct class_size + : class_size + {}; + + struct no_such_member; + + template + struct class_assoc_member + { + typedef no_such_member type; + }; + + template + struct class_assoc_member + { + typedef typename + add_const::type>::type + type; + + static type& + call(Class const& class_) + { + return class_assoc_member::call( + const_cast(class_)); + } + }; + +}}} + +#endif + + diff --git a/include/boost/fusion/include/adapt_class.hpp b/include/boost/fusion/include/adapt_class.hpp new file mode 100644 index 00000000..7c32768e --- /dev/null +++ b/include/boost/fusion/include/adapt_class.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + 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) +==============================================================================*/ +#if !defined(FUSION_INCLUDE_ADAPT_CLASS) +#define FUSION_INCLUDE_ADAPT_CLASS + +#include + +#endif