Includes all standard headers of the Boost.Histogram library. Extra headers not automatically included are:
boost/histogram/ostream.hppboost/histogram/axis/ostream.hppboost/histogram/accumulators/ostream.hppboost/histogram/serialization.hpp
Includes all accumulator headers of the Boost.Histogram library. Extra header not automatically included:
boost/histogram/accumulators/ostream.hpp
Includes all algorithm headers of the Boost.Histogram library.
Includes all axis headers of the Boost.Histogram library. Extra header not automatically included:
boost/histogram/axis/ostream.hpp
Forward declarations, tag types and type aliases.
Another alias for an empty metadata type. null_typeIntegral type for axis indices. intEmpty metadata type.
void
Archive &unsignedReal type for axis indices. doubleDefault storage, optimized for unweighted histograms. unlimited_storage<>Vector-like storage for fast zero-overhead access to cells. storage_adaptor< std::vector< T, A > >Dense storage which tracks means of samples in each cell. dense_storage< accumulators::mean<> >Dense storage which tracks sums of weights and a variance estimate. dense_storage< accumulators::weighted_sum<> >Dense storage which tracks means of weighted samples in each cell. dense_storage< accumulators::weighted_mean<> >
std::tuple of axis types OR std::vector of an axis type or axis::variantclass that implements the storage interface Central class of the histogram library. Histogram uses the call operator to insert data, like the Boost.Accumulators.Use factory functions (see make_histogram.hpp andmake_profile.hpp) to conveniently create histograms rather than calling the ctors directly.Use the indexed range generator to iterate over filled histograms, which is convenient and faster than hand-written loops for multi-dimensional histograms.
AxesStoragetypename storage_type::value_typetypename storage_type::iteratortypename storage_type::const_iteratorunspecified
constexpr unsignedNumber of axes (dimensions). std::size_tTotal number of bins (including underflow/overflow). voidReset all bins to default initialized values. decltype(auto)
unsigned0std::integral_constant< unsigned, N >{}Get N-th axis using a compile-time number. This version is more efficient than the one accepting a run-time number. decltype(auto)unsignedGet N-th axis with run-time number. Prefer the version that accepts a compile-time number, if you can use it. auto
Unary &&Apply unary functor/function to each axis. iterator
class...const T0 &const Ts &...Fill histogram with values, an optional weight, and/or a sample. Returns iterator to located cell.Arguments are passed in order to the axis objects. Passing an argument type that is not convertible to the value type accepted by the axis or passing the wrong number of arguments causes a throw of std::invalid_argument.Optional weightAn optional weight can be passed as the first or last argument with the weight helper function. Compilation fails if the storage elements do not support weights.SamplesIf the storage elements accept samples, pass them with the sample helper function in addition to the axis arguments, which can be the first or last argument. The sample helper function can pass one or more arguments to the storage element. If samples and weights are used together, they can be passed in any order at the beginning or end of the argument list.Axis with multiple argumentsIf the histogram contains an axis which accepts a std::tuple of arguments, the arguments for that axis need to be passed as astd::tuple, for example,std::make_tuple(1.2, 2.3). If the histogram contains only this axis and no other, the arguments can be passed directly.iterator
class...const std::tuple< Ts... > &Fill histogram with values, an optional weight, and/or a sample from a std::tuple.void
const Iterable &iterable as explained in the long description. Fill histogram with several values at once. The argument must be an iterable with a size that matches the rank of the histogram. The element of an iterable may be 1) a value or 2) an iterable with contiguous storage over values or 3) a variant of 1) and 2). Sub-iterables must have the same length.Values are passed to the corresponding histogram axis in order. If a single value is passed together with an iterable of values, the single value is treated like an iterable with matching length of copies of this value.If the histogram has only one axis, an iterable of values may be passed directly.
void
const Iterable &iterable of values. const weight_type< T > &single weight or an iterable of weights. Fill histogram with several values and weights at once.
void
const weight_type< T > &single weight or an iterable of weights. const Iterable &iterable of values. Fill histogram with several values and weights at once.
void
class...const Iterable &iterable of values. const sample_type< std::tuple< Ts... >> &single sample or an iterable of samples. Fill histogram with several values and samples at once.
void
const sample_type< T > &single sample or an iterable of samples. const Iterable &iterable of values. Fill histogram with several values and samples at once.
void
class...const Iterable &const weight_type< T > &const sample_type< std::tuple< Ts... >> &void
const sample_type< T > &const weight_type< U > &const Iterable &void
const weight_type< T > &const sample_type< U > &const Iterable &void
const Iterable &const sample_type< T > &const weight_type< U > &decltype(auto)
class...axis::index_typeindex of first axis. Is...indices of second, third, ... axes. Access cell value at integral indices. You can pass indices as individual arguments, as a std::tuple of integers, or as an interable range of integers. Passing the wrong number of arguments causes a throw of std::invalid_argument. Passing an index which is out of bounds causes a throw of std::out_of_range.
reference to cell value. decltype(auto)
class...axis::index_typeIs...Access cell value at integral indices (read-only). decltype(auto)const multi_index_type &Access cell value at integral indices stored in iterable. decltype(auto)const multi_index_type &Access cell value at integral indices stored in iterable (read-only). decltype(auto)axis::index_typeAccess value at index (for rank = 1). decltype(auto)axis::index_typeAccess value at index (for rank = 1, read-only). decltype(auto)const multi_index_type &Access value at index tuple. decltype(auto)const multi_index_type &Access value at index tuple (read-only). bool
const histogram< A, S > &Equality operator, tests equality for all axes and the storage. bool
const histogram< A, S > &Negation of the equality operator. histogram &
const histogram< A, S > &Add values of another histogram. This operator is only available if the value_type supports operator+=.Both histograms must be compatible to be addable. The histograms are compatible, if the axes are either all identical. If the axes only differ in the states of their discrete growing axis types, then they are also compatible. The discrete growing axes are merged in this case. histogram &
const histogram< axes_type, S > &histogram &
const histogram< A, S > &Subtract values of another histogram. This operator is only available if the value_type supports operator-=. histogram &
const histogram< A, S > &Multiply by values of another histogram. This operator is only available if the value_type supports operator*=. histogram &
const histogram< A, S > &Divide by values of another histogram. This operator is only available if the value_type supports operator/=. histogram &const doubleMultiply all values with a scalar. This operator is only available if the value_type supports operator*=. histogram &const doubleDivide all values by a scalar. This operator is only available if operator*= is available. iteratorReturn value iterator to the beginning of the histogram. iteratorReturn value iterator to the end in the histogram. const_iteratorReturn value iterator to the beginning of the histogram (read-only). const_iteratorReturn value iterator to the end in the histogram (read-only). const_iteratorReturn value iterator to the beginning of the histogram (read-only). const_iteratorReturn value iterator to the end in the histogram (read-only). void
Archive &unsigned
histogram< A, S > &&
const histogram< A, S > &histogram &
histogram< A, S > &&histogram &
const histogram< A, S > &
A &&StorageAxes
class...As &&...auto
const histogram< A1, S1 > &const histogram< A2, S2 > &Pairwise multiply cells of two histograms and return histogram with the product. For notes on the returned histogram type, see operator+. auto
const histogram< A, S > &doubleMultiply all cells of the histogram by a number and return a new histogram. If the original histogram has integer cells, the result has double cells. auto
doubleconst histogram< A, S > &Multiply all cells of the histogram by a number and return a new histogram. If the original histogram has integer cells, the result has double cells. auto
const histogram< A1, S1 > &const histogram< A2, S2 > &Pairwise add cells of two histograms and return histogram with the sum. The returned histogram type is the most efficient and safest one constructible from the inputs, if they are not the same type. If one histogram has a tuple axis, the result has a tuple axis. The chosen storage is the one with the larger dynamic range. auto
const histogram< A1, S1 > &const histogram< A2, S2 > &Pairwise subtract cells of two histograms and return histogram with the difference. For notes on the returned histogram type, see operator+. auto
const histogram< A1, S1 > &const histogram< A2, S2 > &Pairwise divide cells of two histograms and return histogram with the quotient. For notes on the returned histogram type, see operator+. auto
const histogram< A, S > &doubleDivide all cells of the histogram by a number and return a new histogram. If the original histogram has integer cells, the result has double cells.
iterate over inner bins, exclude underflow and overflow iterate over all bins, including underflow and overflow Coverage mode of the indexed range generator. Defines options for the iteration strategy. auto
Histogram &&Reference to the histogram. coveragecoverage::innerIterate over all or only inner bins (optional, default: inner). Generates an indexed range of forward iterators over the histogram cells.Use this in a range-based for loop:for (auto&& x : indexed(hist)) { ... }
This generates an optimized loop which is nearly always faster than a hand-written loop over the histogram cells. The iterators dereference to an indexed_range::accessor, which has methods to query the current indices and bins and acts like a pointer to the cell value. The returned iterators are forward iterators. They can be stored in a container, but may not be used after the life-time of the histogram ends.
indexed_range
Input iterator range over histogram bins with multi-dimensional index. The iterator returned by begin() can only be incremented. begin() may only be called once, calling it a second time returns the end() iterator. If several copies of the input iterators exist, the other copies become invalid if one of them is incremented. Lightweight view to access value and index of current cell. The methods provide access to the current cell indices and bins. It acts like a pointer to the cell value, and in a limited way also like a reference. To interoperate with the algorithms of the standard library, the accessor is implicitly convertible to a cell value. Assignments and comparisons are passed through to the cell. An accessor is coupled to its parent indexed_range::iterator. Moving the parent iterator forward also updates the linked accessor. Accessors are not copyable. They cannot be stored in containers, butindexed_range::iterator can be stored.Array-like view into the current multi-dimensional index. unspecifiedconst axis::index_type &
const_iteratorconst_iteratorstd::size_tconst_referenceunsignedconst_referenceunsigned
value_referenceReturns the cell reference. value_referenceReturns the cell reference. value_iteratorAccess fields and methods of the cell object. axis::index_typeunsigned0axis dimension. Access current index.
index_viewAccess indices as an iterable range. decltype(auto)
unsigned0axis dimension. std::integral_constant< unsigned, N >{}Access current bin.
decltype(auto)unsignedaxis dimension. Access current bin.
doubleComputes density in current cell. The density is computed as the cell value divided by the product of bin widths. Axes without bin widths, like axis::category, are treated as having unit bin with.boolconst accessor &boolconst accessor &boolconst accessor &boolconst accessor &boolconst accessor &boolconst accessor &bool
const U &bool
const U &bool
const U &bool
const U &bool
const U &bool
const U &value_typeaccessor &const accessor &accessor &
const T &iterator &const accessor &unspecifiedstd::conditional_t< std::is_const< histogram_type >::value, typename histogram_type::const_iterator, typename histogram_type::iterator >typename std::iterator_traits< value_iterator >::referencetypename std::iterator_traits< value_iterator >::value_type
iteratoriteratorhistogram_type &coverage
auto
char...Suffix operator to generate literal compile-time numbers, 0_c, 12_c, etc.
Collection of factory functions to conveniently create histograms.
auto
class...Axis &&First axis instance. Axes &&...Other axis instances. Make histogram from compile-time axis configuration and default storage.
auto
Iterable &&Iterable range of axis objects. Make histogram from iterable range and default storage.
auto
IteratorIterator to range of axis objects. IteratorIterator to range of axis objects. Make histogram from iterator interval and default storage.
auto
class...Storage &&Storage or container with standard interface (any vector, array, or map). Axis &&First axis instance. Axes &&...Other axis instances. Make histogram from compile-time axis configuration and custom storage.
auto
Storage &&Storage or container with standard interface (any vector, array, or map). Iterable &&Iterable range of axis objects. Make histogram from iterable range and custom storage.
auto
Storage &&Storage or container with standard interface (any vector, array, or map). IteratorIterator to range of axis objects. IteratorIterator to range of axis objects. Make histogram from iterator interval and custom storage.
auto
class...Axis &&First axis instance. Axes &&...Other axis instances. Make histogram from compile-time axis configuration and weight-counting storage.
auto
Iterable &&Iterable range of axis objects. Make histogram from iterable range and weight-counting storage.
auto
IteratorIterator to range of axis objects. IteratorIterator to range of axis objects. Make histogram from iterator interval and weight-counting storage.
Collection of factory functions to conveniently create profiles. Profiles are histograms which accept an additional sample and compute the mean of the sample in each cell.
auto
class...Axis &&First axis instance. Axes &&...Other axis instances. Make profle from compile-time axis configuration.
auto
Iterable &&Iterable range of axis objects. Make profile from iterable range.
auto
IteratorIterator to range of axis objects. IteratorIterator to range of axis objects. Make profile from iterator interval.
auto
class...Axis &&First axis instance. Axes &&...Other axis instances. Make profle from compile-time axis configuration which accepts weights.
auto
Iterable &&Iterable range of axis objects. Make profile from iterable range which accepts weights.
auto
IteratorIterator to range of axis objects. IteratorIterator to range of axis objects. Make profile from iterator interval which accepts weights.
std::size_tHolder for multiple axis indices. Adapts external iterable, tuple, or explicit list of indices to the same representation. axis::index_typevalue_type *const value_type *
multi_indexstd::size_tconstexpr std::size_t
iteratoriteratorconst_iteratorconst_iterator
class...axis::index_typeIs...
class...const std::tuple< axis::index_type, Is... > &
const Iterable &priv_tag
std::size_t...const T &mp11::index_sequence< Is... >
static_cast< std::size_t >(-1)axis::index_typevalue_type *const value_type *
multi_indexstd::size_t
iteratoriteratorconst_iteratorconst_iteratorstd::size_t
class...axis::index_typeIs...
class...const std::tuple< axis::index_type, Is... > &
const Iterable &priv_tagstd::size_t
std::size_t...const T &mp11::index_sequence< Ns... >
A simple streaming operator for the histogram type. The text representation is rudimentary and not guaranteed to be stable between versions of Boost.Histogram. This header is not included by any other header and must be explicitly included to use the streaming operator.To use your own, simply include your own implementation instead of this header.
auto
class...Ts &&...arguments to be forwarded to the accumulator. Helper function to mark arguments as sample.
Sample holder and type envelope. You should not construct these directly, use the sample() helper function.
T
Headers from Boost.Serialization needed to serialize STL types that are used internally by the Boost.Histogram classes.
Turns any vector-like, array-like, and map-like container into a storage type.
bool
const U &void
Archive &unsignedstorage_adaptor &&const storage_adaptor &storage_adaptor &storage_adaptor &&storage_adaptor &const storage_adaptor &
class...Ts &&...storage_adaptor &
U &&
Memory-efficient storage for integral counters which cannot overflow. This storage provides a no-overflow-guarantee if the counters are incremented with integer weights. It maintains a contiguous array of elemental counters, one for each cell. If an operation is requested which would overflow a counter, the array is replaced with another of a wider integral type, then the operation is executed. The storage uses integers of 8, 16, 32, 64 bits, and then switches to a multiprecision integral type, similar to those in Boost.Multiprecision.A scaling operation or adding a floating point number triggers a conversion of the elemental counters into doubles, which voids the no-overflow-guarantee. unspecifiedunspecifiedAllocatordoubleunspecifiedunspecifiedunspecifiedconstexpr bool
allocator_typevoidstd::size_tstd::size_treferencestd::size_tconst_referencestd::size_tboolconst unlimited_storage &bool
const Iterable &unlimited_storage &const doubleiteratoriteratorconst_iteratorconst_iteratorvoid
Archive &unsignedconst allocator_type &{}const unlimited_storage &unlimited_storage &const unlimited_storage &unlimited_storage &&unlimited_storage &unlimited_storage &&
const Iterable &unlimited_storage &
const Iterable &
Unsafe read/write access to private data that potentially breaks consistency. This struct enables access to private data of some classes. It is intended for library developers who need this to implement algorithms efficiently, for example, serialization. Users should not use this. If you are a user who absolutely needs this to get a specific effect, please submit an issue on Github. Perhaps the public interface is insufficient and should be extended for your use case.Unlike the normal interface, the unsafe_access interface may change between versions. If your code relies onunsafe_access, it may or may not break when you update Boost. This is another reason to not use it unless you are ok with these conditions.
auto &
Histogram &histogram. Get axes.
const auto &
const Histogram &histogram. Get axes.
decltype(auto)
unsigned0axis index (optional, default: 0). Histogram &histogram. std::integral_constant< unsigned, I >{}Get mutable axis reference with compile-time number.
decltype(auto)
Histogram &histogram. unsignedaxis index. Get mutable axis reference with run-time number.
auto &
Histogram &histogram. Get storage.
const auto &
const Histogram &histogram. Get storage.
auto &
Histogram &histogram Get index offset.
const auto &
const Histogram &histogram Get index offset.
constexpr auto &
unlimited_storage< Allocator > &instance of unlimited_storage.Get buffer of unlimited_storage.
constexpr auto &
storage_adaptor< T > &instance of storage_adaptor.Get implementation of storage_adaptor.
auto
T &&argument to be forward to the histogram. Helper function to mark argument as weight.
Weight holder and type envelope. You should not construct these directly, use the weight() helper function.
TAccess underlying value.
weight_type< U >
Allow implicit conversions of types when the underlying value type allows them.
Uses a C++ builtin arithmetic type to accumulate a count. This wrapper class may be used as a base class by users who want to add custom metadata to each bin of a histogram. Otherwise, arithmetic types should be used directly as accumulators in storages for simplicity. In other words, prefer dense_storage<double> overdense_storage<count<double>>, both are functionally equivalent.When weighted data is accumulated and high precision is required, use accumulators::sum instead. If a local variance estimate for the weight distribution should be computed as well (generally needed for a detailed statistical analysis), useaccumulators::weighted_sum.ValueTypeconst value_type &
count &Increment count by one. count &const_referenceIncrement count by value. count &const count &Add another count. count &const_referenceScale by value. boolconst count &boolconst count &const_referenceReturn count. value_typevoid
Archive &unsignedcount &const count &countconst count &count &const count &countconst count &boolconst count &boolconst count &boolconst count &boolconst count &const_referenceInitialize count to value and allow implicit conversion.
const count< T > &Allow implicit conversion from other count.
Calculates mean and variance of sample. Uses Welfords's incremental algorithm to improve the numerical stability of mean and variance computation. ValueTypeconst value_type &
voidconst_referenceInsert sample x. voidconst weight_type< value_type > &const_referenceInsert sample x with weight w. mean &const mean &Add another mean accumulator. mean &const_referenceScale by value. This acts as if all samples were scaled by the value. boolconst mean &boolconst mean &const_referenceReturn how many samples were accumulated. const_referenceReturn mean value of accumulated samples. The result is undefined, if count() < 1.value_typeReturn variance of accumulated samples. The result is undefined, if count() < 2.void
Archive &unsigned
const mean< T > &Allow implicit conversion from mean<T>. const_referenceconst_referenceconst_referenceInitialize to external count, mean, and variance.
Simple streaming operators for the builtin accumulator types. The text representation is not guaranteed to be stable between versions of Boost.Histogram. This header is only included by boost/histogram/ostream.hpp. To use your own, include your own implementation instead of this header and do not includeboost/histogram/ostream.hpp.
Uses Neumaier algorithm to compute accurate sums of floats. The algorithm is an improved Kahan algorithm (https://en.wikipedia.org/wiki/Kahan_summation_algorithm). The algorithm uses memory for two numbers and is three to five times slower compared to using a single number to accumulate a sum, but the relative error of the sum is at the level of the machine precision, independent of the number of samples.A. Neumaier, Zeitschrift fuer Angewandte Mathematik und Mechanik 54 (1974) 39-51. ValueTypeconst value_type &
sum &Increment sum by one. sum &const_referenceIncrement sum by value. sum &const sum &Add another sum. sum &const_referenceScale by value. boolconst sum &boolconst sum &value_typeReturn value of the sum. const_referenceReturn large part of the sum. const_referenceReturn small part of the sum. value_typevoid
Archive &unsignedsum &const sum &sumconst sum &sum &const sum &sumconst sum &boolconst sum &boolconst sum &boolconst sum &boolconst sum &const_referenceInitialize sum to value and allow implicit conversion.
const sum< T > &Allow implicit conversion from sum<T> const_referenceconst_referenceInitialize sum explicitly with large and small parts.
type to adapt, must be supported by std::atomic. std::atomic< T >Thread-safe adaptor for builtin integral and floating point numbers. This adaptor uses std::atomic to make concurrent increments and additions safe for the stored value.On common computing platforms, the adapted integer has the same size and alignment as underlying type. The atomicity is implemented with a special CPU instruction. On exotic platforms the size of the adapted number may be larger and/or the type may have different alignment, which means it cannot be tightly packed into arrays.
Tstd::atomic< T >
thread_safe &const thread_safe &thread_safe &value_typethread_safe &void
Archive &unsignedconst thread_safe &thread_safe &const thread_safe &value_typethread_safe &value_type
Calculates mean and variance of weighted sample. Uses West's incremental algorithm to improve numerical stability of mean and variance computation. ValueTypeconst value_type &
voidconst_referenceInsert sample x. voidconst weight_type< value_type > &const_referenceInsert sample x with weight w. weighted_mean &const weighted_mean &Add another weighted_mean.weighted_mean &const_referenceScale by value. This acts as if all samples were scaled by the value. boolconst weighted_mean &boolconst weighted_mean &const_referenceReturn sum of weights. const_referenceReturn sum of weights squared (variance of weight distribution). const_referenceReturn mean value of accumulated weighted samples. The result is undefined, if sum_of_weights() == 0.value_typeReturn variance of accumulated weighted samples. The result is undefined, if sum_of_weights() == 0 orsum_of_weights() == sum_of_weights_squared().void
Archive &unsigned
const weighted_mean< T > &Allow implicit conversion from other weighted_means. const_referenceconst_referenceconst_referenceconst_referenceInitialize to external sum of weights, sum of weights squared, mean, and variance.
Holds sum of weights and its variance estimate. ValueTypeconst value_type &
weighted_sum &Increment by one. weighted_sum &const weight_type< value_type > &Increment by weight. weighted_sum &const weighted_sum &Added another weighted sum. weighted_sum &const_referenceScale by value. boolconst weighted_sum &boolconst weighted_sum &const_referenceReturn value of the sum. const_referenceReturn estimated variance of the sum. const_referencevoid
Archive &unsignedconst_referenceInitialize sum to value and allow implicit conversion.
const weighted_sum< T > &Allow implicit conversion from sum<T> const_referenceconst_referenceInitialize sum to value and variance.
auto
const histogram< A, S > &coverageCheck to see if all histogram cells are empty. Use coverage to include or exclude the underflow/overflow bins.This algorithm has O(N) complexity, where N is the number of cells.Returns true if all cells are empty, and false otherwise.
auto
unsignedtypename...const histogram< A, S > &std::integral_constant< unsigned, N >Ns...Returns a lower-dimensional histogram, summing over removed axes. Arguments are the source histogram and compile-time numbers, the remaining indices of the axes. Returns a new histogram which only contains the subset of axes. The source histogram is summed over the removed axes. auto
const histogram< A, S > &const Iterable &Returns a lower-dimensional histogram, summing over removed axes. This version accepts a source histogram and an iterable range containing the remaining indices.
reduce_commandunsignedwhich axis to operate on. doublebin which contains lower is first to be kept. doublebin which contains upper is last to be kept, except if upper is equal to the lower edge. Crop command to be used in reduce.Command is applied to axis with given index.Works like shrink (see shrink documentation for details), but counts in removed bins are always discarded, whether underflow and overflow bins are present or not.
reduce_commanddoublebin which contains lower is first to be kept. doublebin which contains upper is last to be kept, except if upper is equal to the lower edge. Crop command to be used in reduce.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.
reduce_commandunsignedwhich axis to operate on. doublelowest bound that should be kept. doublehighest bound that should be kept. If upper is inside bin interval, the whole interval is removed. unsignedhow many adjacent bins to merge into one. Crop and rebin command to be used in reduce.Command is applied to axis with given index.To crop andrebin in one command (see the respective commands for more details). Equivalent to passing both commands for the same axis toreduce.
reduce_commanddoublelowest bound that should be kept. doublehighest bound that should be kept. If upper is inside bin interval, the whole interval is removed. unsignedhow many adjacent bins to merge into one. Crop and rebin command to be used in reduce.Command is applied to corresponding axis in order of reduce arguments.To crop andrebin in one command (see the respective commands for more details). Equivalent to passing both commands for the same axis toreduce.
reduce_commandunsignedwhich axis to operate on. unsignedhow many adjacent bins to merge into one. Rebin command to be used in reduce.Command is applied to axis with given index.The command merges N adjacent bins into one. This makes the axis coarser and the bins wider. The original number of bins is divided by N. If there is a rest to this devision, the axis is implicitly shrunk at the upper end by that rest.
reduce_commandunsignedhow many adjacent bins to merge into one. Rebin command to be used in reduce.Command is applied to corresponding axis in order of reduce arguments.The command merges N adjacent bins into one. This makes the axis coarser and the bins wider. The original number of bins is divided by N. If there is a rest to this devision, the axis is implicitly shrunk at the upper end by that rest.
Histogram
const Histogram &original histogram. const Iterable &iterable sequence of reduce commands: shrink,slice,rebin,shrink_and_rebin, orslice_and_rebin. The element type of the iterable should bereduce_command.Shrink, crop, slice, and/or rebin axes of a histogram. Returns a new reduced histogram and leaves the original histogram untouched.The commands rebin andshrink orslice for the same axis are automatically combined, this is not an error. Passing ashrink and aslice command for the same axis or tworebin commands triggers aninvalid_argument exception. Trying to reducing a non-reducible axis triggers aninvalid_argument exception. Histograms with non-reducible axes can still be reduced along the other axes that are reducible.An overload allows one to pass reduce_command as positional arguments.
Histogram
class...const Histogram &original histogram. const reduce_command &first reduce command; one of shrink,slice,rebin,shrink_and_rebin, orslice_or_rebin.const Ts &...more reduce commands. Shrink, slice, and/or rebin axes of a histogram. Returns a new reduced histogram and leaves the original histogram untouched.The commands rebin andshrink orslice for the same axis are automatically combined, this is not an error. Passing ashrink and aslice command for the same axis or tworebin commands triggers an invalid_argument exception. It is safe to reduce histograms with some axis that are not reducible along the other axes. Trying to reducing a non-reducible axis triggers an invalid_argument exception.An overload allows one to pass an iterable of reduce_command.
Holder for a reduce command. Use this type to store reduce commands in a container. The internals of this type are an implementation detail. unspecifiedreduce_commandunsignedwhich axis to operate on. doublebin which contains lower is first to be kept. doublebin which contains upper is last to be kept, except if upper is equal to the lower edge. Shrink command to be used in reduce.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.
reduce_commanddoublebin which contains lower is first to be kept. doublebin which contains upper is last to be kept, except if upper is equal to the lower edge. Shrink command to be used in reduce.Command is applied to corresponding axis in order of reduce arguments.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.
reduce_commandunsignedwhich axis to operate on. doublelowest bound that should be kept. doublehighest bound that should be kept. If upper is inside bin interval, the whole interval is removed. unsignedhow many adjacent bins to merge into one. Shrink and rebin command to be used in reduce.Command is applied to corresponding axis in order of reduce arguments.To shrink(unsigned, double, double) and rebin(unsigned, unsigned) in one command (see the respective commands for more details). Equivalent to passing both commands for the same axis to reduce.
reduce_commanddoublelowest bound that should be kept. doublehighest bound that should be kept. If upper is inside bin interval, the whole interval is removed. unsignedhow many adjacent bins to merge into one. Shrink and rebin command to be used in reduce.Command is applied to corresponding axis in order of reduce arguments.To shrink andrebin in one command (see the respective commands for more details). Equivalent to passing both commands for the same axis toreduce.
reduce_commandunsignedwhich axis to operate on. axis::index_typefirst index that should be kept. axis::index_typeone past the last index that should be kept. slice_modeslice_mode::shrinkwhether to behave like shrink orcrop regarding removed bins.Slice command to be used in reduce.Command is applied to axis with given index.Slicing works like shrink orcrop, but uses bin indices instead of values.
reduce_commandaxis::index_typefirst index that should be kept. axis::index_typeone past the last index that should be kept. slice_modeslice_mode::shrinkwhether to behave like shrink orcrop regarding removed bins.Slice command to be used in reduce.Command is applied to corresponding axis in order of reduce arguments.Slicing works like shrink orcrop, but uses bin indices instead of values.
reduce_commandunsignedwhich axis to operate on. axis::index_typefirst index that should be kept. axis::index_typeone past the last index that should be kept. unsignedhow many adjacent bins to merge into one. slice_modeslice_mode::shrinkslice mode, see slice_mode. Slice and rebin command to be used in reduce.Command is applied to axis with given index.To slice andrebin in one command (see the respective commands for more details). Equivalent to passing both commands for the same axis toreduce.
reduce_commandaxis::index_typefirst index that should be kept. axis::index_typeone past the last index that should be kept. unsignedhow many adjacent bins to merge into one. slice_modeslice_mode::shrinkslice mode, see slice_mode. Slice and rebin command to be used in reduce.Command is applied to corresponding axis in order of reduce arguments.To slice andrebin in one command (see the respective commands for more details). Equivalent to passing both commands for the same axis toreduce.
Whether to behave like shrink orcrop regarding removed bins.
auto
const histogram< A, S > &Const reference to the histogram. const coveragecoverage::allIterate over all or only inner bins (optional, default: all). Compute the sum over all histogram cells (underflow/overflow included by default). The implementation favors accuracy and protection against overflow over speed. If the value type of the histogram is an integral or floating point type, accumulators::sum<double> is used to compute the sum, else the original value type is used. Compilation fails, if the value type does not support operator+=. The return type is double if the value type of the histogram is integral or floating point, and the original value type otherwise.If you need a different trade-off, you can write your own loop or use std::accumulate:// iterate over all bins
auto sum_all = std::accumulate(hist.begin(), hist.end(), 0.0);
// skip underflow/overflow bins
double sum = 0;
for (auto&& x : indexed(hist))
sum += *x; // dereference accessor
// or:
// auto ind = boost::histogram::indexed(hist);
// auto sum = std::accumulate(ind.begin(), ind.end(), 0.0);
accumulator type or double
type to store meta data. boost::histogram::axis::iterator_mixin< boolean< MetaData > >metadata_base_t< MetaData >Discrete axis for boolean data. Binning is a pass-though operation with zero cost, making this the fastest possible axis. The axis has no internal state apart from the optional metadata state. The axis has no under- and overflow bins. It cannot grow and cannot be reduced.
index_typevalue_typeReturn index for value argument. value_typeindex_typeReturn value for index argument. value_typeindex_typeReturn bin for index argument. index_typeReturns the number of bins, without over- or underflow. bool
const boolean< M > &bool
const boolean< M > &void
Archive &unsignedmetadata_type{}description of the axis. Construct a boolean axis.
constexpr boolWhether the axis is inclusive (see axis::traits::is_inclusive).constexpr unsignedReturns the options.
input value type, must be equal-comparable. type to store meta data. see boost::histogram::axis::option. allocator to use for dynamic memory management.boost::histogram::axis::iterator_mixin< category< Value, MetaData, Options, Allocator > >metadata_base_t< MetaData >Maps at a set of unique values to bin indices. The axis maps a set of values to bins, following the order of arguments in the constructor. The optional overflow bin for this axis counts input values that are not part of the set. Binning has O(N) complexity, but with a very small factor. For small N (the typical use case) it beats other kinds of lookup.
The options underflow andcircular are not allowed. The optionsgrowth andoverflow are mutually exclusive.
index_typeconst value_type &Return index for value argument. std::pair< index_type, index_type >const value_type &Returns index and shift (if axis has grown) for the passed argument. autoindex_typeReturn value for index argument. Throws std::out_of_range if the index is out of bounds.decltype(auto)index_typeReturn value for index argument; alias for value(...). index_typeReturns the number of bins, without over- or underflow. bool
const category< V, M, O, A > &bool
const category< V, M, O, A > &allocator_typevoid
Archive &unsignedallocator_type
Itbegin of category range of unique values. Itend of category range of unique values. metadata_type{}description of the axis. allocator_type{}allocator instance to use. Construct from iterator range of unique values.
const C &sequence of unique values. metadata_type{}description of the axis. allocator_type{}allocator instance to use. Construct axis from iterable sequence of unique values.
std::initializer_list< U >std::initializer_list of unique values.metadata_type{}description of the axis. allocator_type{}allocator instance to use. Construct axis from an initializer list of unique values.
const category &index_typeindex_typeunsignedConstructor used by algorithm::reduce to shrink and rebin (not for users).
constexpr unsignedReturns the options. constexpr boolWhether the axis is inclusive (see axis::traits::is_inclusive).constexpr boolIndicate that the axis is not ordered.
input value type. Must be integer or floating point. type to store meta data. see boost::histogram::axis::option (all values allowed). boost::histogram::axis::iterator_mixin< integer< Value, MetaData, Options > >metadata_base_t< MetaData >Axis for an interval of integer values with unit steps. Binning is a O(1) operation. This axis bins faster than a regular axis.
index_typevalue_typeReturn index for value argument. autovalue_typeReturns index and shift (if axis has grown) for the passed argument. value_typelocal_index_typeReturn value for index argument. decltype(auto)index_typeReturn bin for index argument. index_typeReturns the number of bins, without over- or underflow. bool
const integer< V, M, O > &bool
const integer< V, M, O > &void
Archive &unsignedvalue_typefirst integer of covered range. value_typeone past last integer of covered range. metadata_type{}description of the axis. Construct over semi-open integer interval [start, stop).
const integer &index_typeindex_typeunsignedConstructor used by algorithm::reduce to shrink and rebin.
constexpr unsignedReturns the options. constexpr boolWhether the axis is inclusive (see axis::traits::is_inclusive).
Lightweight bin view. Represents the current bin interval.
decltype(auto)Return lower edge of bin. decltype(auto)Return upper edge of bin. decltype(auto)Return center of bin. decltype(auto)Return width of bin. bool
const BinType &bool
const BinType &const Axis &index_typeAxis &&index_type
Uses CRTP to inject iterator logic into Derived. iterator< Derived >std::reverse_iterator< const_iterator >
const_iteratorBin iterator to beginning of the axis (read-only). const_iteratorBin iterator to the end of the axis (read-only). const_reverse_iteratorReverse bin iterator to the last entry of the axis (read-only). const_reverse_iteratorReverse bin iterator to the end (read-only).
Wrapped meta data type. Meta data holder with space optimization for empty meta data types. Allows write-access to metadata even if const.
const metadata_base &metadata_base &const metadata_base &metadata_base &&metadata_type &&metadata_base &metadata_base &&
metadata_type &Returns reference to metadata. metadata_type &Returns reference to mutable metadata from const axis.
Options for builtin axis types. Options circular andgrowth are mutually exclusive. Optionscircular andunderflow are mutually exclusive.
unsignedposition of the bit in the set. boost::histogram::axis::option::bitset<(1<< Pos)>Single option flag.
unsignedstd::integral_constant< unsigned, Bits >Holder of axis options.
constexpr auto
unsignedbitset< B >Returns true if all option flags in the argument are set and false otherwise. constexpr circular_tInstance of circular_t.Axis is circular. Mutually exclusive with growth andunderflow.bit< 2 >constexpr growth_tInstance of growth_t.Axis can grow. Mutually exclusive with circular.bit< 3 >constexpr none_tInstance of none_t.All options off. bitset< 0 >constexpr auto
unsignedunsignedbitset< B1 >bitset< B2 >Set intersection of the option arguments. constexpr auto
unsignedunsignedbitset< B1 >bitset< B2 >Set difference of the option arguments. constexpr auto
unsignedunsignedbitset< B1 >bitset< B2 >Set union of the axis option arguments. constexpr overflow_tInstance of overflow_t.Axis has overflow bin. bit< 1 >constexpr underflow_tInstance of underflow_t.Axis has an underflow bin. Mutually exclusive with circular.bit< 0 >
Simple streaming operators for the builtin axis types. The text representation is not guaranteed to be stable between versions of Boost.Histogram. This header is only included by boost/histogram/ostream.hpp. To use your own, include your own implementation instead of this header and do not includeboost/histogram/ostream.hpp.
Holds the bin data of an axis::variant.The interface is a superset of the axis::interval_view class. In addition, the object is implicitly convertible to the value type, returning the equivalent of a call to lower(). For discrete axes, lower() == upper(), and width() returns zero.This is not a view like axis::interval_view for two reasons.
Sequential calls to lower() and upper() would have to each loop through the variant types. This is likely to be slower than filling all the data in one loop.polymorphic_bin may be created from a temporary instance ofaxis::variant, like in the call histogram::axis(0). Storing a reference to the axis would result in a dangling reference. Rather than specialing the code to handle this, it seems easier to just use a value instead of a view.
const value_type &Implicitly convert to bin value (for axis with discrete values). value_typeReturn lower edge of bin. value_typeReturn upper edge of bin. value_typeReturn center of bin. value_typeReturn width of bin. bool
const BinType &bool
const BinType &boolReturn true if bin is discrete. value_typevalue_type
doubleuse_defaultuse_defaultRegular axis with circular option already set.
input value type, must be floating point. builtin or user-defined transform type. type to store meta data. see boost::histogram::axis::option (all values allowed). boost::histogram::axis::iterator_mixin< regular< Value, Transform, MetaData, Options > >metadata_base_t< MetaData >Axis for equidistant intervals on the real line. The most common binning strategy. Very fast. Binning is a O(1) operation.
const transform_type &Return instance of the transform type. index_typevalue_typeReturn index for value argument. std::pair< index_type, index_type >value_typeReturns index and shift (if axis has grown) for the passed argument. value_typereal_index_typeReturn value for fractional index argument. decltype(auto)index_typeReturn bin for index argument. index_typeReturns the number of bins, without over- or underflow. bool
const regular< V, T, M, O > &bool
const regular< V, T, M, O > &void
Archive &unsignedtransform_typetransform instance to use. unsignednumber of bins. value_typelow edge of first bin. value_typehigh edge of last bin. metadata_type{}description of the axis (optional). Construct n bins over real transformed range [start, stop).
unsignednumber of bins. value_typelow edge of first bin. value_typehigh edge of last bin. metadata_type{}description of the axis (optional). Construct n bins over real range [start, stop).
transform_typetransform instance to use. step_type< T >width of a single bin. value_typelow edge of first bin. value_typeupper limit of high edge of last bin (see below). metadata_type{}description of the axis (optional).Construct bins with the given step size over real transformed range [start, stop).
The axis computes the number of bins as n = abs(stop - start) / step, rounded down. This means that stop is an upper limit to the actual value (start + n * step).
step_type< T >width of a single bin. value_typelow edge of first bin. value_typeupper limit of high edge of last bin (see below). metadata_type{}description of the axis (optional).Construct bins with the given step size over real range [start, stop).
The axis computes the number of bins as n = abs(stop - start) / step, rounded down. This means that stop is an upper limit to the actual value (start + n * step). const regular &index_typeindex_typeunsignedConstructor used by algorithm::reduce to shrink and rebin (not for users).
constexpr unsignedReturns the options. step_type< T >
THelper function to mark argument as step size.
Identity transform for equidistant bins.
T
T &&Pass-through. T
T &&Pass-through.
void
Archive &unsignedLog transform for equidistant bins in log-space.
T
TReturns log(x) of external value x. T
TReturns exp(x) for internal value x.
void
Archive &unsignedPow transform for equidistant bins in pow-space. doublepower index
auto
TReturns pow(x, power) of external value x. auto
TReturns pow(x, 1/power) of external value x. boolconst pow &void
Archive &unsigneddoubleMake transform with index p. Sqrt transform for equidistant bins in sqrt-space.
T
TReturns sqrt(x) of external value x. T
TReturns x^2 of internal value x.
void
Archive &unsigned
constexpr bool
const Axis &any axis instance Returns true if axis is continuous or false. See is_continuous for details.
index_type
const Axis &any axis instance Returns axis size plus any extra bins for under- and overflow.
axis type Get axis options for axis type. Doxygen does not render this well. This is a meta-function (template alias), it accepts an axis type and returns the boost::histogram::axis::option::bitset.If Axis::options() is valid and constexpr, get_options is the corresponding option type. Otherwise, it is boost::histogram::axis::option::growth_t, if the axis has a methodupdate, else boost::histogram::axis::option::none_t.
constexpr bool
const Axis &any axis instance Returns true if axis is inclusive or false. See is_inclusive for details.
axis::index_type
const Axis &any axis instance const U &argument to be passed to index methodReturns axis index for value. Throws std::invalid_argument if the value argument is not implicitly convertible.
Whether axis is continuous or discrete. Doxygen does not render this well. This is a meta-function (template alias), it accepts an axis type and returns a compile-time boolean.If the boolean is true, the axis is continuous (covers a continuous range of values). Otherwise it is discrete (covers discrete values).
axis type Meta-function to detect whether an axis is inclusive. Doxygen does not render this well. This is a meta-function (template alias), it accepts an axis type and represents compile-time boolean which is true or false, depending on whether the axis is inclusive or not.An axis with underflow and overflow bins is always inclusive, but an axis may be inclusive under other conditions. The meta-function checks for the method constexpr static bool inclusive(), and uses the result. If this method is not present, it uses get_options<Axis> and checks whether the underflow and overflow bits are present.An inclusive axis has a bin for every possible input value. A histogram which consists only of inclusive axes can be filled more efficiently, since input values always end up in a valid cell and there is no need to keep track of input tuples that need to be discarded.
axis type Meta-function to detect whether an axis is ordered. Doxygen does not render this well. This is a meta-function (template alias), it accepts an axis type and returns a compile-time boolean. If the boolean is true, the axis is ordered.The meta-function checks for the method constexpr static bool ordered(), and uses the result. If this method is not present, it returns true if the value type of the Axis is arithmetic and false otherwise.An ordered axis has a value type that is ordered, which means that indices i < j < k implies either value(i) < value(j) < value(k) or value(i) > value(j) > value(k) for all i,j,k. For example, the integer axis is ordered, but the category axis is not. Axis which are not ordered must not have underflow bins, because they only have an "other" category, which is identified with the overflow bin if it is available.
axis type. Meta-function to detect whether an axis is reducible. Doxygen does not render this well. This is a meta-function (template alias), it accepts an axis type and represents compile-time boolean which is true or false, depending on whether the axis can be reduced with boost::histogram::algorithm::reduce().An axis can be made reducible by adding a special constructor, see Axis concept for details.
decltype(auto)
Axis &&any axis instance Returns reference to metadata of an axis. If the expression x.metadata() for an axis instance x (maybe const) is valid, return the result. Otherwise, return a reference to a static instance ofboost::histogram::axis::null_type.
constexpr unsigned
const Axis &any axis instance Returns axis options as unsigned integer. See get_options for details.
constexpr bool
const Axis &any axis instance Returns true if axis is ordered or false. See is_ordered for details.
constexpr unsigned int
const Axis &any axis instance Return axis rank (how many arguments it processes).
std::pair< index_type, index_type >
Axis &any axis instance const U &argument to be passed to update orindex methodReturns pair of axis index and shift for the value argument. Throws std::invalid_argument if the value argument is not implicitly convertible to the argument expected by theindex method. If the result of boost::histogram::axis::traits::get_options<decltype(axis)> has the growth flag set, callupdate method with the argument and return the result. Otherwise, callindex and return the pair of the result and a zero shift.
decltype(auto)
const Axis &any axis instance real_index_typefloating point axis index Returns axis value for index. If the axis has no value method, throw std::runtime_error. If the method exists and accepts a floating point index, pass the index and return the result. If the method exists but accepts only integer indices, cast the floating point index to int, pass this index and return the result.
Result
requested return type axis type const Axis &any axis instance real_index_typefloating point axis index Returns axis value for index if it is convertible to target type or throws. Like boost::histogram::axis::traits::value, but converts the result into the requested return type. If the conversion is not possible, throws std::runtime_error.
axis type. Value type for axis type. Doxygen does not render this well. This is a meta-function (template alias), it accepts an axis type and returns the value type.The value type is deduced from the argument of the Axis::index method. Const references are decayed to the their value types, for example, the type deduced forAxis::index(const int&) isint.The deduction always succeeds if the axis type models the Axis concept correctly. Errors come from violations of the concept, in particular, an index method that is templated or overloaded is not allowed.
decltype(auto)
const Axis &any axis instance index_typebin index Returns bin width at axis index. If the axis has no value method, throw std::runtime_error. If the method exists and accepts a floating point index, return the result ofaxis.value(index + 1) - axis.value(index). If the method exists but accepts only integer indices, return 0.
Result
const Axis &any axis instance index_typebin index Returns bin width at axis index. Like boost::histogram::axis::traits::width, but converts the result into the requested return type. If the conversion is not possible, throw std::runtime_error.
input value type, must be floating point. type to store meta data. see boost::histogram::axis::option (all values allowed). allocator to use for dynamic memory management. boost::histogram::axis::iterator_mixin< variable< Value, MetaData, Options, Allocator > >metadata_base_t< MetaData >Axis for non-equidistant bins on the real line. Binning is a O(log(N)) operation. If speed matters and the problem domain allows it, prefer a regular axis, possibly with a transform.
index_typevalue_typeReturn index for value argument. std::pair< index_type, index_type >value_typevalue_typereal_index_typeReturn value for fractional index argument. autoindex_typeReturn bin for index argument. index_typeReturns the number of bins, without over- or underflow. bool
const variable< V, M, O, A > &bool
const variable< V, M, O, A > &autoReturn allocator instance. void
Archive &unsignedallocator_type
Itbegin of edge sequence. Itend of edge sequence. metadata_type{}description of the axis. allocator_type{}allocator instance to use. Construct from iterator range of bin edges.
const U &iterable range of bin edges. metadata_type{}description of the axis. allocator_type{}allocator instance to use. Construct variable axis from iterable range of bin edges.
std::initializer_list< U >std::initializer_list of bin edges.metadata_type{}description of the axis. allocator_type{}allocator instance to use. Construct variable axis from initializer list of bin edges.
const variable &index_typeindex_typeunsignedConstructor used by algorithm::reduce to shrink and rebin (not for users).
constexpr unsignedReturns the options.
decltype(auto)
class...variant< Us... > &Return reference to T, throws std::runtime_error if type does not match. decltype(auto)
class...variant< Us... > &&Return movable reference to T, throws unspecified exception if type does not match. decltype(auto)
class...const variant< Us... > &Return const reference to T, throws unspecified exception if type does not match. auto
class...variant< Us... > *Returns pointer to T in variant or null pointer if type does not match. auto
class...const variant< Us... > *Returns pointer to const T in variant or null pointer if type does not match. bool
class...class...const variant< Us... > &const variant< Ts... > &The negation of operator==. bool
class...const variant< Us... > &const T &The negation of operator==. bool
class...const T &const variant< Us... > &The negation of operator==. bool
class...class...const variant< Us... > &const variant< Vs... > &Compare two variants. Return true if the variants point to the same concrete axis type and the types compare equal. Otherwise return false. bool
class...const variant< Us... > &const T &Compare variant with a concrete axis type. Return true if the variant point to the same concrete axis type and the types compare equal. Otherwise return false.
class...boost::histogram::axis::iterator_mixin< variant< Ts... > >Polymorphic axis type.
index_typeReturn size of axis. unsignedReturn options of axis or option::none_t if axis has no options. boolReturns true if the axis is inclusive or false. boolReturns true if the axis is ordered or false. boolReturns true if the axis is continuous or false. metadata_type &Return reference to const metadata or instance of null_type if axis has no metadata.metadata_type &Return reference to metadata or instance of null_type if axis has no metadata.index_type
const U &Return index for value argument. Throws std::invalid_argument if axis has incompatible call signature. doublereal_index_typeReturn value for index argument. Only works for axes with value method that returns something convertible to double and will throw a runtime_error otherwise, see axis::traits::value(). autoindex_typeReturn bin for index argument. Only works for axes with value method that returns something convertible to double and will throw a runtime_error otherwise, see axis::traits::value(). void
Archive &unsignedconst variant &variant &const variant &variant &&variant &variant &&
T &&variant &
T &&
class...const variant< Us... > &variant &
class...const variant< Us... > &decltype(auto)
class...Visitor &&variant< Us... > &Apply visitor to variant (reference). decltype(auto)
class...Visitor &&variant< Us... > &&Apply visitor to variant (movable reference). decltype(auto)
class...Visitor &&const variant< Us... > &Apply visitor to variant (const reference).