Skip to content

Commit 34e11b7

Browse files
committed
fix
1 parent b731ef2 commit 34e11b7

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

include/boost/histogram/accumulators/mean.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class mean {
3030
using value_type = ValueType;
3131
using const_reference = const value_type&;
3232

33-
struct internal_data_type {
33+
struct impl_type {
3434
value_type sum_;
3535
value_type mean_;
3636
value_type sum_of_deltas_squared_;
@@ -152,9 +152,9 @@ class mean {
152152
}
153153

154154
private:
155-
friend struct unsafe_access;
155+
impl_type data_{0, 0, 0};
156156

157-
internal_data_type data_{0, 0, 0};
157+
friend struct unsafe_access;
158158
};
159159

160160
} // namespace accumulators

include/boost/histogram/unsafe_access.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ struct unsafe_access {
116116
@param obj instance of accumulator.
117117
*/
118118
template <class T>
119-
static constexpr auto& accumulators_mean_impl(T&& m) {
120-
return m.data_;
119+
static constexpr auto& accumulators_mean_impl(T& m) {
120+
return reinterpret_cast<typename T::impl_type&>(m);
121121
}
122122
};
123123

test/accumulators_mean_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ int main() {
118118
a(2);
119119

120120
BOOST_TEST_EQ(a.count(), 2);
121-
unsafe_access::accumulators_mean(a).sum_ = 1;
121+
unsafe_access::accumulators_mean_impl(a).sum_ = 1;
122122
BOOST_TEST_EQ(a.count(), 1);
123123
}
124124

0 commit comments

Comments
 (0)