annotate DEPENDENCIES/generic/include/boost/accumulators/statistics/error_of.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 ///////////////////////////////////////////////////////////////////////////////
Chris@16 2 // error_of.hpp
Chris@16 3 //
Chris@16 4 // Copyright 2005 Eric Niebler. Distributed under the Boost
Chris@16 5 // Software License, Version 1.0. (See accompanying file
Chris@16 6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7
Chris@16 8 #ifndef BOOST_ACCUMULATORS_STATISTICS_ERROR_OF_HPP_EAN_29_11_2005
Chris@16 9 #define BOOST_ACCUMULATORS_STATISTICS_ERROR_OF_HPP_EAN_29_11_2005
Chris@16 10
Chris@16 11 #include <boost/mpl/placeholders.hpp>
Chris@16 12 #include <boost/accumulators/framework/accumulator_base.hpp>
Chris@16 13 #include <boost/accumulators/framework/extractor.hpp>
Chris@16 14 #include <boost/accumulators/framework/depends_on.hpp>
Chris@16 15 #include <boost/accumulators/statistics_fwd.hpp>
Chris@16 16
Chris@16 17 namespace boost { namespace accumulators
Chris@16 18 {
Chris@16 19
Chris@16 20 namespace impl
Chris@16 21 {
Chris@16 22 /// INTERNAL ONLY
Chris@16 23 ///
Chris@16 24 template<typename Feature>
Chris@16 25 struct this_feature_has_no_error_calculation
Chris@16 26 : mpl::false_
Chris@16 27 {
Chris@16 28 };
Chris@16 29
Chris@16 30 ///////////////////////////////////////////////////////////////////////////////
Chris@16 31 // error_of_impl
Chris@16 32 /// INTERNAL ONLY
Chris@16 33 ///
Chris@16 34 template<typename Sample, typename Feature>
Chris@16 35 struct error_of_impl
Chris@16 36 : accumulator_base
Chris@16 37 {
Chris@16 38 // TODO: specialize this on the specific features that have errors we're
Chris@16 39 // interested in.
Chris@16 40 BOOST_MPL_ASSERT((this_feature_has_no_error_calculation<Feature>));
Chris@16 41
Chris@16 42 // for boost::result_of
Chris@16 43 typedef int result_type;
Chris@16 44
Chris@16 45 error_of_impl(dont_care)
Chris@16 46 {
Chris@16 47 }
Chris@16 48
Chris@16 49 result_type result(dont_care) const
Chris@16 50 {
Chris@16 51 return 0;
Chris@16 52 }
Chris@16 53 };
Chris@16 54
Chris@16 55 } // namespace impl
Chris@16 56
Chris@16 57 ///////////////////////////////////////////////////////////////////////////////
Chris@16 58 // tag::error_of
Chris@16 59 //
Chris@16 60 namespace tag
Chris@16 61 {
Chris@16 62 template<typename Feature>
Chris@16 63 struct error_of
Chris@16 64 : depends_on<Feature>
Chris@16 65 {
Chris@16 66 /// INTERNAL ONLY
Chris@16 67 ///
Chris@16 68 typedef accumulators::impl::error_of_impl<mpl::_1, Feature> impl;
Chris@16 69 };
Chris@16 70 }
Chris@16 71
Chris@16 72 ///////////////////////////////////////////////////////////////////////////////
Chris@16 73 // extract::error_of
Chris@16 74 //
Chris@16 75 namespace extract
Chris@16 76 {
Chris@16 77 BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, error_of, (typename))
Chris@16 78 }
Chris@16 79
Chris@16 80 using extract::error_of;
Chris@16 81
Chris@16 82 // make tag::error_of<tag::feature(modifier)> work
Chris@16 83 template<typename Feature>
Chris@16 84 struct as_feature<tag::error_of<Feature> >
Chris@16 85 {
Chris@16 86 typedef tag::error_of<typename as_feature<Feature>::type> type;
Chris@16 87 };
Chris@16 88
Chris@16 89 // make error_of<tag::mean> work with non-void weights (should become
Chris@16 90 // error_of<tag::weighted_mean>
Chris@16 91 template<typename Feature>
Chris@16 92 struct as_weighted_feature<tag::error_of<Feature> >
Chris@16 93 {
Chris@16 94 typedef tag::error_of<typename as_weighted_feature<Feature>::type> type;
Chris@16 95 };
Chris@16 96
Chris@16 97 }} // namespace boost::accumulators
Chris@16 98
Chris@16 99 #endif