|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58755 - in sandbox/statistics/detail: accumulator/boost/statistics/detail/accumulator/statistics fusion/boost/statistics/detail/fusion/joint_view fusion/libs/statistics/detail/fusion/example multi_array/libs/statistics/detail/multi_array/example
From: erwann.rogard_at_[hidden]
Date: 2010-01-06 06:48:44
Author: e_r
Date: 2010-01-06 06:48:41 EST (Wed, 06 Jan 2010)
New Revision: 58755
URL: http://svn.boost.org/trac/boost/changeset/58755
Log:
m/a
Added:
sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/
sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/binder.hpp (contents, props changed)
sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/binder_iterator.hpp (contents, props changed)
sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/example/joint_view_binder.cpp (contents, props changed)
sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/example/joint_view_binder.h (contents, props changed)
Text files modified:
sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/count_less_than.hpp | 10 ++++++----
sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/proportion_less_than.hpp | 4 +++-
sandbox/statistics/detail/multi_array/libs/statistics/detail/multi_array/example/serialize.cpp | 2 +-
3 files changed, 10 insertions(+), 6 deletions(-)
Modified: sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/count_less_than.hpp
==============================================================================
--- sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/count_less_than.hpp (original)
+++ sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/count_less_than.hpp 2010-01-06 06:48:41 EST (Wed, 06 Jan 2010)
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
-// accumulator::statistics::count_less_than.hpp // //
+// accumulator::statistics::count_less_than.hpp //
// //
// Copyright 2008 Erwann Rogard. Distributed under the Boost //
// Software License, Version 1.0. (See accompanying file //
@@ -7,7 +7,8 @@
///////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_COUNT_LESS_THAN_HPP_ER_2009
#define BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_COUNT_LESS_THAN_HPP_ER_2009
-
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/apply.hpp>
#include <boost/accumulators/framework/extractor.hpp>
#include <boost/accumulators/framework/accumulator_base.hpp>
#include <boost/accumulators/framework/parameters/sample.hpp>
@@ -67,7 +68,7 @@
struct count_less_than
: boost::accumulators::depends_on<>
{
- typedef impl::count_less_than<mpl::_1> impl;
+ typedef impl::count_less_than<boost::mpl::_1> impl;
};
}
@@ -78,7 +79,8 @@
{
template<typename AccumulatorSet>
- typename mpl::apply<AccumulatorSet,tag::count_less_than>::type::result_type
+ typename
+ boost::mpl::apply<AccumulatorSet,tag::count_less_than>::type::result_type
count_less_than(AccumulatorSet const& acc){
typedef tag::count_less_than the_tag;
return boost::accumulators::extract_result<the_tag>(acc);
Modified: sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/proportion_less_than.hpp
==============================================================================
--- sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/proportion_less_than.hpp (original)
+++ sandbox/statistics/detail/accumulator/boost/statistics/detail/accumulator/statistics/proportion_less_than.hpp 2010-01-06 06:48:41 EST (Wed, 06 Jan 2010)
@@ -7,6 +7,8 @@
///////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_PROPORTION_LESS_THAN_HPP_ER_2009
#define BOOST_STATISTICS_DETAIL_ACCUMULATOR_STATISTICS_PROPORTION_LESS_THAN_HPP_ER_2009
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/apply.hpp>
#include <boost/parameter/binding.hpp>
#include <boost/accumulators/framework/extractor.hpp>
#include <boost/accumulators/framework/accumulator_base.hpp>
@@ -68,7 +70,7 @@
tag::count_less_than
>
{
- typedef impl::proportion_less_than<mpl::_1> impl;
+ typedef impl::proportion_less_than<boost::mpl::_1> impl;
};
}
Added: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/binder.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/binder.hpp 2010-01-06 06:48:41 EST (Wed, 06 Jan 2010)
@@ -0,0 +1,109 @@
+///////////////////////////////////////////////////////////////////////////////
+// statistics::detail::fusion::joint_view::binder.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_FUSION_JOINT_VIEW_BINDER_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_FUSION_JOINT_VIEW_BINDER_HPP_ER_2009
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/empty_base.hpp>
+#include <boost/mpl/assert.hpp>
+
+#include <boost/type_traits.hpp>
+#include <boost/call_traits.hpp>
+#include <boost/utility/result_of.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/fusion/include/pair.hpp>
+#include <boost/fusion/include/map.hpp>
+#include <boost/fusion/include/joint_view.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace fusion{
+namespace joint_view{
+
+ template<
+ typename Seq1,
+ bool is_left = true
+ >
+ class binder
+ {
+ typedef boost::is_reference<Seq1> meta_is_ref_;
+ BOOST_MPL_ASSERT(( boost::mpl::not_< meta_is_ref_ > ));
+
+ typedef typename boost::add_const<Seq1>::type c_seq1_;
+
+ template<typename T0,typename T1,template<typename,typename> class F>
+ struct meta_
+ : boost::mpl::eval_if_c<
+ is_left,
+ boost::mpl::identity< F<T0,T1> >,
+ boost::mpl::identity< F<T1,T0> >
+ >{};
+
+ template<typename Seq2>
+ struct meta_view_ : meta_<
+ c_seq1_,
+ typename boost::add_const<Seq2>::type,
+ boost::fusion::joint_view
+ >{};
+
+ public:
+
+ template<typename S>
+ struct result{};
+
+ template<typename F,typename Seq2>
+ struct result<F(const Seq2&)> : meta_view_<Seq2>{};
+
+ binder(){}
+ binder(const Seq1& seq1) : s1(seq1){}
+ binder(const binder& that) : s1 (that.s1){}
+
+ binder&
+ operator=(const binder& that)
+ {
+ if(&that!=this)
+ {
+ this->s1 = that.s1;
+ }
+ return (*this);
+ }
+
+ template<typename Seq2>
+ typename boost::lazy_enable_if_c<
+ is_left,
+ meta_view_<Seq2>
+ >::type
+ operator()(const Seq2& seq2)const
+ {
+ typedef typename meta_view_<Seq2>::type view_;
+ return view_(this->s1,seq2);
+ }
+
+ template<typename Seq2>
+ typename boost::lazy_disable_if_c<
+ is_left,
+ meta_view_<Seq2>
+ >::type
+ operator()(const Seq2& seq2)const
+ {
+ typedef typename meta_view_<Seq2>::type view_;
+ return view_(seq2,this->s1);
+ }
+
+ private:
+ Seq1 s1;
+ };
+
+}// joint_view
+}// fusion
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file
Added: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/binder_iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/joint_view/binder_iterator.hpp 2010-01-06 06:48:41 EST (Wed, 06 Jan 2010)
@@ -0,0 +1,75 @@
+///////////////////////////////////////////////////////////////////////////////
+// statistics::detail::fusion::joint_view::binder_iterator.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_FUSION_JOINT_VIEW_BINDER_ITERATOR_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_FUSION_JOINT_VIEW_BINDER_ITERATOR_HPP_ER_2009
+#include <boost/utility/result_of.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/statistics/detail/fusion/joint_view/binder.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace fusion{
+namespace joint_view{
+
+ template<typename Seq1, bool is_left = true>
+ struct binder_iterator
+ {
+ typedef binder<Seq1,is_left> binder_;
+
+ template<typename It>
+ struct apply{
+ typedef typename iterator_value<It>::type seq2_;
+ typedef typename boost::add_const<seq2_>::type c_;
+ typedef typename boost::add_reference<c_>::type cref_;
+ typedef typename boost::result_of<binder_(cref_)>::type res_;
+ typedef boost::function<res_(cref_)> fun_;
+ typedef boost::transform_iterator<fun_,It> type;
+ static type call(const Seq1& seq1,It it)
+ {
+ return type(it,binder_(seq1));
+ }
+
+ typedef boost::iterator_range<type> range_type;
+ static range_type call(const Seq1& seq1,It b,It e){
+ return range_type(
+ call(seq1,b),
+ call(seq1,e)
+ );
+ }
+
+ };
+ };
+
+ template<typename Seq1,typename It>
+ typename binder_iterator<Seq1>::template apply<It>::type
+ make_binder_iterator(const Seq1& seq1,It it)
+ {
+ typedef binder_iterator<Seq1> meta_;
+ return meta_::template apply<It>::call(seq1,it);
+ }
+
+ template<typename Seq1,typename It>
+ typename binder_iterator<Seq1>::template apply<It>::range_type
+ make_binder_range(const Seq1& seq1,It b,It e)
+ {
+ typedef binder_iterator<Seq1> meta_;
+ return meta_::template apply<It>::call(seq1,b,e);
+ }
+
+
+}// joint_view
+}// fusion
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file
Added: sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/example/joint_view_binder.cpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/example/joint_view_binder.cpp 2010-01-06 06:48:41 EST (Wed, 06 Jan 2010)
@@ -0,0 +1,78 @@
+///////////////////////////////////////////////////////////////////////////////
+// statistics::detail::fusion::example::serialize.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 <fstream>
+#include <string>
+#include <boost/typeof/typeof.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/utility/result_of.hpp>
+#include <boost/assert.hpp>
+#include <boost/range.hpp>
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+#include <boost/fusion/include/at_key.hpp>
+#include <boost/fusion/include/at_c.hpp>
+#include <boost/fusion/include/pair.hpp>
+#include <boost/fusion/include/map.hpp>
+#include <boost/fusion/include/make_map.hpp>
+#include <boost/fusion/include/make_vector.hpp>
+
+#include <boost/statistics/detail/fusion/joint_view/binder.hpp>
+//#include <boost/statistics/detail/fusion/serialization/save.hpp>
+//#include <boost/statistics/detail/fusion/serialization/load.hpp>
+//#include <boost/statistics/detail/fusion/serialization/map.hpp>
+//#include <boost/statistics/detail/fusion/serialization/vector.hpp>
+
+#include <libs/statistics/detail/fusion/example/serialize.h>
+
+void example_joint_view_binder(std::ostream& os){
+
+ os << "example_joint_view_binder -> ";
+
+ using namespace boost;
+ namespace stat = boost::statistics::detail;
+
+ typedef mpl::int_<0> key0_;
+ typedef mpl::int_<1> key1_;
+ typedef mpl::int_<2> key2_;
+
+ typedef unsigned d0_;
+ typedef unsigned d1_;
+ typedef unsigned d2_;
+ typedef fusion::pair<key0_,d0_> p0_;
+ typedef fusion::pair<key1_,d1_> p1_;
+ typedef fusion::pair<key2_,d2_> p2_;
+ typedef fusion::map<p0_> map0_;
+ typedef fusion::map<p1_> map1_;
+ typedef fusion::map<p2_> map2_;
+
+ const d0_ d0 = 0;
+ const d1_ d1 = 0;
+ const d2_ d2 = 0;
+ map0_ map0(boost::fusion::make_pair<key0_>(d0));
+ map1_ map1(boost::fusion::make_pair<key1_>(d1));
+ map2_ map2(boost::fusion::make_pair<key2_>(d2));
+ {
+ typedef boost::mpl::empty_base left_;
+ typedef stat::fusion::joint_view::binder<map0_> binder_;
+ binder_ binder(map0);
+ BOOST_AUTO(
+ jv,
+ binder(map1)
+ );
+ BOOST_ASSERT(
+ boost::fusion::at_key<key0_>(jv) == d0
+ );
+ BOOST_ASSERT(
+ boost::fusion::at_key<key1_>(jv) == d1
+ );
+ }
+
+ os << "<-";
+}
\ No newline at end of file
Added: sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/example/joint_view_binder.h
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/libs/statistics/detail/fusion/example/joint_view_binder.h 2010-01-06 06:48:41 EST (Wed, 06 Jan 2010)
@@ -0,0 +1,14 @@
+///////////////////////////////////////////////////////////////////////////////
+// statistics::detail::fusion::example::joint_view_binder.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_JOINT_VIEW_BINDER_HPP_ER_2009
+#define LIBS_STATISTICS_DETAIL_FUSION_EXAMPLE_JOINT_VIEW_BINDER_HPP_ER_2009
+#include <iostream>
+
+void example_joint_view_binder(std::ostream&);
+
+#endif
\ No newline at end of file
Modified: sandbox/statistics/detail/multi_array/libs/statistics/detail/multi_array/example/serialize.cpp
==============================================================================
--- sandbox/statistics/detail/multi_array/libs/statistics/detail/multi_array/example/serialize.cpp (original)
+++ sandbox/statistics/detail/multi_array/libs/statistics/detail/multi_array/example/serialize.cpp 2010-01-06 06:48:41 EST (Wed, 06 Jan 2010)
@@ -142,7 +142,7 @@
ia_ ia(ifs);
array_map_ a;
ia >> a;
- for(unsigned i = 0; i<n0; i++)
+ for(unsigned i = 0; i<n0; i++)
{
for(unsigned j = 0; j<n1; j++)
{
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