boostorg / histogram

Fast multi-dimensional generalized histogram with convenient interface for C++14
Boost Software License 1.0
313 stars 74 forks source link

Compiling of samples in doc: failure #306

Closed skramm closed 3 years ago

skramm commented 3 years ago

Hi, First, congrats for this great lib that I already use for basic 1d histograms.

I am currently experimenting with custom accumulators and I am facing a build issue. So back to basics, I tried to build the provided sample code. And no success! See here, second example: I juste pasted that, and got:

main.cpp:11:57: error: expected template-name before '<' token
   11 |   struct accumulator_with_metadata : accumulators::count<> {
main.cpp:11:57: error: expected '{' before '<' token
main.cpp:11:57: error: expected unqualified-id before '<' token

See it here on Coliru. (This is with C++17, I try to stick to C++14 and got the same message)

Any idea?

henryiii commented 3 years ago

Don't you need a keyword like "public" there for inheritance?

skramm commented 3 years ago

I think it got optional/default at some point (C++11?), but anyway, I tried with struct accumulator_with_metadata : public accumulators::count<> { same problem.

henryiii commented 3 years ago

Sorry, was on my phone and was just looking for possible issues. Yes, "private" is the default, which I rarely find useful, so I'd forgotten it worked.

I think the issue here might be that Coliru using an old version of Boost that doesn't have this accumulator. I don't seem to be able to include #include <boost/histogram/accumulators/count.hpp>. If I try the exact same code on Wandbox link, it works just fine (and I can include the above file explicitly if I want to, as well).

Pretty sure that's the problem.

henryiii commented 3 years ago

Just checked, Coliru uses Boost 1.71.0. Current version is 1.75.0, and Boost.Histogram was introduced in 1.70.0 (IIRC, +/- 1), so that's a pretty early version for Boost.Histogram. Some things available now should be expected to be missing back then.

skramm commented 3 years ago

Ah, well ok, thanks, I should have checked that, sorry for the noise! I'll try to upgrade my machines boost version.