DiscreteAxis.qbk 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. [/
  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)
  6. ]
  7. [section:DiscreteAxis DiscreteAxis]
  8. A [*DiscreteAxis] is one of two optional refinements of the [link histogram.concepts.Axis [*Axis]] concept, the other one is the [link histogram.concepts.IntervalAxis IntervalAxis]. This concept is for values that do not form intervals, and for axes with intervals that contain exactly one value.
  9. [heading Associated Types]
  10. * [link histogram.concepts.Axis [*Axis]]
  11. * [link histogram.concepts.IntervalAxis [*IntervalAxis]]
  12. [heading Requirements]
  13. * `A` is a type meeting the requirements of [*DiscreteAxis]
  14. * `a` is a value of type `A`
  15. * `V` is the type accepted for conversion into an index
  16. * `v` is a value of type `V`
  17. * `i` is a value of type [headerref boost/histogram/fwd.hpp `boost::histogram::axis::index_type`]
  18. * `AxisIter` is an /RandomAccessIterator/ over the bins of `A`
  19. * `ReAxisIter` is a reverse /RandomAccessIterator/ over the bins of `A`
  20. [table Valid expressions
  21. [[Expression] [Returns] [Semantics, Pre/Post-conditions]]
  22. [
  23. [`a.value(i)`]
  24. [`V`]
  25. [
  26. Const member function which maps an index to a value. The mapping must be injective: each index must be uniquely mapped to one value. The effect must be exactly the inverse of `a.index(v)`. The return value may be a const reference, if the lifetime of the referred object is equal to the lifetime of the axis.
  27. ]
  28. ]
  29. [
  30. [`a.bin(i)`]
  31. [`V`]
  32. [
  33. Must have the same effect as `a.value(i)`.
  34. ]
  35. ]
  36. [
  37. [`s.begin()`]
  38. [`AxisIter`]
  39. [
  40. Const member function which return an iterator to the bin with index `0`.
  41. ]
  42. ]
  43. [
  44. [`s.end()`]
  45. [`AxisIter`]
  46. [
  47. Const member function which returns an iterator to the bin with index `s.size()`.
  48. ]
  49. ]
  50. [
  51. [`s.rbegin()`]
  52. [`ReAxisIter`]
  53. [
  54. Const member function which return a reverse iterator to the bin with index `s.size()-1`.
  55. ]
  56. ]
  57. [
  58. [`s.rend()`]
  59. [`ReAxisIter`]
  60. [
  61. Const member function which returns an iterator to the bin with index `-1`.
  62. ]
  63. ]
  64. ]
  65. [tip The complete iterator interface can be added to a user-defined axis which implements `a.bin(i)` by inheriting from the [classref boost::histogram::axis::iterator_mixin iterator_mixin].]
  66. [heading Models]
  67. * [classref boost::histogram::axis::category]
  68. * [classref boost::histogram::axis::integer], if first template parameter is [headerref boost/histogram/fwd.hpp `boost::histogram::index_type`]
  69. [endsect]