2 Copyright Hans Dembinski 2018 - 2019.
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at
5 https://www.boost.org/LICENSE_1_0.txt)
8 [section:Storage Storage]
10 A [*Storage] handles memory for the bin counters and provides a uniform vector-like interface for accessing cell values for reading and writing. Must be [@https://en.cppreference.com/w/cpp/named_req/DefaultConstructible DefaultConstructible], [@https://en.cppreference.com/w/cpp/named_req/CopyConstructible CopyConstructible], and [@https://en.cppreference.com/w/cpp/named_req/CopyAssignable CopyAssignable].
12 [heading Required features]
14 * `S` is a type meeting the requirements of [*Storage]
15 * `s` is a value of types `S`
16 * `i` and `n` are values of type `std::size_t`
18 [table Valid expressions
19 [[Expression] [Returns] [Semantics, Pre/Post-conditions]]
24 Cell element type, may be either an integral type, floating-point type, or a type meeting the requirements of [link histogram.concepts.Accumulator [*Accumulator]].
31 `S::value_type&` or a proxy class which acts like a reference.
35 [`S::const_reference`]
38 `const S::value_type&` or a proxy class which acts like a const reference. Implicitly convertible to `S::value_type`.
45 Returns an STL-compliant iterator type which dereferences to `S::reference`.
52 Returns an STL-compliant iterator type which dereferences to `S::const_reference`.
56 [`S::has_threading_support`]
59 Static constexpr member. True, if storage supports parallel read-write access to all cells.
60 False, if such parallel access would either cause data corruption or require synchronization so that effectively only one cell can be accessed at a time, making cell-access single-threaded.
67 Const member function which returns the current number of cells in the storage.
74 Non-const member function which discards current cell values, changes storage size to `n` and initializes all cells to the default-constructed state.
81 Non-const member function which returns the iterator to the first storage cell.
88 Likewise, but a const member function which returns the const_iterator.
95 Member function which returns the iterator to the cell after the last valid storage cell.
100 [`S::const_iterator`]
102 Likewise, but a const member function which returns the const_iterator.
109 Member function which returns a reference to the cell which is addressed by `i`. The index `i` must be valid: `i < s.size()`.
114 [`S::const_reference`]
116 Likewise, but a const member function which returns a const reference.
123 `t` is another value of a type which meets the requirements of [*Storage]. Returns `true` if arguments have the same number of cells and all cells compare equal. Otherwise returns `false`.
127 [`s.get_allocator()`]
130 Const member function which returns the allocator `Alloc` used by `S`. May be omitted if `S` does not use allocators. If this member function exists, also a special constructor must exists so that `S(s.get_allocator())` is a valid expression.
135 [heading Optional features]
137 * `S` is a type meeting the requirements of [*Storage]
138 * `s` is a value of types `S`
139 * `x` is convertible to `double`
140 * `ar` is a value of an archive with Boost.Serialization semantics
142 [table Valid expressions
143 [[Expression] [Returns] [Semantics, Pre/Post-conditions]]
148 Scales all cell values by the factor `x` and returns a reference to self.
152 [`s.serialize(ar, n)`]
155 `ar` is a value of an archive with Boost.Serialization semantics and `n` is an unsigned integral value. Saves to the archive or loads serialized state from the archive. The version number `n` is the stored version when the object is loaded or the current version when the object is saved.
162 * [classref boost::histogram::unlimited_storage]
163 * [classref boost::histogram::storage_adaptor]
164 * [classref boost::histogram::dense_storage]
165 * [classref boost::histogram::weight_storage]
166 * [classref boost::histogram::profile_storage]
167 * [classref boost::histogram::weighted_profile_storage]