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 crop

boost::histogram::algorithm::crop — Crop command to be used in reduce.


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

reduce_command crop(double lower, double upper);


Command is applied to corresponding axis in order of reduce arguments.

Works like shrink (see shrink documentation for details), but counts in removed bins are discarded, whether underflow and overflow bins are present or not. If the cropped range goes beyond the axis range, then the content of the underflow or overflow bin which overlaps with the range is kept.

If the counts in an existing underflow or overflow bin are discared by the crop, the corresponding memory cells are not physically removed. Only their contents are set to zero. This technical limitation may be lifted in the future, then crop may completely remove the cropped memory cells.



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.