123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #ifndef BOOST_HISTOGRAM_UNSAFE_ACCESS_HPP
- #define BOOST_HISTOGRAM_UNSAFE_ACCESS_HPP
- #include <boost/histogram/detail/axes.hpp>
- #include <type_traits>
- namespace boost {
- namespace histogram {
- struct unsafe_access {
-
- template <class Histogram>
- static auto& axes(Histogram& hist) {
- return hist.axes_;
- }
-
- template <class Histogram>
- static const auto& axes(const Histogram& hist) {
- return hist.axes_;
- }
-
- template <class Histogram, unsigned I = 0>
- static decltype(auto) axis(Histogram& hist, std::integral_constant<unsigned, I> = {}) {
- assert(I < hist.rank());
- return detail::axis_get<I>(hist.axes_);
- }
-
- template <class Histogram>
- static decltype(auto) axis(Histogram& hist, unsigned i) {
- assert(i < hist.rank());
- return detail::axis_get(hist.axes_, i);
- }
-
- template <class Histogram>
- static auto& storage(Histogram& hist) {
- return hist.storage_;
- }
-
- template <class Histogram>
- static const auto& storage(const Histogram& hist) {
- return hist.storage_;
- }
-
- template <class Histogram>
- static auto& offset(Histogram& hist) {
- return hist.offset_;
- }
-
- template <class Histogram>
- static const auto& offset(const Histogram& hist) {
- return hist.offset_;
- }
-
- template <class Allocator>
- static constexpr auto& unlimited_storage_buffer(unlimited_storage<Allocator>& storage) {
- return storage.buffer_;
- }
-
- template <class T>
- static constexpr auto& storage_adaptor_impl(storage_adaptor<T>& storage) {
- return static_cast<typename storage_adaptor<T>::impl_type&>(storage);
- }
- };
- }
- }
- #endif
|