/usr/include/boost/accumulators/framework/accumulators
Edit: /usr/include/boost/accumulators/framework/accumulators/external_accumulator.hpp (3606B)
///////////////////////////////////////////////////////////////////////////////
// external_accumulator.hpp
//
// Copyright 2005 Eric Niebler. 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_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_EXTERNAL_ACCUMULATOR_HPP_EAN_01_12_2005
#define BOOST_ACCUMULATORS_FRAMEWORK_ACCUMULATORS_EXTERNAL_ACCUMULATOR_HPP_EAN_01_12_2005
#include
#include
#include
#include // for feature_tag
#include
#include
namespace boost { namespace accumulators { namespace impl
{
//////////////////////////////////////////////////////////////////////////
// external_impl
/// INTERNAL ONLY
///
template
struct external_impl
: accumulator_base
{
typedef typename Accumulator::result_type result_type;
typedef typename detail::feature_tag::type feature_tag;
external_impl(dont_care) {}
template
result_type result(Args const &args) const
{
return this->extract_(args, args[parameter::keyword::instance | 0]);
}
private:
template
static result_type extract_(Args const &args, int)
{
// No named parameter passed to the extractor. Maybe the external
// feature is held by reference<>.
extractor extract;
return extract(accumulators::reference_tag(args));
}
template
static result_type extract_(Args const &, AccumulatorSet const &acc)
{
// OK, a named parameter for this external feature was passed to the
// extractor, so use that.
extractor extract;
return extract(acc);
}
};
} // namespace impl
namespace tag
{
//////////////////////////////////////////////////////////////////////////
// external
template
struct external
: depends_on >
{
typedef
accumulators::impl::external_impl<
detail::to_accumulator
, Tag
>
impl;
};
template
struct external
: depends_on<>
{
typedef
accumulators::impl::external_impl<
detail::to_accumulator
, Tag
>
impl;
};
}
// for the purposes of feature-based dependency resolution,
// external_accumulator provides the same feature as Feature
template
struct feature_of >
: feature_of
{
};
// Note: Usually, the extractor is pulled into the accumulators namespace with
// a using directive, not the tag. But the external<> feature doesn't have an
// extractor, so we can put the external tag in the accumulators namespace
// without fear of a name conflict.
using tag::external;
}} // namespace boost::accumulators
#endif