$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r56891 - sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/at_key
From: erwann.rogard_at_[hidden]
Date: 2009-10-16 00:27:44
Author: e_r
Date: 2009-10-16 00:27:39 EDT (Fri, 16 Oct 2009)
New Revision: 56891
URL: http://svn.boost.org/trac/boost/changeset/56891
Log:
a
Added:
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/at_key/
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/at_key/functor.hpp   (contents, props changed)
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/at_key/iterator.hpp   (contents, props changed)
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/at_key/range.hpp   (contents, props changed)
Added: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/at_key/functor.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/at_key/functor.hpp	2009-10-16 00:27:39 EDT (Fri, 16 Oct 2009)
@@ -0,0 +1,64 @@
+//////////////////////////////////////////////////////////////////////////////
+// statistics::detail::fusion::at_key::functor.hpp                          //
+//                                                                          //
+//  (C) Copyright 2009 Erwann Rogard                                        //
+//  Use, modification and distribution are 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)        //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef  BOOST_STATISTICS_DETAIL_FUSION_AT_KEY_FUNCTOR_HPP_ER_2009
+#define  BOOST_STATISTICS_DETAIL_FUSION_AT_KEY_FUNCTOR_HPP_ER_2009
+#include <boost/utility/result_of.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/mpl/identity.hpp>
+
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/include/at_key.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace fusion{
+namespace at_key{
+
+    template<typename K>
+    class functor{
+    
+        // M has to be a fusion::map
+        template<typename M> 
+        struct result_impl
+            : boost::fusion::result_of::at_key<M, K>{};
+
+        public:
+
+        template<typename S> 
+        struct result{};
+    
+        template<typename F,typename M>
+        struct result<F(M)>
+            : result_impl<typename remove_reference<M>::type>{};
+
+        template<typename S>
+        struct sig : result<S>{};
+    
+        template<typename M>
+        typename result_impl<const M>::type 
+        operator()(const M& p)const{
+            return boost::fusion::at_key<K>(p);
+        }
+    
+        template<typename M>
+        typename result_impl<M>::type 
+        operator()(M& p)const{
+            return boost::fusion::at_key<K>(p);
+        }
+    
+    };
+    
+}// at_key
+}// fusion
+}// detail
+}// statistics
+}// boost
+
+#endif
Added: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/at_key/iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/at_key/iterator.hpp	2009-10-16 00:27:39 EDT (Fri, 16 Oct 2009)
@@ -0,0 +1,55 @@
+//////////////////////////////////////////////////////////////////////////////
+// statistics::detail::fusion::at_key::iterator.hpp                         //
+//                                                                          //
+//  (C) Copyright 2009 Erwann Rogard                                        //
+//  Use, modification and distribution are 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)        //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef  BOOST_STATISTICS_DETAIL_FUSION_AT_KEY_ITERATOR_HPP_ER_2009
+#define  BOOST_STATISTICS_DETAIL_FUSION_AT_KEY_ITERATOR_HPP_ER_2009
+#include <boost/utility/result_of.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/statistics/detail/fusion/functor/at_key.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace fusion{
+namespace at_key{
+
+    template<typename It,typename K>
+    struct meta_iterator
+    {
+        typedef statistics::detail::fusion::functor::at_key<K> f_;
+        typedef typename iterator_reference<It>::type ref1_;
+        
+        // See boost.user mailing list
+        // Subject: [transform_iterator]'s reference
+        // 10/05/2009
+                
+        typedef typename result_of<f_(ref1_)>::type ref2_;
+        typedef boost::transform_iterator<f_,It,ref2_> type;
+    
+        static type make(It i){
+            // don't use make_transform_iterator because not default.
+            return type(i,f_());
+        }
+    
+    };
+
+    template<typename K,typename It>
+    typename meta_iterator<It,K>::type
+    make_iterator(It i){
+        typedef meta_iterator<It,K> m_;
+        return m_::make(i);
+    }
+
+}// at_key
+}// fusion
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file
Added: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/at_key/range.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/at_key/range.hpp	2009-10-16 00:27:39 EDT (Fri, 16 Oct 2009)
@@ -0,0 +1,50 @@
+//////////////////////////////////////////////////////////////////////////////
+// statistics::detail::fusion::at_key::range.hpp                            //
+//                                                                          //
+//  (C) Copyright 2009 Erwann Rogard                                        //
+//  Use, modification and distribution are 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)        //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef  BOOST_STATISTICS_DETAIL_FUSION_AT_KEY_RANGE_HPP_ER_2009
+#define  BOOST_STATISTICS_DETAIL_FUSION_AT_KEY_RANGE_HPP_ER_2009
+#include <boost/range.hpp>
+#include <boost/statistics/detail/fusion/at_key/iterator.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace fusion{
+namespace at_key{
+
+    template<typename It,typename K>
+    struct meta_range
+    {
+        typedef meta_iterator<It,K> meta_;
+        
+        typedef typename meta_::type it_;
+        typedef iterator_range<it_>  type;
+    
+        static type make(It b,It e){
+            return type(
+                make_iterator<K>(b),
+                make_iterator<K>(e)
+            );
+        }
+    
+    };
+
+    template<typename K,typename It>
+    typename meta_range<It,K>::type
+    make_range(It b,It e){
+        typedef meta_range<It,K> m_;
+        return m_::make(b,e);
+    }
+
+}// at_key
+}// fusion
+}// detail
+}// statistics
+}// boost
+
+#endif