|
Boost : |
Subject: Re: [boost] Formal Review of Proposed Boost.Histogram Library Starts TODAY
From: Hans Dembinski (hans.dembinski_at_[hidden])
Date: 2018-09-25 19:54:13
Hi Alex,
> On 25. Sep 2018, at 16:31, <a.hagen-zanker_at_[hidden]> <a.hagen-zanker_at_[hidden]> wrote:
>
> I just ran the very first example on the opening page (http://hdembinski.github.io/histogram/index.html)
>
> My output is different from the given example though, as it seems that nothing is counted:
>
> bin 0 x in [-1, -0.5): 0 +/- 0
> bin 1 x in [-0.5, -1.11022e-16): 0 +/- 0
> bin 2 x in [-1.11022e-16, 0.5): 0 +/- 0
> bin 3 x in [0.5, 1): 0 +/- 0
> bin 4 x in [1, 1.5): 0 +/- 0
> bin 5 x in [1.5, 2): 0 +/- 0
> bin 6 x in [2, inf): 0 +/- 0
> bin -1 x in [-inf, -1): 0 +/- 0
>
> Any clue as to what happened? I have VS 15.7.4, Boost version 1.67, and compile with C++17 turned on.
thanks for catching this, the example in the README.md and in the Getting Started section is wrong. std::for_each makes a copy of the functor, calls operator() on all items in the iterator range and finally returns the functor. The return value is ignored in the example, therefore it is like the fill never happened.
Best regards,
Hans
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk