File indexing completed on 2025-03-13 08:46:36
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_HISTOGRAM_UNSAFE_ACCESS_HPP
0008 #define BOOST_HISTOGRAM_UNSAFE_ACCESS_HPP
0009
0010 #include <boost/histogram/detail/axes.hpp>
0011 #include <type_traits>
0012
0013 namespace boost {
0014 namespace histogram {
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 struct unsafe_access {
0029
0030
0031
0032
0033 template <class Histogram>
0034 static auto& axes(Histogram& hist) {
0035 return hist.axes_;
0036 }
0037
0038
0039 template <class Histogram>
0040 static const auto& axes(const Histogram& hist) {
0041 return hist.axes_;
0042 }
0043
0044
0045
0046
0047
0048
0049 template <class Histogram, unsigned I = 0>
0050 static decltype(auto) axis(Histogram& hist, std::integral_constant<unsigned, I> = {}) {
0051 assert(I < hist.rank());
0052 return detail::axis_get<I>(hist.axes_);
0053 }
0054
0055
0056
0057
0058
0059
0060 template <class Histogram>
0061 static decltype(auto) axis(Histogram& hist, unsigned i) {
0062 assert(i < hist.rank());
0063 return detail::axis_get(hist.axes_, i);
0064 }
0065
0066
0067
0068
0069
0070 template <class Histogram>
0071 static auto& storage(Histogram& hist) {
0072 return hist.storage_;
0073 }
0074
0075
0076 template <class Histogram>
0077 static const auto& storage(const Histogram& hist) {
0078 return hist.storage_;
0079 }
0080
0081
0082
0083
0084
0085 template <class Histogram>
0086 static auto& offset(Histogram& hist) {
0087 return hist.offset_;
0088 }
0089
0090
0091 template <class Histogram>
0092 static const auto& offset(const Histogram& hist) {
0093 return hist.offset_;
0094 }
0095
0096
0097
0098
0099
0100 template <class Allocator>
0101 static constexpr auto& unlimited_storage_buffer(unlimited_storage<Allocator>& storage) {
0102 return storage.buffer_;
0103 }
0104
0105
0106
0107
0108
0109 template <class T>
0110 static constexpr auto& storage_adaptor_impl(storage_adaptor<T>& storage) {
0111 return static_cast<typename storage_adaptor<T>::impl_type&>(storage);
0112 }
0113 };
0114
0115 }
0116 }
0117
0118 #endif