![]() |
Ultra 0.9.4
|
#include <alps.h>
Public Member Functions | |
| alps_layer_pair (Layer &l) noexcept | |
| alps_layer_pair (Layer &p, Layer &s) noexcept | |
| constexpr std::size_t | size () const noexcept |
| constexpr bool | has_secondary () const noexcept |
| constexpr auto | begin () const noexcept |
| constexpr auto | end () const noexcept |
| constexpr Layer & | primary () const noexcept |
| constexpr Layer & | secondary () const noexcept |
| Layer & | random (double p_pri) const |
Lightweight view over one or two ALPS layers.
| Layer | layer type. Can be const to model read-only access. |
This class stores references to a primary layer and, optionally, a secondary layer. It's designed to avoid dynamic allocation in helper functions that, by policy, return either one or two eligible layers.
The object is iterable. When no secondary layer is present, size() is 1 and the iteration covers only the primary layer.
|
inlinenoexcept |
Builds a pair with a single eligible layer (primary only).
| [in] | l | primary layer |
After construction size() == 1 and has_secondary() == false.
|
inlinenoexcept |
Builds a pair with two eligible layers (primary and secondary).
| [in] | p | primary layer |
| [in] | s | secondary layer |
After construction size() == 2 and has_secondary() == true.
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscard |
Picks a layer at random.
| [in] | p_pri | probability of selecting the primary layer |
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |