...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::impl::tail_quantile_impl — Tail quantile estimation based on order statistics (for both left and right tails)

// In header: <boost/accumulators/statistics_fwd.hpp> template<typename Sample, typename LeftRight> struct tail_quantile_impl : public accumulator_base { // construct/copy/destruct tail_quantile_impl(dont_care); // public member functions template<typename Args> result_type result(Args const &) const; template<typename Archive> void serialize(Archive &, const unsigned int); };

The estimation of a tail quantile with level based on order statistics requires the caching of at least the smallest or the largest samples, being the total number of samples. The largest of the smallest samples or the smallest of the largest samples provides an estimate for the quantile: