Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:19

0001 ///////////////////////////////////////////////////////////////////////////////
0002 // error_of.hpp
0003 //
0004 //  Copyright 2005 Eric Niebler. Distributed under the Boost
0005 //  Software License, Version 1.0. (See accompanying file
0006 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 
0008 #ifndef BOOST_ACCUMULATORS_STATISTICS_ERROR_OF_HPP_EAN_29_11_2005
0009 #define BOOST_ACCUMULATORS_STATISTICS_ERROR_OF_HPP_EAN_29_11_2005
0010 
0011 #include <boost/mpl/placeholders.hpp>
0012 #include <boost/accumulators/framework/accumulator_base.hpp>
0013 #include <boost/accumulators/framework/extractor.hpp>
0014 #include <boost/accumulators/framework/depends_on.hpp>
0015 #include <boost/accumulators/statistics_fwd.hpp>
0016 
0017 namespace boost { namespace accumulators
0018 {
0019 
0020 namespace impl
0021 {
0022     /// INTERNAL ONLY
0023     ///
0024     template<typename Feature>
0025     struct this_feature_has_no_error_calculation
0026       : mpl::false_
0027     {
0028     };
0029 
0030     ///////////////////////////////////////////////////////////////////////////////
0031     // error_of_impl
0032     /// INTERNAL ONLY
0033     ///
0034     template<typename Sample, typename Feature>
0035     struct error_of_impl
0036       : accumulator_base
0037     {
0038         // TODO: specialize this on the specific features that have errors we're
0039         // interested in.
0040         BOOST_MPL_ASSERT((this_feature_has_no_error_calculation<Feature>));
0041 
0042         // for boost::result_of
0043         typedef int result_type;
0044 
0045         error_of_impl(dont_care)
0046         {
0047         }
0048 
0049         result_type result(dont_care) const
0050         {
0051             return 0;
0052         }
0053     };
0054 
0055 } // namespace impl
0056 
0057 ///////////////////////////////////////////////////////////////////////////////
0058 // tag::error_of
0059 //
0060 namespace tag
0061 {
0062     template<typename Feature>
0063     struct error_of
0064       : depends_on<Feature>
0065     {
0066         /// INTERNAL ONLY
0067         ///
0068         typedef accumulators::impl::error_of_impl<mpl::_1, Feature> impl;
0069     };
0070 }
0071 
0072 ///////////////////////////////////////////////////////////////////////////////
0073 // extract::error_of
0074 //
0075 namespace extract
0076 {
0077     BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, error_of, (typename))
0078 }
0079 
0080 using extract::error_of;
0081 
0082 // make tag::error_of<tag::feature(modifier)> work
0083 template<typename Feature>
0084 struct as_feature<tag::error_of<Feature> >
0085 {
0086     typedef tag::error_of<typename as_feature<Feature>::type> type;
0087 };
0088 
0089 // make error_of<tag::mean> work with non-void weights (should become
0090 // error_of<tag::weighted_mean>
0091 template<typename Feature>
0092 struct as_weighted_feature<tag::error_of<Feature> >
0093 {
0094     typedef tag::error_of<typename as_weighted_feature<Feature>::type> type;
0095 };
0096 
0097 }} // namespace boost::accumulators
0098 
0099 #endif