diff --git a/.github/workflows/cov.yml b/.github/workflows/cov.yml index 44261804..a14b313b 100644 --- a/.github/workflows/cov.yml +++ b/.github/workflows/cov.yml @@ -22,7 +22,7 @@ jobs: cov: runs-on: macos-11 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Fetch Boost superproject run: | cd .. diff --git a/.github/workflows/fast.yml b/.github/workflows/fast.yml index 236b0c99..61841587 100644 --- a/.github/workflows/fast.yml +++ b/.github/workflows/fast.yml @@ -32,7 +32,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] fail-fast: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: prepare build run: | mkdir build diff --git a/.github/workflows/slow.yml b/.github/workflows/slow.yml index 0c2a8b4d..68755972 100644 --- a/.github/workflows/slow.yml +++ b/.github/workflows/slow.yml @@ -25,7 +25,7 @@ jobs: appleclang: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Fetch Boost superproject run: | cd .. @@ -49,7 +49,7 @@ jobs: gcc7: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: egor-tensin/setup-gcc@v1 with: version: 7 @@ -73,7 +73,7 @@ jobs: gcc10: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Fetch Boost superproject run: | cd .. @@ -94,7 +94,7 @@ jobs: clang14: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Fetch Boost superproject run: | cd .. diff --git a/.github/workflows/superproject_cmake.yml b/.github/workflows/superproject_cmake.yml index a5f2de3c..6651fb55 100644 --- a/.github/workflows/superproject_cmake.yml +++ b/.github/workflows/superproject_cmake.yml @@ -14,7 +14,7 @@ jobs: build: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Fetch Boost superproject run: | cd .. diff --git a/CMakeLists.txt b/CMakeLists.txt index b7ad7964..b9061817 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ add_library(boost_histogram INTERFACE) add_library(Boost::histogram ALIAS boost_histogram) target_include_directories(boost_histogram INTERFACE include) -target_compile_features(boost_histogram INTERFACE cxx_std_14) + target_link_libraries(boost_histogram INTERFACE Boost::config @@ -22,6 +22,8 @@ target_link_libraries(boost_histogram Boost::math ) +target_compile_features(boost_histogram INTERFACE cxx_std_14) + if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) # Standalone build, fetch dependencies diff --git a/README.md b/README.md index bee98283..ae048e89 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,13 @@ **Multi-dimensional generalised histograms with convenient interface** -Coded with ❤. Powered by the [Boost community](https://www.boost.org) and the [Scikit-HEP Project](http://scikit-hep.org). Licensed under the [Boost Software License](http://www.boost.org/LICENSE_1_0.txt). +Coded with ❤. Powered by the [Boost community](https://www.boost.org) and the [Scikit-HEP Project](http://scikit-hep.org). + +## License + +Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). + +## Properties **Supported compiler versions** gcc >= 5.5, clang >= 3.8, msvc >= 14.1 **Supported C++ versions** 14, 17, 20 @@ -33,7 +39,7 @@ Check out the [full documentation](https://www.boost.org/doc/libs/master/libs/hi 💡 Boost.Histogram is a mature library with 100 % of code lines covered by unit tests, is benchmarked for performance, and has extensive documentation. If you still find some issue or find the documentation lacking, tell us about it by [submitting an issue](https://github.com/boostorg/histogram/issues). Chat with us on the [Boost channel on Slack](https://cpplang.slack.com) and [Gitter](https://gitter.im/boostorg/histogram). -## Code examples +## Code example The following stripped-down example was taken from the [Getting started](https://www.boost.org/doc/libs/master/libs/histogram/doc/html/histogram/getting_started.html) section in the documentation. Have a look into the docs to see the full version with comments and more examples. @@ -115,3 +121,10 @@ Details on the benchmark are given in the [documentation](https://www.boost.org/ **John Buonagurio** | Manager at [**Exponent®**](https://www.exponent.com) *"I just wanted to say 'thanks' for your awesome Histogram library. I'm working on a software package for processing meteorology data and I'm using it to generate wind roses with the help of Qt and QwtPolar. Looks like you thought of just about everything here – the circular axis type was practically designed for this application, everything 'just worked'."* + +## More information + +* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-template) +* [Report bugs](https://github.com/boostorg/template/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. +* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). +* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[template]` tag at the beginning of the subject line. diff --git a/include/boost/histogram/detail/large_int.hpp b/include/boost/histogram/detail/large_int.hpp index 62e09554..d68a33ea 100644 --- a/include/boost/histogram/detail/large_int.hpp +++ b/include/boost/histogram/detail/large_int.hpp @@ -83,7 +83,7 @@ struct large_int : totally_ordered, large_int>, large_int& operator+=(const large_int& o) { if (this == &o) { - auto tmp{o}; + auto tmp = o; // make a copy return operator+=(tmp); } bool carry = false; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6e26b003..687f6abd 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -40,6 +40,8 @@ boost_test(TYPE compile-fail SOURCES histogram_fail4.cpp) set(BOOST_TEST_LINK_LIBRARIES Boost::histogram Boost::core) +boost_test(TYPE run SOURCES quick.cpp) + boost_test(TYPE run SOURCES accumulators_count_test.cpp) boost_test(TYPE run SOURCES accumulators_mean_test.cpp) boost_test(TYPE run SOURCES accumulators_sum_test.cpp) diff --git a/test/Jamfile b/test/Jamfile index d38b5398..3df93a9f 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -39,6 +39,7 @@ alias odr : ; alias cxx14 : + [ run quick.cpp ] [ run accumulators_count_test.cpp ] [ run accumulators_fraction_test.cpp ] [ run accumulators_mean_test.cpp ] diff --git a/test/histogram_fraction_test.cpp b/test/histogram_fraction_test.cpp index 68c15377..d59f506b 100644 --- a/test/histogram_fraction_test.cpp +++ b/test/histogram_fraction_test.cpp @@ -31,19 +31,19 @@ int main() { BOOST_TEST_EQ(h.at(1), (fraction_t{1, 0})); // cannot use std::vector because of vector specialization - std::vector s = {true, false}; + std::vector s = {{true, false}}; std::vector x = {0, 1}; h.fill(x, sample(s)); BOOST_TEST_EQ(h.at(0), (fraction_t{2, 1})); BOOST_TEST_EQ(h.at(1), (fraction_t{1, 1})); // any contiguous container of bool works which is not specialized - std::array s2 = {false, true}; + std::array s2 = {{false, true}}; h.fill(x, sample(s2)); BOOST_TEST_EQ(h.at(0), (fraction_t{2, 2})); BOOST_TEST_EQ(h.at(1), (fraction_t{2, 1})); - std::valarray s3 = {false, true}; + std::valarray s3 = {{false, true}}; h.fill(x, sample(s3)); BOOST_TEST_EQ(h.at(0), (fraction_t{2, 3})); BOOST_TEST_EQ(h.at(1), (fraction_t{3, 1})); diff --git a/test/quick.cpp b/test/quick.cpp new file mode 100644 index 00000000..402aea13 --- /dev/null +++ b/test/quick.cpp @@ -0,0 +1,19 @@ +// Copyright 2022 Hans Dembinski +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt +// or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include "throw_exception.hpp" + +int main() { + using namespace boost::histogram; + + auto h = make_histogram(axis::integer<>(0, 5)); + + h(0); + + auto values = {1, 2}; + h.fill(values); +}