Skip to content

Commit cd3e111

Browse files
authored
Updates from #370 (#397)
This PR keeps the useful changes from PR #370, which was never finished.
1 parent b11364e commit cd3e111

File tree

11 files changed

+51
-14
lines changed

11 files changed

+51
-14
lines changed

.github/workflows/cov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
cov:
2323
runs-on: macos-11
2424
steps:
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
2626
- name: Fetch Boost superproject
2727
run: |
2828
cd ..

.github/workflows/fast.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
os: [ubuntu-latest, windows-latest, macos-latest]
3333
fail-fast: true
3434
steps:
35-
- uses: actions/checkout@v3
35+
- uses: actions/checkout@v4
3636
- name: prepare build
3737
run: |
3838
mkdir build

.github/workflows/slow.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
appleclang:
2626
runs-on: macos-latest
2727
steps:
28-
- uses: actions/checkout@v3
28+
- uses: actions/checkout@v4
2929
- name: Fetch Boost superproject
3030
run: |
3131
cd ..
@@ -49,7 +49,7 @@ jobs:
4949
gcc7:
5050
runs-on: ubuntu-20.04
5151
steps:
52-
- uses: actions/checkout@v3
52+
- uses: actions/checkout@v4
5353
- uses: egor-tensin/setup-gcc@v1
5454
with:
5555
version: 7
@@ -73,7 +73,7 @@ jobs:
7373
gcc10:
7474
runs-on: ubuntu-latest
7575
steps:
76-
- uses: actions/checkout@v3
76+
- uses: actions/checkout@v4
7777
- name: Fetch Boost superproject
7878
run: |
7979
cd ..
@@ -94,7 +94,7 @@ jobs:
9494
clang14:
9595
runs-on: ubuntu-latest
9696
steps:
97-
- uses: actions/checkout@v3
97+
- uses: actions/checkout@v4
9898
- name: Fetch Boost superproject
9999
run: |
100100
cd ..

.github/workflows/superproject_cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
build:
1515
runs-on: macos-latest
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
- name: Fetch Boost superproject
1919
run: |
2020
cd ..

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ add_library(boost_histogram INTERFACE)
1111
add_library(Boost::histogram ALIAS boost_histogram)
1212

1313
target_include_directories(boost_histogram INTERFACE include)
14-
target_compile_features(boost_histogram INTERFACE cxx_std_14)
14+
1515
target_link_libraries(boost_histogram
1616
INTERFACE
1717
Boost::config
@@ -22,6 +22,8 @@ target_link_libraries(boost_histogram
2222
Boost::math
2323
)
2424

25+
target_compile_features(boost_histogram INTERFACE cxx_std_14)
26+
2527
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
2628
# Standalone build, fetch dependencies
2729

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@
99

1010
**Multi-dimensional generalised histograms with convenient interface**
1111

12-
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).
12+
Coded with ❤. Powered by the [Boost community](https://www.boost.org) and the [Scikit-HEP Project](http://scikit-hep.org).
13+
14+
## License
15+
16+
Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
17+
18+
## Properties
1319

1420
**Supported compiler versions** gcc >= 5.5, clang >= 3.8, msvc >= 14.1
1521
**Supported C++ versions** 14, 17, 20
@@ -33,7 +39,7 @@ Check out the [full documentation](https://www.boost.org/doc/libs/master/libs/hi
3339

3440
💡 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).
3541

36-
## Code examples
42+
## Code example
3743

3844
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.
3945

@@ -115,3 +121,10 @@ Details on the benchmark are given in the [documentation](https://www.boost.org/
115121
**John Buonagurio** | Manager at [**E<sup><i>x</i></sup>ponent<sup>&reg;</sup>**](https://www.exponent.com)
116122

117123
*"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 &ndash; the circular axis type was practically designed for this application, everything 'just worked'."*
124+
125+
## More information
126+
127+
* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-template)
128+
* [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.
129+
* 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).
130+
* 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.

include/boost/histogram/detail/large_int.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct large_int : totally_ordered<large_int<Allocator>, large_int<Allocator>>,
8383

8484
large_int& operator+=(const large_int& o) {
8585
if (this == &o) {
86-
auto tmp{o};
86+
auto tmp = o; // make a copy
8787
return operator+=(tmp);
8888
}
8989
bool carry = false;

test/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ boost_test(TYPE compile-fail SOURCES histogram_fail4.cpp)
4040

4141
set(BOOST_TEST_LINK_LIBRARIES Boost::histogram Boost::core)
4242

43+
boost_test(TYPE run SOURCES quick.cpp)
44+
4345
boost_test(TYPE run SOURCES accumulators_count_test.cpp)
4446
boost_test(TYPE run SOURCES accumulators_mean_test.cpp)
4547
boost_test(TYPE run SOURCES accumulators_sum_test.cpp)

test/Jamfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ alias odr :
3939
;
4040

4141
alias cxx14 :
42+
[ run quick.cpp ]
4243
[ run accumulators_count_test.cpp ]
4344
[ run accumulators_fraction_test.cpp ]
4445
[ run accumulators_mean_test.cpp ]

test/histogram_fraction_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ int main() {
3131
BOOST_TEST_EQ(h.at(1), (fraction_t{1, 0}));
3232

3333
// cannot use std::vector<bool> because of vector specialization
34-
std::vector<char> s = {true, false};
34+
std::vector<char> s = {{true, false}};
3535
std::vector<int> x = {0, 1};
3636
h.fill(x, sample(s));
3737
BOOST_TEST_EQ(h.at(0), (fraction_t{2, 1}));
3838
BOOST_TEST_EQ(h.at(1), (fraction_t{1, 1}));
3939

4040
// any contiguous container of bool works which is not specialized
41-
std::array<bool, 2> s2 = {false, true};
41+
std::array<bool, 2> s2 = {{false, true}};
4242
h.fill(x, sample(s2));
4343
BOOST_TEST_EQ(h.at(0), (fraction_t{2, 2}));
4444
BOOST_TEST_EQ(h.at(1), (fraction_t{2, 1}));
4545

46-
std::valarray<bool> s3 = {false, true};
46+
std::valarray<bool> s3 = {{false, true}};
4747
h.fill(x, sample(s3));
4848
BOOST_TEST_EQ(h.at(0), (fraction_t{2, 3}));
4949
BOOST_TEST_EQ(h.at(1), (fraction_t{3, 1}));

test/quick.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2022 Hans Dembinski
2+
//
3+
// Distributed under the Boost Software License, Version 1.0.
4+
// (See accompanying file LICENSE_1_0.txt
5+
// or copy at http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#include <boost/histogram.hpp>
8+
#include "throw_exception.hpp"
9+
10+
int main() {
11+
using namespace boost::histogram;
12+
13+
auto h = make_histogram(axis::integer<>(0, 5));
14+
15+
h(0);
16+
17+
auto values = {1, 2};
18+
h.fill(values);
19+
}

0 commit comments

Comments
 (0)