Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56692 - in sandbox/statistics/detail: . fusion fusion/boost fusion/boost/statistics fusion/boost/statistics/detail fusion/boost/statistics/detail/fusion fusion/boost/statistics/detail/fusion/functor fusion/boost/statistics/detail/fusion/iterator fusion/libs fusion/libs/statistics fusion/libs/statistics/detail fusion/libs/statistics/detail/fusion fusion/libs/statistics/detail/fusion/doc fusion/libs/statistics/detail/fusion/example fusion/libs/statistics/detail/fusion/src math math/boost math/boost/statistics math/boost/statistics/detail math/boost/statistics/detail/math math/boost/statistics/detail/math/function numeric numeric/boost numeric/boost/statistics numeric/boost/statistics/detail numeric/boost/statistics/detail/numeric numeric/boost/statistics/detail/numeric/algorithm tuple tuple/boost tuple/boost/statistics tuple/boost/statistics/detail tuple/boost/statistics/detail/tuple tuple/boost/statistics/detail/tuple/functor
From: erwann.rogard_at_[hidden]
Date: 2009-10-09 22:55:24


Author: e_r
Date: 2009-10-09 22:55:23 EDT (Fri, 09 Oct 2009)
New Revision: 56692
URL: http://svn.boost.org/trac/boost/changeset/56692

Log:
a
Added:
   sandbox/statistics/detail/
   sandbox/statistics/detail/fusion/
   sandbox/statistics/detail/fusion/boost/
   sandbox/statistics/detail/fusion/boost/statistics/
   sandbox/statistics/detail/fusion/boost/statistics/detail/
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/functor/
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/functor/at_key.hpp (contents, props changed)
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/iterator/
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/iterator/at_key.hpp (contents, props changed)
   sandbox/statistics/detail/fusion/libs/
   sandbox/statistics/detail/fusion/libs/statistics/
   sandbox/statistics/detail/fusion/libs/statistics/detail/
   sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/
   sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/at_key_iterator.cpp (contents, props changed)
   sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/at_key_iterator.h (contents, props changed)
   sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/doc/
   sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/doc/readme.txt (contents, props changed)
   sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/example/
   sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/example/iterator_at_key.cpp (contents, props changed)
   sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/example/iterator_at_key.h (contents, props changed)
   sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/src/
   sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/src/main.cpp (contents, props changed)
   sandbox/statistics/detail/math/
   sandbox/statistics/detail/math/boost/
   sandbox/statistics/detail/math/boost/statistics/
   sandbox/statistics/detail/math/boost/statistics/detail/
   sandbox/statistics/detail/math/boost/statistics/detail/math/
   sandbox/statistics/detail/math/boost/statistics/detail/math/function/
   sandbox/statistics/detail/math/boost/statistics/detail/math/function/versatile_equal.hpp (contents, props changed)
   sandbox/statistics/detail/numeric/
   sandbox/statistics/detail/numeric/boost/
   sandbox/statistics/detail/numeric/boost/statistics/
   sandbox/statistics/detail/numeric/boost/statistics/detail/
   sandbox/statistics/detail/numeric/boost/statistics/detail/numeric/
   sandbox/statistics/detail/numeric/boost/statistics/detail/numeric/algorithm/
   sandbox/statistics/detail/numeric/boost/statistics/detail/numeric/algorithm/min_element.hpp (contents, props changed)
   sandbox/statistics/detail/tuple/
   sandbox/statistics/detail/tuple/boost/
   sandbox/statistics/detail/tuple/boost/statistics/
   sandbox/statistics/detail/tuple/boost/statistics/detail/
   sandbox/statistics/detail/tuple/boost/statistics/detail/tuple/
   sandbox/statistics/detail/tuple/boost/statistics/detail/tuple/functor/
   sandbox/statistics/detail/tuple/boost/statistics/detail/tuple/functor/element.hpp (contents, props changed)

Added: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/functor/at_key.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/functor/at_key.hpp 2009-10-09 22:55:23 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,62 @@
+//////////////////////////////////////////////////////////////////////////////
+// statistics::detail::fusion::functor::at_key.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_FUNCTOR_AT_KEY_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_FUSION_FUNCTOR_AT_KEY_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 functor{
+
+ template<typename K>
+ class at_key{
+
+ // 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 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);
+ }
+
+ };
+
+}// functor
+}// fusion
+}// detail
+}// statistics
+}// boost
+
+#endif
+

Added: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/iterator/at_key.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/iterator/at_key.hpp 2009-10-09 22:55:23 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,57 @@
+//////////////////////////////////////////////////////////////////////////////
+// statistics::detail::fusion::functor::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_ITERATOR_AT_KEY_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_FUSION_ITERATOR_AT_KEY_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 iterator{
+
+ template<typename It,typename K>
+ struct meta_at_key
+ {
+ 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
+ //
+ // Note that at_key2 could also have been used
+
+ 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_at_key<It,K>::type
+ make_at_key(It i){
+ typedef meta_at_key<It,K> m_;
+ return m_::make(i);
+ }
+
+}// functor
+}// fusion
+}// detail
+}// statistics
+}// boost
+
+#endif

Added: sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/at_key_iterator.cpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/at_key_iterator.cpp 2009-10-09 22:55:23 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,18 @@
+///////////////////////////////////////////////////////////////////////////////
+// statistics::detail::fusion::at_key_iterator.cpp //
+// //
+// Copyright 2009 Erwann Rogard. 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 <libs/statistics/detail/fusion/example/at_key_iterator.h>
+
+
+void example_at_key_iterator(std::ostream& os){
+
+
+}
+
+
+

Added: sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/at_key_iterator.h
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/at_key_iterator.h 2009-10-09 22:55:23 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// statistics::detail::kernel::functional::nw_visitor.hpp //
+// //
+// Copyright 2009 Erwann Rogard. 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_STATISTICS_DETAIL_KERNEL_ESTIMATION_NW_VISITOR_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_KERNEL_ESTIMATION_NW_VISITOR_HPP_ER_2009
+#include <iostream>
+
+void example_at_key_iterator(std::ostream&);
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/doc/readme.txt
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/doc/readme.txt 2009-10-09 22:55:23 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,29 @@
+//////////////////////////////////////////////////////////////////////////////
+// statistics::detail::fusion::doc::readme //
+// //
+// (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) //
+//////////////////////////////////////////////////////////////////////////////
+
+[ Contact ]
+
+erwann.rogard_at_[hidden]
+
+[ Overview ]
+
+These are small C++ tools that exploit Boost.Fusion and are used throughout the
+sandbox/statistics package
+
+[ Compiler ]
+
+gcc version i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1
+
+[ Dependencies ]
+
+boost_1_39_0
+
+[ Related ]
+
+http://www.boost.org/doc/libs/1_40_0/libs/fusion/index.html

Added: sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/example/iterator_at_key.cpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/example/iterator_at_key.cpp 2009-10-09 22:55:23 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,105 @@
+///////////////////////////////////////////////////////////////////////////////
+// statistics::detail::fusion::iterator_at_key_iterator.cpp //
+// //
+// Copyright 2009 Erwann Rogard. 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 <vector>
+#include <boost/mpl/int.hpp>
+#include <boost/utility/result_of.hpp>
+#include <boost/assert.hpp>
+#include <boost/range.hpp>
+#include <boost/fusion/sequence/intrinsic/at_key.hpp>
+#include <boost/fusion/include/at_key.hpp>
+#include <boost/fusion/container/map.hpp>
+#include <boost/fusion/include/map.hpp>
+#include <boost/fusion/include/map_fwd.hpp>
+#include <boost/statistics/detail/fusion/functor/at_key.hpp>
+#include <boost/statistics/detail/fusion/iterator/at_key.hpp>
+
+#include <boost/iterator/iterator_traits.hpp>
+
+#include <libs/statistics/detail/fusion/example/iterator_at_key.h>
+
+void example_iterator_at_key(std::ostream& os){
+
+ os << "example_at_key_iterator -> ";
+
+ using namespace boost;
+ namespace stat = boost::statistics::detail;
+
+ typedef mpl::int_<0> key_0_;
+ typedef mpl::int_<1> key_1_;
+
+ typedef fusion::pair<key_0_,int> p_0_;
+ typedef fusion::pair<key_1_,int> p_1_;
+ typedef fusion::map<p_0_,p_1_> map_;
+ typedef stat::fusion::functor::at_key<key_0_> get_0_;
+ typedef stat::fusion::functor::at_key<key_1_> get_1_;
+ typedef std::vector<map_> vec_map_;
+ typedef range_iterator<const vec_map_>::type it_cvec_map_;
+ typedef stat::fusion::iterator::meta_at_key<it_cvec_map_,key_0_> m_0_;
+ typedef m_0_::type it_0_;
+ typedef stat::fusion::iterator::meta_at_key<it_cvec_map_,key_1_> m_1_;
+ typedef m_1_::type it_1_;
+
+ const unsigned n = 10;
+
+ vec_map_ vec_map; vec_map.reserve(n);
+ for(unsigned i = 0; i<n; i++){
+ map_ map(
+ fusion::make_pair<key_0_>( i ),
+ fusion::make_pair<key_1_>( i+1 )
+ );
+ vec_map.push_back(map);
+ }
+
+ {
+ typedef it_0_ it_;
+ typedef key_0_ key_;
+
+ it_ b = stat::fusion::iterator::make_at_key<key_>(
+ boost::begin(vec_map)
+ );
+ it_ e = stat::fusion::iterator::make_at_key<key_>(
+ boost::end(vec_map)
+ );
+ unsigned j = 0;
+ b<e;
+ for(it_ i = b; i<e; i++,j++)
+ {
+ BOOST_ASSERT(
+ *i == fusion::at_key<key_>(
+ vec_map[j]
+ )
+ );
+ }
+ }
+ {
+ typedef it_1_ it_;
+ typedef key_1_ key_;
+
+ it_ b = stat::fusion::iterator::make_at_key<key_>(
+ boost::begin(vec_map)
+ );
+ it_ e = stat::fusion::iterator::make_at_key<key_>(
+ boost::end(vec_map)
+ );
+ unsigned j = 0;
+ for(it_ i = b; i<e; i++,j++)
+ {
+ BOOST_ASSERT(
+ *i == fusion::at_key<key_>(
+ vec_map[j]
+ )
+ );
+ }
+ }
+
+ os << "<-" << std::endl;
+
+}
+
+
+

Added: sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/example/iterator_at_key.h
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/example/iterator_at_key.h 2009-10-09 22:55:23 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// statistics::detail::fusion::example::iterator_at_key.h //
+// //
+// Copyright 2009 Erwann Rogard. 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 LIBS_STATISTICS_DETAIL_FUSION_EXAMPLE_ITERATOR_AT_KEY_HPP_ER_2009
+#define LIBS_STATISTICS_DETAIL_FUSION_EXAMPLE_ITERATOR_AT_KEY_HPP_ER_2009
+#include <iostream>
+
+void example_iterator_at_key(std::ostream&);
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/src/main.cpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/src/main.cpp 2009-10-09 22:55:23 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,16 @@
+///////////////////////////////////////////////////////////////////////////////
+// statistics::detail::fusion::main.cpp //
+// //
+// Copyright 2009 Erwann Rogard. 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 <iostream>
+#include <libs/statistics/detail/fusion/example/iterator_at_key.h>
+
+int main(){
+
+ example_iterator_at_key(std::cout);
+
+ return 0;
+}

Added: sandbox/statistics/detail/math/boost/statistics/detail/math/function/versatile_equal.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/math/boost/statistics/detail/math/function/versatile_equal.hpp 2009-10-09 22:55:23 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,47 @@
+///////////////////////////////////////////////////////////////////////////////
+// math::versatile_equal.hpp //
+// //
+// Copyright 2009 Erwann Rogard. 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_STATISTICS_DETAIL_MATH_FUNCTION_VERSATILE_EQUAL_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_MATH_FUNCTION_VERSATILE_EQUAL_HPP_ER_2009
+#include <cmath>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_float.hpp>
+#include <boost/type_traits/is_integral.hpp>
+#include <boost/math/tools/precision.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace math{
+namespace function{
+
+ template<typename T>
+ typename boost::enable_if<
+ typename is_float<T>::type,
+ bool
+ >::type
+ versatile_equal(const T& a,const T& b){
+ static T eps = boost::math::tools::epsilon<T>();
+ return fabs(a-b)<eps;
+ }
+
+ template<typename T>
+ typename enable_if<
+ typename is_integral<T>::type,
+ bool
+ >::type
+ versatile_equal(const T& a,const T& b){
+ return (a == b);
+ }
+
+}// function
+}// math
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/detail/numeric/boost/statistics/detail/numeric/algorithm/min_element.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/numeric/boost/statistics/detail/numeric/algorithm/min_element.hpp 2009-10-09 22:55:23 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,64 @@
+///////////////////////////////////////////////////////////////////////////////
+// numeric::algorithm::min_element.hpp //
+// //
+// Copyright 2009 Erwann Rogard. 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_STATISTICS_DETAIL_NUMERIC_ALGORITHM_MIN_ELEMENT_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_NUMERIC_ALGORITHM_MIN_ELEMENT_HPP_ER_2009
+#include <limits>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/numeric/conversion/bounds.hpp>
+#include <boost/limits.hpp>
+#include <boost/concept_check.hpp>
+#include <boost/concept/assert.hpp>
+#include <iostream>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace numeric{
+namespace algorithm{
+
+// This is a rewrite of std::min_element with one additional argument, m, which
+// is assigned the min value of *i over [first,last).
+//
+// Rationale: saves one dereferencing operation,
+// which may be worthwhile if dereferencing is expensive.
+template <typename It,typename V>
+It min_element(It first, It last,V& min_value) {
+ typedef typename iterator_value<It>::type value_type;
+
+ // TODO see about enable_if/disable_if
+ static bool has_inf = std::numeric_limits<V>::has_infinity;
+ static V inf_if = std::numeric_limits<V>::infinity();
+ static V highest = boost::numeric::bounds<V>::highest();
+ static V inf_ = has_inf? inf_if : highest;
+
+ BOOST_CONCEPT_ASSERT((
+ boost::IncrementableIterator<It>
+ ));
+
+ min_value = inf_;
+ value_type value;
+ It result = first;
+ while (first != last){
+ value = (*first);
+ if (value < min_value){
+ min_value = value;
+ result = first;
+ }
+
+ ++first;
+ }
+ return result;
+}
+
+}// algorithm
+}// numeric
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/detail/tuple/boost/statistics/detail/tuple/functor/element.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/tuple/boost/statistics/detail/tuple/functor/element.hpp 2009-10-09 22:55:23 EDT (Fri, 09 Oct 2009)
@@ -0,0 +1,58 @@
+///////////////////////////////////////////////////////////////////////////////
+// statistcs::detail::tuple::functor::tuple_element.hpp //
+// //
+// Copyright 2009 Erwann Rogard. 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_STATISTICS_DETAIL_TUPLE_FUNCTOR_TUPLE_ELEMENT_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_TUPLE_FUNCTOR_TUPLE_ELEMENT_HPP_ER_2009
+#include <boost/tuple/tuple.hpp>
+#include <boost/type_traits.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace tuple{
+namespace functor{
+
+
+ // maps a tuple to its i^th element
+ //
+ // See http://lists.boost.org/boost-users/2005/07/12644.php
+ template<unsigned i>
+ struct element{
+
+ template<typename S>
+ struct result{};
+
+ template<typename F,typename T>
+ struct result<F(T&)>{
+ typedef typename boost::tuples::element<i,T>::type type;
+ };
+
+ template<typename S>
+ struct sig : result<S>{};
+
+ template<typename T>
+ typename result<element(T&)>::type
+ operator()(T& t)const{
+ return boost::get<i>(t);
+ }
+
+ template<typename T>
+ typename result<element(const T&)>::type
+ operator()(const T& t)const{
+ return boost::get<i>(t);
+ }
+
+
+ };
+
+}// functor
+}// tuple
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file


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