Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

Function shrink

boost::histogram::algorithm::shrink — Shrink command to be used in reduce.


// In header: <boost/histogram/algorithm/reduce.hpp>

reduce_command shrink(unsigned iaxis, double lower, double upper);


Command is applied to axis with given index.

Shrinking is based on an inclusive value interval. The bin which contains the first value starts the range of bins to keep. The bin which contains the second value is the last included in that range. When the second value is exactly equal to a lower bin edge, then the previous bin is the last in the range.

The counts in removed bins are added to the corresponding underflow and overflow bins, if they are present. If they are not present, the counts are discarded. Also see crop, which always discards the counts.



which axis to operate on.


bin which contains lower is first to be kept.


bin which contains upper is last to be kept, except if upper is equal to the lower edge.