boostorg / boostorg/histogram

use arguments of storage to generate accumulator default value

Open
#250 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
334
Forks
76
PR merge metrics
No merged PRs in 30d

Description

The storage is passed as a value to the histogram, because it allows the storage to be configured at run-time.
```
auto h = make_histogram_with(dense_storage(), ...);
```

So far we have not made use of this feature, but I propose to extend the `storage_adaptor` so that it accepts arguments in its ctor which are used to initialize the default value for its accumulator.
```
auto h = make_histogram_with(dense_storage(3), ...);
```
Internally, the storage creates a value `int default_value{3}` with the arguments passed to it. Then, whenever the histogram resets the storage, the accumulators are initialized to this value.

This feature allows one to pass run-time configuration to the accumulators, which is currently not possible.

@henryiii @jpivarski any thoughts?

Contributor guide

Open the contributing guide

Research direction

Start by reading the storage_adaptor and histogram reset behavior described in the issue. Trace how storage constructor arguments could initialize the accumulator default value, then verify that a runtime value such as dense_storage(3) is preserved when the histogram resets its storage.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.