Boost logo

Boost-Commit :

From: chochlik_at_[hidden]
Date: 2008-05-09 15:50:18


Author: matus.chochlik
Date: 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
New Revision: 45255
URL: http://svn.boost.org/trac/boost/changeset/45255

Log:
Working revision probably will fail to compile.
Added:
   sandbox/mirror/boost/mirror/algorithm/begin.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/detail/attribute_iterator.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/detail/base_class_iterator.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/detail/begin.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/detail/common_iterator.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/detail/end.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/detail/find_if.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/detail/iterator.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/end.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/find_if.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/is_equal_iterator.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/next.hpp (contents, props changed)
   sandbox/mirror/boost/mirror/algorithm/prior.hpp (contents, props changed)
   sandbox/mirror/libs/mirror/example/algorithms/
   sandbox/mirror/libs/mirror/example/algorithms/begin_end.cpp (contents, props changed)
Text files modified:
   sandbox/mirror/boost/mirror/algorithm/detail/base_class_at.hpp | 3 +--
   sandbox/mirror/boost/mirror/algorithms.hpp | 8 +++++++-
   sandbox/mirror/boost/mirror/meta_attributes.hpp | 27 +++++++++++++++++++++------
   sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml | 6 ++++++
   sandbox/mirror/libs/mirror/example/Jamfile.v2 | 4 ++++
   sandbox/mirror/libs/mirror/example/registering/virtual_bases.cpp | 36 ++++++++++++++++++++++++++++++++++--
   6 files changed, 73 insertions(+), 11 deletions(-)

Added: sandbox/mirror/boost/mirror/algorithm/begin.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/begin.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -0,0 +1,66 @@
+/**
+ * \file boost/mirror/algorithm/begin.hpp
+ * Returns the iterator pointing to the first meta-object
+ * in a meta-object sequence.
+ *
+ * Copyright 2008 Matus Chochlik. 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_MIRROR_ALGORITHM_BEGIN_HPP
+#define BOOST_MIRROR_ALGORITHM_BEGIN_HPP
+
+#include <boost/mirror/algorithm/detail/begin.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ /** Declaration of the default begin_impl
+ * helper template.
+ */
+ template <class MetaObjectSequence>
+ struct begin_impl { };
+
+ /** Specialization of begin_impl<MetaObjectSequence>
+ * for meta_class_attributes<>
+ */
+ template <class Class, class VariantTag>
+ struct begin_impl<meta_class_attributes<Class, VariantTag> >
+ : meta_object_sequence_begin<
+ Class, VariantTag,
+ meta_class_attributes<Class, VariantTag>
+ >{ };
+
+ /** Specialization of for_each_impl<MetaObjectSequence>
+ * for meta_class_all_attributes<>
+ */
+ template <class Class, class VariantTag>
+ struct begin_impl<meta_class_all_attributes<Class, VariantTag> >
+ : meta_object_sequence_begin<
+ Class, VariantTag,
+ meta_class_all_attributes<Class, VariantTag>
+ >{ };
+
+ /** Specialization of for_each_impl<MetaObjectSequence>
+ * for meta_base_classes<>
+ */
+ template <class Class, class VariantTag>
+ struct begin_impl<meta_base_classes<Class, VariantTag> >
+ : meta_object_sequence_begin<
+ Class, VariantTag,
+ meta_base_classes<Class, VariantTag>
+ >{ };
+
+} // namespace detail
+
+template <class MetaObjectSequence>
+struct begin : detail::begin_impl<MetaObjectSequence>
+{ };
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/detail/attribute_iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/detail/attribute_iterator.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -0,0 +1,58 @@
+/**
+ * \file boost/mirror/algorithm/detail/attribute_iterator.hpp
+ * Iterators for iterating through meta-object sequences
+ *
+ * Copyright 2008 Matus Chochlik. 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_MIRROR_ALGORITHM_DETAIL_ATTRIBUTE_ITERATOR_HPP
+#define BOOST_MIRROR_ALGORITHM_DETAIL_ATTRIBUTE_ITERATOR_HPP
+
+#include <boost/mirror/algorithm/detail/common_iterator.hpp>
+#include <boost/mirror/meta_attributes.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ struct attribute_iterator_pointee_selector
+ {
+ template <
+ class ReflectedType,
+ class VariantTag,
+ class MetaAttributes,
+ class AttribPos,
+ class UnaryPredicate
+ >
+ struct apply
+ {
+ typedef meta_class_attribute<
+ ReflectedType,
+ VariantTag,
+ MetaAttributes,
+ AttribPos
+ > type;
+ };
+ };
+
+ template <class ReflectedType, class VariantTag>
+ struct iterator_pointee_selector<
+ meta_class_attributes<ReflectedType, VariantTag>
+ > : attribute_iterator_pointee_selector
+ { };
+
+ template <class ReflectedType, class VariantTag>
+ struct iterator_pointee_selector<
+ meta_class_all_attributes<ReflectedType, VariantTag>
+ > : attribute_iterator_pointee_selector
+ { };
+
+
+} // namespace detail
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Modified: sandbox/mirror/boost/mirror/algorithm/detail/base_class_at.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/algorithm/detail/base_class_at.hpp (original)
+++ sandbox/mirror/boost/mirror/algorithm/detail/base_class_at.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -23,7 +23,7 @@
 
 namespace detail {
 
-/** Implementation of the for_each function on meta_attributes
+/** Implementation of the at function on meta_base_classes
  */
 template <class MetaBaseClasses, class Position>
 struct meta_inheritance_at
@@ -35,7 +35,6 @@
 };
 
 } // namespace detail
-
 } // namespace mirror
 } // namespace boost
 

Added: sandbox/mirror/boost/mirror/algorithm/detail/base_class_iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/detail/base_class_iterator.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -0,0 +1,53 @@
+/**
+ * \file boost/mirror/algorithm/detail/base_class_iterator.hpp
+ * Iterators for iterating through meta-object sequences
+ *
+ * Copyright 2008 Matus Chochlik. 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_MIRROR_ALGORITHM_DETAIL_BASE_CLASS_ITERATOR_HPP
+#define BOOST_MIRROR_ALGORITHM_DETAIL_BASE_CLASS_ITERATOR_HPP
+
+#include <boost/mirror/algorithm/detail/common_iterator.hpp>
+#include <boost/mirror/meta_inheritance.hpp>
+
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ /** Iterator for iterating through meta_base_classes
+ */
+ template <
+ class _ReflectedType,
+ class _VariantTag
+ >
+ struct iterator_pointee_selector<
+ meta_base_classes<_ReflectedType, _VariantTag>
+ >
+ {
+ template <
+ class ReflectedType,
+ class VariantTag,
+ class MetaBaseClasses,
+ class BaseClassPos,
+ class UnaryPredicate
+ >
+ struct apply
+ {
+ typedef typename at<
+ MetaBaseClasses,
+ BaseClassPos
+ >::type type;
+ };
+ };
+
+
+} // namespace detail
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/detail/begin.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/detail/begin.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -0,0 +1,42 @@
+/**
+ * \file boost/mirror/algorithm/detail/begin.hpp
+ * Template returning the iterator poining to
+ * the first element in a meta object sequence.
+ *
+ * Copyright 2008 Matus Chochlik. 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_MIRROR_ALGORITHM_DETAIL_BEGIN_HPP
+#define BOOST_MIRROR_ALGORITHM_DETAIL_BEGIN_HPP
+
+#include <boost/mirror/algorithm/detail/iterator.hpp>
+#include <boost/mpl/always.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ template <
+ class ReflectedType,
+ class VariantTag,
+ class MetaObjectSequence
+ >
+ struct meta_object_sequence_begin
+ {
+ typedef meta_object_iterator<
+ ReflectedType,
+ VariantTag,
+ MetaObjectSequence,
+ mpl::int_<0>,
+ mpl::always<mpl::true_>
+ > type;
+ };
+
+} // namespace detail
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/detail/common_iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/detail/common_iterator.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -0,0 +1,159 @@
+/**
+ * \file boost/mirror/algorithm/detail/common_iterator.hpp
+ *
+ * Common iterator-related declarations
+ *
+ * Copyright 2008 Matus Chochlik. 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_MIRROR_ALGORITHM_DETAIL_COMMON_ITERATOR_HPP
+#define BOOST_MIRROR_ALGORITHM_DETAIL_COMMON_ITERATOR_HPP
+
+#include <boost/mirror/algorithm/size.hpp>
+#include <boost/mirror/algorithm/at.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/apply.hpp>
+#include <boost/mpl/equal_to.hpp>
+
+
+
+namespace boost {
+namespace mirror {
+
+/** Dereferences an iterator
+ */
+template <class Iterator>
+struct deref
+{
+ typedef typename Iterator::pointed_to
+ type;
+};
+
+namespace detail {
+
+ template <class MetaObjectSequence>
+ struct iterator_pointee_selector;
+
+ template <
+ class ReflectedType,
+ class VariantTag,
+ class MetaObjectSequence,
+ class Position,
+ class UnaryPredicate,
+ class Selector
+
+ >
+ struct meta_object_iterator_base
+ {
+ typedef Position position;
+
+ // the type meta_class_attribute
+ // that this iterator points to
+ typedef typename Selector::apply<
+ ReflectedType,
+ VariantTag,
+ MetaObjectSequence,
+ Position,
+ UnaryPredicate
+ >::type pointed_to;
+
+
+ // the current iterator getter
+ struct get_this_iterator
+ {
+ template <typename DummyPosition>
+ struct apply
+ {
+ typedef meta_object_iterator_base<
+ ReflectedType,
+ VariantTag,
+ MetaObjectSequence,
+ DummyPosition,
+ UnaryPredicate,
+ Selector
+ > type;
+ };
+ };
+
+ // the prior iterator getter
+ struct get_prior_iterator
+ {
+ template <typename DummyPosition>
+ struct apply
+ {
+ typedef meta_object_iterator_base<
+ ReflectedType,
+ VariantTag,
+ MetaObjectSequence,
+ mpl::int_<DummyPosition::value - 1>,
+ UnaryPredicate,
+ Selector
+ > type;
+ };
+ };
+
+
+ // the initial or next iterator getter
+ template <int I>
+ struct get_initial_or_next_iterator
+ {
+ typedef mpl::int_<size<MetaObjectSequence>::value > end_pos;
+
+ template <typename DummyPosition>
+ struct apply
+ {
+ typedef meta_object_iterator_base<
+ ReflectedType,
+ VariantTag,
+ MetaObjectSequence,
+ mpl::int_<DummyPosition::value + I>,
+ UnaryPredicate,
+ Selector
+ > next_iterator;
+
+ typedef typename mpl::apply<
+ UnaryPredicate,
+ typename deref<next_iterator>::type
+ >::type next_is_valid;
+
+ // TODO: this needs to be optimized.
+ typedef typename mpl::if_<
+ next_is_valid,
+ next_iterator,
+ typename mpl::apply<
+ typename next_iterator::get_next_iterator,
+ typename next_iterator::position
+ >::type
+ > ::type type;
+ };
+
+ template <>
+ struct apply<end_pos>
+ {
+ typedef meta_object_iterator_base<
+ ReflectedType,
+ VariantTag,
+ MetaObjectSequence,
+ end_pos,
+ UnaryPredicate,
+ Selector
+ > type;
+ };
+ };
+
+ struct get_initial_iterator : get_initial_or_next_iterator<0>{ };
+ struct get_next_iterator : get_initial_or_next_iterator<1>{ };
+
+ }; // meta_object_iterator_base
+
+
+
+} // namespace detail
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/detail/end.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/detail/end.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -0,0 +1,43 @@
+/**
+ * \file boost/mirror/algorithm/detail/end.hpp
+ * Template returning the iterator poining to
+ * the first element in a meta object sequence.
+ *
+ * Copyright 2008 Matus Chochlik. 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_MIRROR_ALGORITHM_DETAIL_END_HPP
+#define BOOST_MIRROR_ALGORITHM_DETAIL_END_HPP
+
+#include <boost/mirror/algorithm/detail/iterator.hpp>
+#include <boost/mpl/always.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ template <
+ class ReflectedType,
+ class VariantTag,
+ class MetaObjectSequence
+ >
+ struct meta_object_sequence_end
+ {
+ typedef meta_object_iterator<
+ ReflectedType,
+ VariantTag,
+ MetaObjectSequence,
+ mpl::int_<size<MetaObjectSequence>::value>,
+ mpl::always<mpl::true_>
+ > type;
+ };
+
+
+} // namespace detail
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/detail/find_if.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/detail/find_if.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -0,0 +1,42 @@
+/**
+ * \file boost/mirror/algorithm/detail/find_if.hpp
+ *
+ * Returns iterator to the first element of a meta-object
+ * sequence satisfying the predicate.
+ *
+ * Copyright 2008 Matus Chochlik. 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_MIRROR_ALGORITHM_DETAIL_FIND_IF_HPP
+#define BOOST_MIRROR_ALGORITHM_DETAIL_FIND_IF_HPP
+
+#include <boost/mirror/algorithm/detail/iterator.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ template <
+ class ReflectedType,
+ class VariantTag,
+ class MetaObjectSequence,
+ class Predicate
+ >
+ struct meta_object_find_if
+ {
+ typedef typename get_meta_object_iterator<
+ ReflectedType,
+ VariantTag,
+ MetaObjectSequence,
+ Predicate
+ >::type type;
+ };
+
+} // namespace detail
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/detail/iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/detail/iterator.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -0,0 +1,67 @@
+/**
+ * \file boost/mirror/algorithm/detail/iterator.hpp
+ * Includes all meta-object sequence iterators
+ *
+ * Copyright 2008 Matus Chochlik. 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_MIRROR_ALGORITHM_DETAIL_ITERATOR_HPP
+#define BOOST_MIRROR_ALGORITHM_DETAIL_ITERATOR_HPP
+
+#include <boost/mirror/algorithm/detail/attribute_iterator.hpp>
+#include <boost/mirror/algorithm/detail/base_class_iterator.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ template <
+ class ReflectedType,
+ class VariantTag,
+ class MetaObjectSequence,
+ class Position,
+ class UnaryPredicate
+ >
+ struct meta_object_iterator
+ : meta_object_iterator_base<
+ ReflectedType,
+ VariantTag,
+ MetaObjectSequence,
+ Position,
+ UnaryPredicate,
+ iterator_pointee_selector<MetaObjectSequence>
+ >{ };
+
+ /** Gets the initial iterator for the given meta_attributes
+ * and unary predicate.
+ */
+ template <
+ class ReflectedType,
+ class VariantTag,
+ class MetaObjectSequence,
+ class UnaryPredicate
+ >
+ struct get_meta_object_iterator
+ {
+ typedef typename mpl::apply<
+ typename meta_object_iterator<
+ ReflectedType,
+ VariantTag,
+ MetaObjectSequence,
+ mpl::int_<0>,
+ UnaryPredicate
+ >::get_initial_iterator,
+ mpl::int_<0>
+ >::type type;
+ };
+
+
+
+} // namespace detail
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/end.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/end.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -0,0 +1,66 @@
+/**
+ * \file boost/mirror/algorithm/end.hpp
+ * Returns the iterator pointing to the first meta-object
+ * in a meta-object sequence.
+ *
+ * Copyright 2008 Matus Chochlik. 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_MIRROR_ALGORITHM_END_HPP
+#define BOOST_MIRROR_ALGORITHM_END_HPP
+
+#include <boost/mirror/algorithm/detail/end.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ /** Declaration of the default end_impl
+ * helper template.
+ */
+ template <class MetaObjectSequence>
+ struct end_impl { };
+
+ /** Specialization of end_impl<MetaObjectSequence>
+ * for meta_class_attributes<>
+ */
+ template <class Class, class VariantTag>
+ struct end_impl<meta_class_attributes<Class, VariantTag> >
+ : meta_object_sequence_end<
+ Class, VariantTag,
+ meta_class_attributes<Class, VariantTag>
+ >{ };
+
+ /** Specialization of for_each_impl<MetaObjectSequence>
+ * for meta_class_all_attributes<>
+ */
+ template <class Class, class VariantTag>
+ struct end_impl<meta_class_all_attributes<Class, VariantTag> >
+ : meta_object_sequence_end<
+ Class, VariantTag,
+ meta_class_all_attributes<Class, VariantTag>
+ >{ };
+
+ /** Specialization of for_each_impl<MetaObjectSequence>
+ * for meta_base_classes<>
+ */
+ template <class Class, class VariantTag>
+ struct end_impl<meta_base_classes<Class, VariantTag> >
+ : meta_object_sequence_end<
+ Class, VariantTag,
+ meta_base_classes<Class, VariantTag>
+ >{ };
+
+} // namespace detail
+
+template <class MetaObjectSequence>
+struct end : detail::end_impl<MetaObjectSequence>
+{ };
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/find_if.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/find_if.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -0,0 +1,70 @@
+/**
+ * \file boost/mirror/algorithm/find_if.hpp
+ *
+ * Returns the iterator pointing to the first meta-object
+ * in a meta-object sequence satisfying the given predicate.
+ *
+ * Copyright 2008 Matus Chochlik. 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_MIRROR_ALGORITHM_FIND_IF_HPP
+#define BOOST_MIRROR_ALGORITHM_FIND_IF_HPP
+
+#include <boost/mirror/algorithm/detail/find_if.hpp>
+
+namespace boost {
+namespace mirror {
+namespace detail {
+
+ /** Declaration of the default find_if_impl
+ * helper template.
+ */
+ template <class MetaObjectSequence, class Predicate>
+ struct find_if_impl { };
+
+ /** Specialization of find_if_impl<MetaObjectSequence, class Predicate>
+ * for meta_class_attributes<>
+ */
+ template <class Class, class VariantTag, class Predicate>
+ struct find_if_impl<meta_class_attributes<Class, VariantTag>, Predicate>
+ : meta_object_find_if<
+ Class, VariantTag,
+ meta_class_attributes<Class, VariantTag>,
+ Predicate
+ >{ };
+
+ /** Specialization of for_each_impl<MetaObjectSequence>
+ * for meta_class_all_attributes<>
+ */
+ template <class Class, class VariantTag, class Predicate>
+ struct find_if_impl<meta_class_all_attributes<Class, VariantTag>, Predicate>
+ : meta_object_find_if<
+ Class, VariantTag,
+ meta_class_all_attributes<Class, VariantTag>,
+ Predicate
+ >{ };
+
+ /** Specialization of for_each_impl<MetaObjectSequence>
+ * for meta_base_classes<>
+ */
+ template <class Class, class VariantTag, class Predicate>
+ struct find_if_impl<meta_base_classes<Class, VariantTag>, Predicate>
+ : meta_object_find_if<
+ Class, VariantTag,
+ meta_base_classes<Class, VariantTag>,
+ Predicate
+ >{ };
+
+} // namespace detail
+
+template <class MetaObjectSequence, class Predicate>
+struct find_if : detail::find_if_impl<MetaObjectSequence, Predicate>
+{ };
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/is_equal_iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/is_equal_iterator.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -0,0 +1,81 @@
+/**
+ * \file boost/mirror/algorithm/is_equal_iterator.hpp
+ *
+ * Iterator equality comparison
+ *
+ * Copyright 2008 Matus Chochlik. 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_MIRROR_ALGORITHM_IS_EQUAL_ITERATOR_HPP
+#define BOOST_MIRROR_ALGORITHM_IS_EQUAL_ITERATOR_HPP
+
+#include <boost/mirror/algorithm/detail/iterator.hpp>
+#include <boost/mpl/bool.hpp>
+
+namespace boost {
+namespace mirror {
+
+template <class U, class V>
+struct is_equal_iterator : mpl::false_ { };
+
+
+template <
+ class ReflectedType,
+ class VariantTag,
+ class MetaAttributes,
+ class AttribPos,
+ class UnaryPredicate1,
+ class UnaryPredicate2,
+ class Selector
+>
+struct is_equal_iterator<
+ detail::meta_object_iterator<
+ ReflectedType,
+ VariantTag,
+ MetaAttributes,
+ AttribPos,
+ UnaryPredicate1
+ >,
+ detail::meta_object_iterator_base<
+ ReflectedType,
+ VariantTag,
+ MetaAttributes,
+ AttribPos,
+ UnaryPredicate2,
+ Selector
+ >
+> : mpl::true_ { };
+
+template <
+ class ReflectedType,
+ class VariantTag,
+ class MetaAttributes,
+ class AttribPos,
+ class UnaryPredicate1,
+ class UnaryPredicate2
+>
+struct is_equal_iterator<
+ detail::meta_object_iterator<
+ ReflectedType,
+ VariantTag,
+ MetaAttributes,
+ AttribPos,
+ UnaryPredicate1
+ >,
+ detail::meta_object_iterator<
+ ReflectedType,
+ VariantTag,
+ MetaAttributes,
+ AttribPos,
+ UnaryPredicate2
+ >
+> : mpl::true_ { };
+
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/next.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/next.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -0,0 +1,34 @@
+/**
+ * \file boost/mirror/algorithm/next.hpp
+ * Returns the iterator pointing to the prior element
+ * in a meta-object sequence.
+ *
+ * Copyright 2008 Matus Chochlik. 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_MIRROR_ALGORITHM_NEXT_HPP
+#define BOOST_MIRROR_ALGORITHM_NEXT_HPP
+
+#include <boost/mirror/algorithm/detail/iterator.hpp>
+
+namespace boost {
+namespace mirror {
+
+/** Next iterator
+ */
+template <class Iterator>
+struct next
+{
+ typedef typename mpl::apply<
+ typename Iterator::get_next_iterator,
+ typename Iterator::position
+ >::type type;
+};
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Added: sandbox/mirror/boost/mirror/algorithm/prior.hpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/boost/mirror/algorithm/prior.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -0,0 +1,34 @@
+/**
+ * \file boost/mirror/algorithm/prior.hpp
+ * Returns the iterator pointing to the prior element
+ * in a meta-object sequence.
+ *
+ * Copyright 2008 Matus Chochlik. 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_MIRROR_ALGORITHM_PRIOR_HPP
+#define BOOST_MIRROR_ALGORITHM_PRIOR_HPP
+
+#include <boost/mirror/algorithm/detail/iterator.hpp>
+
+namespace boost {
+namespace mirror {
+
+/** Prior iterator
+ */
+template <class Iterator>
+struct prior
+{
+ typedef typename mpl::apply<
+ typename Iterator::get_prior_iterator,
+ typename Iterator::position
+ >::type type;
+};
+
+} // namespace mirror
+} // namespace boost
+
+#endif //include guard
+

Modified: sandbox/mirror/boost/mirror/algorithms.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/algorithms.hpp (original)
+++ sandbox/mirror/boost/mirror/algorithms.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -1,6 +1,6 @@
 /**
  * \file boost/mirror/algorithms.hpp
- * Includes all mirror algorithms
+ * Includes all mirror algorithm related headers
  *
  * Copyright 2008 Matus Chochlik. Distributed under the Boost
  * Software License, Version 1.0. (See accompanying file
@@ -10,8 +10,14 @@
 #ifndef BOOST_MIRROR_ALGORITHMS_HPP
 #define BOOST_MIRROR_ALGORITHMS_HPP
 
+#include <boost/mirror/algorithm/begin.hpp>
+#include <boost/mirror/algorithm/end.hpp>
+#include <boost/mirror/algorithm/prior.hpp>
+#include <boost/mirror/algorithm/next.hpp>
+#include <boost/mirror/algorithm/is_equal_iterator.hpp>
 #include <boost/mirror/algorithm/for_each.hpp>
 #include <boost/mirror/algorithm/reverse_for_each.hpp>
+#include <boost/mirror/algorithm/find_if.hpp>
 
 namespace boost {
 namespace mirror {

Modified: sandbox/mirror/boost/mirror/meta_attributes.hpp
==============================================================================
--- sandbox/mirror/boost/mirror/meta_attributes.hpp (original)
+++ sandbox/mirror/boost/mirror/meta_attributes.hpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -499,6 +499,18 @@
>
         struct meta_class_attribute
         {
+ struct detail
+ {
+ struct result_of_get
+ {
+ typedef typename mpl::at<
+ typename MetaAttributes::type_list,
+ AttribPos
+ >::type type;
+
+ };
+ }; // struct detail
+
                 // the meta-class for the class to which
                 // the attribute belongs
                 typedef ::boost::mirror::meta_class<ReflectedType, VariantTag>
@@ -519,13 +531,13 @@
>::type type;
 
                 // base name getter
- static const bchar* base_name(void)
+ inline static const bchar* base_name(void)
                 {
                         return meta_attributes::base_name(position());
                 }
 
                 // full name getter
- static const bchar* full_name(void)
+ inline static const bchar* full_name(void)
                 {
                         return meta_attributes::full_name(position());
                 }
@@ -533,7 +545,7 @@
                 typedef typename meta_class::reflected_type reflected_class;
 
                 // value getter
- static typename call_traits<type>::param_type
+ inline static typename detail::result_of_get::type
                 get(const reflected_class& context)
                 {
                         return meta_attributes::get(context, position());
@@ -541,18 +553,21 @@
 
                 // value query
                 template <typename DestType>
- static DestType& query(const reflected_class& context, DestType& dest)
+ inline static DestType&
+ query(const reflected_class& context, DestType& dest)
                 {
                         return meta_attributes::query(context, position(), dest);
                 }
 
                 // value setter
- static void set(reflected_class& context, typename call_traits<type>::param_type val)
+ inline static void
+ set(reflected_class& context, typename call_traits<type>::param_type val)
                 {
                         meta_attributes::set(context, position(), val);
                 }
                 // value setter
- static void set(const reflected_class& context, typename call_traits<type>::param_type val)
+ inline static void
+ set(const reflected_class& context, typename call_traits<type>::param_type val)
                 {
                         meta_attributes::set(context, position(), val);
                 }

Modified: sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml
==============================================================================
--- sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml (original)
+++ sandbox/mirror/libs/mirror/doc/xml/mirror/_library.xml 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -147,5 +147,11 @@
                         - Updated the documentation
                         - Updated the xsl templates
                 </revision>
+ <revision id="20080509" major="0" minor="1" micro="22" author="m_ch">
+ - Added meta-object iterators for attributes and base classes
+ - Added begin, end, find_if meta-functions
+ - NOTE: Some example from this revision will probably not compile
+ - NOTE: Not tested
+ </revision>
         </revisions>
 </library>

Modified: sandbox/mirror/libs/mirror/example/Jamfile.v2
==============================================================================
--- sandbox/mirror/libs/mirror/example/Jamfile.v2 (original)
+++ sandbox/mirror/libs/mirror/example/Jamfile.v2 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -26,6 +26,10 @@
 exe spec_std_pair : special/std_pair.cpp ;
 exe spec_boost_tuple : special/boost_tuple.cpp ;
 #
+# algorithms
+#
+exe algo_begin_end : algorithms/begin_end.cpp ;
+#
 # traversal by visitors
 #
 exe tvrsl_sample_visitor : traversal/sample_visitor.cpp ;

Added: sandbox/mirror/libs/mirror/example/algorithms/begin_end.cpp
==============================================================================
--- (empty file)
+++ sandbox/mirror/libs/mirror/example/algorithms/begin_end.cpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -0,0 +1,187 @@
+/**
+ * \file examples/special/boost_tuple.cpp
+ *
+ * Example showing reflection of boost::tuples
+ *
+ * Copyright 2008 Matus Chochlik. 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/char_type_switch/string.hpp>
+#include <boost/char_type_switch/iostream.hpp>
+
+#include <boost/mirror/meta_namespace.hpp>
+#include <boost/mirror/meta_type.hpp>
+#include <boost/mirror/meta_class.hpp>
+
+#include <boost/mirror/algorithms.hpp>
+#include <boost/mirror/functions.hpp>
+
+#include <boost/mirror/meta_types/boost_tuple.hpp>
+#include <boost/mirror/meta_classes/boost_tuple.hpp>
+
+#include <boost/static_assert.hpp>
+#include <boost/mpl/modulus.hpp>
+#include <boost/type_traits/is_integral.hpp>
+
+namespace boost {
+namespace mirror {
+
+template <class Modulus>
+struct is_even_attrib_templ
+{
+ template <class MetaAttribute>
+ struct apply : mpl::equal_to<
+ mpl::modulus<
+ typename MetaAttribute::position,
+ mpl::int_<2>
+ >,
+ Modulus
+ >::type { };
+};
+
+typedef is_even_attrib_templ<mpl::int_<0> > is_even_attrib;
+typedef is_even_attrib_templ<mpl::int_<1> > is_odd_attrib;
+
+struct is_integral_attrib
+{
+
+ template <class MetaAttribute>
+ struct apply : is_integral<
+ typename MetaAttribute::type
+ >::type { };
+};
+
+} // namespace mirror
+} // namespace boost
+
+int main(void)
+{
+ using namespace ::std;
+ using namespace ::boost;
+ using namespace ::boost::mirror;
+ //
+ typedef tuple<bool, unsigned char, char, wchar_t, short, int, long, float, double> T;
+ //
+ typedef BOOST_MIRROR_REFLECT_CLASS(T) meta_T;
+ //
+ //
+ typedef begin<meta_T::all_attributes>::type i_0;
+ bcout << deref<i_0>::type::base_name() << ',' ;
+ typedef next<i_0>::type i_1;
+ bcout << deref<i_1>::type::base_name() << ',' ;
+ typedef next<i_1>::type i_2;
+ bcout << deref<i_2>::type::base_name() << ',' ;
+ typedef next<i_2>::type i_3;
+ bcout << deref<i_3>::type::base_name() << ',' ;
+ typedef next<i_3>::type i_4;
+ bcout << deref<i_4>::type::base_name() << ',' ;
+ typedef next<i_4>::type i_5;
+ bcout << deref<i_5>::type::base_name() << ',' ;
+ typedef next<i_5>::type i_6;
+ bcout << deref<i_6>::type::base_name() << ',' ;
+ typedef next<i_6>::type i_7;
+ bcout << deref<i_7>::type::base_name() << ',' ;
+ typedef next<i_7>::type i_8;
+ bcout << deref<i_8>::type::base_name() << endl ;
+ typedef next<i_8>::type i_end;
+ //
+ BOOST_STATIC_ASSERT((is_equal_iterator<
+ end<meta_T::all_attributes>::type, i_end
+ >::value));
+ //
+ bcout << "---------------------------------------------------" << endl;
+ typedef prior<i_end>::type j_8;
+ bcout << deref<j_8>::type::base_name() << ',' ;
+ typedef prior<i_8>::type j_7;
+ bcout << deref<j_7>::type::base_name() << ',' ;
+ typedef prior<i_7>::type j_6;
+ bcout << deref<j_6>::type::base_name() << ',' ;
+ typedef prior<i_6>::type j_5;
+ bcout << deref<j_5>::type::base_name() << ',' ;
+ typedef prior<i_5>::type j_4;
+ bcout << deref<j_4>::type::base_name() << ',' ;
+ typedef prior<i_4>::type j_3;
+ bcout << deref<j_3>::type::base_name() << ',' ;
+ typedef prior<i_3>::type j_2;
+ bcout << deref<j_2>::type::base_name() << ',' ;
+ typedef prior<i_2>::type j_1;
+ bcout << deref<j_1>::type::base_name() << ',' ;
+ typedef prior<i_1>::type j_0;
+ bcout << deref<j_0>::type::base_name() << endl ;
+ typedef j_0 j_begin;
+ //
+ BOOST_STATIC_ASSERT((is_equal_iterator<
+ begin<meta_T::all_attributes>::type, j_begin
+ >::value));
+ //
+ bcout << "---------------------------------------------------" << endl;
+ //
+ typedef find_if<meta_T::all_attributes, is_even_attrib>::type n_0;
+ bcout << deref<n_0>::type::base_name() << ',' ;
+ typedef next<n_0>::type n_2;
+ bcout << deref<n_2>::type::base_name() << ',' ;
+ typedef next<n_2>::type n_4;
+ bcout << deref<n_4>::type::base_name() << ',' ;
+ typedef next<n_4>::type n_6;
+ bcout << deref<n_6>::type::base_name() << ',' ;
+ typedef next<n_6>::type n_8;
+ bcout << deref<n_8>::type::base_name() << endl ;
+ typedef next<n_8>::type n_end;
+ //
+ BOOST_STATIC_ASSERT((is_equal_iterator<
+ end<meta_T::all_attributes>::type, n_end
+ >::value));
+ //
+ bcout << "---------------------------------------------------" << endl;
+ //
+ typedef find_if<meta_T::all_attributes, is_odd_attrib >::type m_1;
+ bcout << deref<m_1>::type::base_name() << ',' ;
+ typedef next<m_1>::type m_3;
+ bcout << deref<m_3>::type::base_name() << ',' ;
+ typedef next<m_3>::type m_5;
+ bcout << deref<m_5>::type::base_name() << ',' ;
+ typedef next<m_5>::type m_7;
+ bcout << deref<m_7>::type::base_name() << endl ;
+ typedef next<m_7>::type m_end;
+ //
+ BOOST_STATIC_ASSERT((is_equal_iterator<
+ end<meta_T::all_attributes>::type, m_end
+ >::value));
+ //
+ bcout << "---------------------------------------------------" << endl;
+ //
+ typedef find_if<meta_T::all_attributes, is_integral_attrib >::type o_0;
+ bcout << deref<o_0>::type::base_name() << ',' ;
+ typedef next<o_0>::type o_1;
+ bcout << deref<o_1>::type::base_name() << ',' ;
+ typedef next<o_1>::type o_2;
+ bcout << deref<o_2>::type::base_name() << ',' ;
+ typedef next<o_2>::type o_3;
+ bcout << deref<o_3>::type::base_name() << ',' ;
+ typedef next<o_3>::type o_4;
+ bcout << deref<o_4>::type::base_name() << ',' ;
+ typedef next<o_4>::type o_5;
+ bcout << deref<o_5>::type::base_name() << ',' ;
+ typedef next<o_5>::type o_6;
+ bcout << deref<o_6>::type::base_name() << endl ;
+ typedef next<o_6>::type o_end;
+ //
+ BOOST_STATIC_ASSERT((is_equal_iterator<
+ end<meta_T::all_attributes>::type, o_end
+ >::value));
+ //
+ bcout << "---------------------------------------------------" << endl;
+ //
+ BOOST_STATIC_ASSERT((is_equal_iterator<
+ begin<meta_T::base_classes>::type,
+ end<meta_T::base_classes>::type
+ >::value));
+ //
+ bcout << "---------------------------------------------------" << endl;
+ bcout << "Finished" << endl;
+ return 0;
+}
+

Modified: sandbox/mirror/libs/mirror/example/registering/virtual_bases.cpp
==============================================================================
--- sandbox/mirror/libs/mirror/example/registering/virtual_bases.cpp (original)
+++ sandbox/mirror/libs/mirror/example/registering/virtual_bases.cpp 2008-05-09 15:50:16 EDT (Fri, 09 May 2008)
@@ -308,9 +308,41 @@
         meta_T::all_attributes::set(t, mpl::int_<7>(), L'A');
         assert(t.w == L'A');
         //
- bcout << "--------------------------------------------" << endl;
+ // alternate means of getting the values of the attributes
         //
-
+ assert((
+ at<meta_T::all_attributes, mpl::int_<0> >::type::get(t) ==
+ meta_T::all_attributes::get(t, mpl::int_<0>())
+ ));
+ assert((
+ at<meta_T::all_attributes, mpl::int_<1> >::type::get(t) ==
+ meta_T::all_attributes::get(t, mpl::int_<1>())
+ ));
+ assert((
+ at<meta_T::all_attributes, mpl::int_<2> >::type::get(t) ==
+ meta_T::all_attributes::get(t, mpl::int_<2>())
+ ));
+ assert((
+ at<meta_T::all_attributes, mpl::int_<3> >::type::get(t) ==
+ meta_T::all_attributes::get(t, mpl::int_<3>())
+ ));
+ assert((
+ at<meta_T::all_attributes, mpl::int_<4> >::type::get(t) ==
+ meta_T::all_attributes::get(t, mpl::int_<4>())
+ ));
+ assert((
+ at<meta_T::all_attributes, mpl::int_<5> >::type::get(t) ==
+ meta_T::all_attributes::get(t, mpl::int_<5>())
+ ));
+ assert((
+ at<meta_T::all_attributes, mpl::int_<6> >::type::get(t) ==
+ meta_T::all_attributes::get(t, mpl::int_<6>())
+ ));
+ assert((
+ at<meta_T::all_attributes, mpl::int_<7> >::type::get(t) ==
+ meta_T::all_attributes::get(t, mpl::int_<7>())
+ ));
+ bcout << "--------------------------------------------" << endl;
         //
         return 0;
 }


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