...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::histogram::unsafe_access — Unsafe read/write access to private data that potentially breaks consistency.
// In header: <boost/histogram/unsafe_access.hpp> struct unsafe_access { // public static functions template<typename Histogram> static auto & axes(Histogram &); template<typename Histogram> static const auto & axes(const Histogram &); template<typename Histogram, unsigned I = 0> static decltype(auto) axis(Histogram &, std::integral_constant< unsigned, I > = {}); template<typename Histogram> static decltype(auto) axis(Histogram &, unsigned); template<typename Histogram> static auto & storage(Histogram &); template<typename Histogram> static const auto & storage(const Histogram &); template<typename Histogram> static auto & offset(Histogram &); template<typename Histogram> static const auto & offset(const Histogram &); template<typename Allocator> static constexpr auto & unlimited_storage_buffer(unlimited_storage< Allocator > &); template<typename T> static constexpr auto & storage_adaptor_impl(storage_adaptor< T > &); };
This struct enables access to private data of some classes. It is intended for library developers who need this to implement algorithms efficiently, for example, serialization. Users should not use this. If you are a user who absolutely needs this to get a specific effect, please submit an issue on Github. Perhaps the public interface is insufficient and should be extended for your use case.
Unlike the normal interface, the unsafe_access interface may change between versions. If your code relies onunsafe_access, it may or may not break when you update Boost. This is another reason to not use it unless you are ok with these conditions.
unsafe_access
public static functionstemplate<typename Histogram> static auto & axes(Histogram & hist);Get axes.
Parameters: |
|
template<typename Histogram> static const auto & axes(const Histogram & hist);Get axes.
Parameters: |
|
template<typename Histogram, unsigned I = 0> static decltype(auto) axis(Histogram & hist, std::integral_constant< unsigned, I > = {});Get mutable axis reference with compile-time number.
Parameters: |
|
||
Template Parameters: |
|
template<typename Histogram> static decltype(auto) axis(Histogram & hist, unsigned i);Get mutable axis reference with run-time number.
Parameters: |
|
template<typename Histogram> static auto & storage(Histogram & hist);Get storage.
Parameters: |
|
template<typename Histogram> static const auto & storage(const Histogram & hist);Get storage.
Parameters: |
|
template<typename Histogram> static auto & offset(Histogram & hist);Get index offset.
Parameters: |
|
template<typename Histogram> static const auto & offset(const Histogram & hist);Get index offset.
Parameters: |
|
template<typename Allocator> static constexpr auto & unlimited_storage_buffer(unlimited_storage< Allocator > & storage);Get buffer of
unlimited_storage
.
Parameters: |
|
template<typename T> static constexpr auto & storage_adaptor_impl(storage_adaptor< T > & storage);Get implementation of
storage_adaptor
.
Parameters: |
|