Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: // error_of.hpp Chris@16: // Chris@16: // Copyright 2005 Eric Niebler. Distributed under the Boost Chris@16: // Software License, Version 1.0. (See accompanying file Chris@16: // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_ACCUMULATORS_STATISTICS_ERROR_OF_HPP_EAN_29_11_2005 Chris@16: #define BOOST_ACCUMULATORS_STATISTICS_ERROR_OF_HPP_EAN_29_11_2005 Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { namespace accumulators Chris@16: { Chris@16: Chris@16: namespace impl Chris@16: { Chris@16: /// INTERNAL ONLY Chris@16: /// Chris@16: template Chris@16: struct this_feature_has_no_error_calculation Chris@16: : mpl::false_ Chris@16: { Chris@16: }; Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: // error_of_impl Chris@16: /// INTERNAL ONLY Chris@16: /// Chris@16: template Chris@16: struct error_of_impl Chris@16: : accumulator_base Chris@16: { Chris@16: // TODO: specialize this on the specific features that have errors we're Chris@16: // interested in. Chris@16: BOOST_MPL_ASSERT((this_feature_has_no_error_calculation)); Chris@16: Chris@16: // for boost::result_of Chris@16: typedef int result_type; Chris@16: Chris@16: error_of_impl(dont_care) Chris@16: { Chris@16: } Chris@16: Chris@16: result_type result(dont_care) const Chris@16: { Chris@16: return 0; Chris@16: } Chris@16: }; Chris@16: Chris@16: } // namespace impl Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: // tag::error_of Chris@16: // Chris@16: namespace tag Chris@16: { Chris@16: template Chris@16: struct error_of Chris@16: : depends_on Chris@16: { Chris@16: /// INTERNAL ONLY Chris@16: /// Chris@16: typedef accumulators::impl::error_of_impl impl; Chris@16: }; Chris@16: } Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: // extract::error_of Chris@16: // Chris@16: namespace extract Chris@16: { Chris@16: BOOST_ACCUMULATORS_DEFINE_EXTRACTOR(tag, error_of, (typename)) Chris@16: } Chris@16: Chris@16: using extract::error_of; Chris@16: Chris@16: // make tag::error_of work Chris@16: template Chris@16: struct as_feature > Chris@16: { Chris@16: typedef tag::error_of::type> type; Chris@16: }; Chris@16: Chris@16: // make error_of work with non-void weights (should become Chris@16: // error_of Chris@16: template Chris@16: struct as_weighted_feature > Chris@16: { Chris@16: typedef tag::error_of::type> type; Chris@16: }; Chris@16: Chris@16: }} // namespace boost::accumulators Chris@16: Chris@16: #endif