Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74881 - in trunk/boost/fusion/container/map: . detail detail/preprocessed
From: joel_at_[hidden]
Date: 2011-10-10 05:55:46


Author: djowel
Date: 2011-10-10 05:55:41 EDT (Mon, 10 Oct 2011)
New Revision: 74881
URL: http://svn.boost.org/trac/boost/changeset/74881

Log:
Made map random access. Thanks to Brandon Kohn!
Added:
   trunk/boost/fusion/container/map/detail/at_impl.hpp (contents, props changed)
   trunk/boost/fusion/container/map/detail/value_at_impl.hpp (contents, props changed)
Text files modified:
   trunk/boost/fusion/container/map/detail/preprocessed/map10.hpp | 2 +-
   trunk/boost/fusion/container/map/detail/preprocessed/map20.hpp | 2 +-
   trunk/boost/fusion/container/map/detail/preprocessed/map30.hpp | 2 +-
   trunk/boost/fusion/container/map/detail/preprocessed/map40.hpp | 2 +-
   trunk/boost/fusion/container/map/detail/preprocessed/map50.hpp | 2 +-
   trunk/boost/fusion/container/map/map.hpp | 4 +++-
   6 files changed, 8 insertions(+), 6 deletions(-)

Added: trunk/boost/fusion/container/map/detail/at_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/container/map/detail/at_impl.hpp 2011-10-10 05:55:41 EDT (Mon, 10 Oct 2011)
@@ -0,0 +1,57 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2011 Brandon Kohn
+
+ 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_MAP_DETAIL_AT_IMPL_HPP)
+#define BOOST_FUSION_MAP_DETAIL_AT_IMPL_HPP
+
+#include <boost/fusion/support/detail/access.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/mpl/at.hpp>
+#include <boost/mpl/int.hpp>
+
+namespace boost { namespace fusion
+{
+ struct map_tag;
+
+ namespace extension
+ {
+ template <typename Tag>
+ struct at_impl;
+
+ template <>
+ struct at_impl<map_tag>
+ {
+ template <typename Sequence, typename N>
+ struct apply
+ {
+ typedef mpl::at<typename Sequence::storage_type::types, N> element;
+ typedef typename detail::ref_result<element>::type type;
+
+ static type
+ call(Sequence& m)
+ {
+ return m.get_data().at_impl(N());
+ }
+ };
+
+ template <typename Sequence, typename N>
+ struct apply <Sequence const, N>
+ {
+ typedef mpl::at<typename Sequence::storage_type::types, N> element;
+ typedef typename detail::cref_result<element>::type type;
+
+ static type
+ call(Sequence const& m)
+ {
+ return m.get_data().at_impl(N());
+ }
+ };
+ };
+ }
+}}
+
+#endif //BOOST_FUSION_MAP_DETAIL_AT_IMPL_HPP

Modified: trunk/boost/fusion/container/map/detail/preprocessed/map10.hpp
==============================================================================
--- trunk/boost/fusion/container/map/detail/preprocessed/map10.hpp (original)
+++ trunk/boost/fusion/container/map/detail/preprocessed/map10.hpp 2011-10-10 05:55:41 EDT (Mon, 10 Oct 2011)
@@ -13,7 +13,7 @@
     template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9>
     struct map : sequence_base<map<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9> >
     {
- struct category : forward_traversal_tag, associative_tag {};
+ struct category : random_access_traversal_tag, associative_tag {};
         typedef map_tag fusion_tag;
         typedef fusion_sequence_tag tag;
         typedef mpl::false_ is_view;

Modified: trunk/boost/fusion/container/map/detail/preprocessed/map20.hpp
==============================================================================
--- trunk/boost/fusion/container/map/detail/preprocessed/map20.hpp (original)
+++ trunk/boost/fusion/container/map/detail/preprocessed/map20.hpp 2011-10-10 05:55:41 EDT (Mon, 10 Oct 2011)
@@ -13,7 +13,7 @@
     template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19>
     struct map : sequence_base<map<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19> >
     {
- struct category : forward_traversal_tag, associative_tag {};
+ struct category : random_access_traversal_tag, associative_tag {};
         typedef map_tag fusion_tag;
         typedef fusion_sequence_tag tag;
         typedef mpl::false_ is_view;

Modified: trunk/boost/fusion/container/map/detail/preprocessed/map30.hpp
==============================================================================
--- trunk/boost/fusion/container/map/detail/preprocessed/map30.hpp (original)
+++ trunk/boost/fusion/container/map/detail/preprocessed/map30.hpp 2011-10-10 05:55:41 EDT (Mon, 10 Oct 2011)
@@ -13,7 +13,7 @@
     template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29>
     struct map : sequence_base<map<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29> >
     {
- struct category : forward_traversal_tag, associative_tag {};
+ struct category : random_access_traversal_tag, associative_tag {};
         typedef map_tag fusion_tag;
         typedef fusion_sequence_tag tag;
         typedef mpl::false_ is_view;

Modified: trunk/boost/fusion/container/map/detail/preprocessed/map40.hpp
==============================================================================
--- trunk/boost/fusion/container/map/detail/preprocessed/map40.hpp (original)
+++ trunk/boost/fusion/container/map/detail/preprocessed/map40.hpp 2011-10-10 05:55:41 EDT (Mon, 10 Oct 2011)
@@ -13,7 +13,7 @@
     template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39>
     struct map : sequence_base<map<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39> >
     {
- struct category : forward_traversal_tag, associative_tag {};
+ struct category : random_access_traversal_tag, associative_tag {};
         typedef map_tag fusion_tag;
         typedef fusion_sequence_tag tag;
         typedef mpl::false_ is_view;

Modified: trunk/boost/fusion/container/map/detail/preprocessed/map50.hpp
==============================================================================
--- trunk/boost/fusion/container/map/detail/preprocessed/map50.hpp (original)
+++ trunk/boost/fusion/container/map/detail/preprocessed/map50.hpp 2011-10-10 05:55:41 EDT (Mon, 10 Oct 2011)
@@ -13,7 +13,7 @@
     template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39 , typename T40 , typename T41 , typename T42 , typename T43 , typename T44 , typename T45 , typename T46 , typename T47 , typename T48 , typename T49>
     struct map : sequence_base<map<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39 , T40 , T41 , T42 , T43 , T44 , T45 , T46 , T47 , T48 , T49> >
     {
- struct category : forward_traversal_tag, associative_tag {};
+ struct category : random_access_traversal_tag, associative_tag {};
         typedef map_tag fusion_tag;
         typedef fusion_sequence_tag tag;
         typedef mpl::false_ is_view;

Added: trunk/boost/fusion/container/map/detail/value_at_impl.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/fusion/container/map/detail/value_at_impl.hpp 2011-10-10 05:55:41 EDT (Mon, 10 Oct 2011)
@@ -0,0 +1,34 @@
+/*=============================================================================
+ Copyright (c) 2001-2011 Joel de Guzman
+ Copyright (c) 2011 Brandon Kohn
+
+ 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_MAP_DETAIL_VALUE_AT_IMPL_HPP)
+#define BOOST_FUSION_MAP_DETAIL_VALUE_AT_IMPL_HPP
+
+#include <boost/mpl/at.hpp>
+
+namespace boost { namespace fusion
+{
+ struct map_tag;
+
+ namespace extension
+ {
+ template <typename Tag>
+ struct value_at_impl;
+
+ template <>
+ struct value_at_impl<map_tag>
+ {
+ template <typename Sequence, typename N>
+ struct apply
+ {
+ typedef typename mpl::at<typename Sequence::storage_type::types, N>::type type;
+ };
+ };
+ }
+}}
+
+#endif //BOOST_FUSION_MAP_DETAIL_VALUE_AT_IMPL_HPP

Modified: trunk/boost/fusion/container/map/map.hpp
==============================================================================
--- trunk/boost/fusion/container/map/map.hpp (original)
+++ trunk/boost/fusion/container/map/map.hpp 2011-10-10 05:55:41 EDT (Mon, 10 Oct 2011)
@@ -11,6 +11,8 @@
 #include <boost/fusion/support/category_of.hpp>
 #include <boost/fusion/support/detail/access.hpp>
 #include <boost/fusion/container/map/map_fwd.hpp>
+#include <boost/fusion/container/map/detail/at_impl.hpp>
+#include <boost/fusion/container/map/detail/value_at_impl.hpp>
 #include <boost/fusion/container/map/detail/begin_impl.hpp>
 #include <boost/fusion/container/map/detail/end_impl.hpp>
 #include <boost/fusion/container/map/detail/value_of_impl.hpp>
@@ -50,7 +52,7 @@
     template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, typename T)>
     struct map : sequence_base<map<BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, T)> >
     {
- struct category : forward_traversal_tag, associative_tag {};
+ struct category : random_access_traversal_tag, associative_tag {};
 
         typedef map_tag fusion_tag;
         typedef fusion_sequence_tag tag; // this gets picked up by MPL


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