...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::accumulators::with_cached_result
// In header: <boost/accumulators/framework/accumulators/droppable_accumulator.hpp> template<typename Accumulator> struct with_cached_result { // types typedef Accumulator::result_type result_type; // construct/copy/destruct template<typename Args> with_cached_result(Args const &); with_cached_result(with_cached_result const &); with_cached_result& operator=(with_cached_result const &); ~with_cached_result(); // public member functions template<typename Args> void on_drop(Args const &) ; template<typename Args> result_type result(Args const &) const; // private member functions void set(result_type const &) ; result_type const & get() const; bool has_result() const; };
with_cached_result
public
construct/copy/destructtemplate<typename Args> with_cached_result(Args const & args);
with_cached_result(with_cached_result const & that);
with_cached_result& operator=(with_cached_result const &);
~with_cached_result();