|
Blender
V2.93
|
#include <BLI_stack.hh>
Public Types | |
| using | value_type = T |
| using | pointer = T * |
| using | const_pointer = const T * |
| using | reference = T & |
| using | const_reference = const T & |
| using | size_type = int64_t |
Public Member Functions | |
| Stack (Allocator allocator={}) noexcept | |
| Stack (NoExceptConstructor, Allocator allocator={}) noexcept | |
| Stack (Span< T > values, Allocator allocator={}) | |
| Stack (const std::initializer_list< T > &values, Allocator allocator={}) | |
| Stack (const Stack &other) | |
| Stack (Stack &&other) noexcept(std::is_nothrow_move_constructible_v< T >) | |
| ~Stack () | |
| Stack & | operator= (const Stack &other) |
| Stack & | operator= (Stack &&other) |
| void | push (const T &value) |
| void | push (T &&value) |
| template<typename ForwardT > | |
| void | push_as (ForwardT &&value) |
| T | pop () |
| T & | peek () |
| const T & | peek () const |
| void | push_multiple (Span< T > values) |
| bool | is_empty () const |
| int64_t | size () const |
| void | clear () |
| bool | is_invariant_maintained () const |
Definition at line 82 of file BLI_stack.hh.
| using blender::Stack< T, InlineBufferCapacity, Allocator >::const_pointer = const T * |
Definition at line 86 of file BLI_stack.hh.
| using blender::Stack< T, InlineBufferCapacity, Allocator >::const_reference = const T & |
Definition at line 88 of file BLI_stack.hh.
| using blender::Stack< T, InlineBufferCapacity, Allocator >::pointer = T * |
Definition at line 85 of file BLI_stack.hh.
| using blender::Stack< T, InlineBufferCapacity, Allocator >::reference = T & |
Definition at line 87 of file BLI_stack.hh.
| using blender::Stack< T, InlineBufferCapacity, Allocator >::size_type = int64_t |
Definition at line 89 of file BLI_stack.hh.
| using blender::Stack< T, InlineBufferCapacity, Allocator >::value_type = T |
Definition at line 84 of file BLI_stack.hh.
|
inlinenoexcept |
Initialize an empty stack. No heap allocation is done.
Definition at line 128 of file BLI_stack.hh.
|
inlinenoexcept |
Definition at line 140 of file BLI_stack.hh.
|
inline |
Create a new stack that contains the given elements. The values are pushed to the stack in the order they are in the array.
Definition at line 148 of file BLI_stack.hh.
|
inline |
Create a new stack that contains the given elements. The values are pushed to the stack in the order they are in the array.
Example: Stack<int> stack = {4, 5, 6}; assert(stack.pop() == 6); assert(stack.pop() == 5);
Definition at line 162 of file BLI_stack.hh.
|
inline |
Definition at line 167 of file BLI_stack.hh.
References blender::StackChunk< T >::above, and T.
|
inlinenoexcept |
Definition at line 176 of file BLI_stack.hh.
References blender::StackChunk< T >::above, blender::StackChunk< T >::begin, blender::StackChunk< T >::below, and min.
|
inline |
Definition at line 204 of file BLI_stack.hh.
References blender::StackChunk< T >::above.
|
inline |
Removes all elements from the stack. The memory is not freed, so it is more efficient to reuse the stack than to create a new one.
Definition at line 338 of file BLI_stack.hh.
References blender::StackChunk< T >::begin.
|
inline |
Returns true when the size is zero.
Definition at line 321 of file BLI_stack.hh.
Referenced by blender::fn::mf_network_optimization::compute_node_hashes(), blender::fn::MFNetwork::find_dependencies(), blender::fn::mf_network_optimization::mask_nodes_to_the_left(), blender::fn::mf_network_optimization::mask_nodes_to_the_right(), and blender::tests::TEST().
|
inline |
Definition at line 346 of file BLI_stack.hh.
References blender::StackChunk< T >::begin.
Referenced by blender::tests::TEST().
|
inline |
Definition at line 214 of file BLI_stack.hh.
References blender::copy_assign_container().
|
inline |
Definition at line 219 of file BLI_stack.hh.
References blender::move_assign_container().
|
inline |
Get a reference to the top-most element without removing it from the stack. This invokes undefined behavior when the stack is empty.
Definition at line 276 of file BLI_stack.hh.
References blender::StackChunk< T >::begin, and BLI_assert.
Referenced by blender::fn::mf_network_optimization::compute_node_hashes(), and blender::tests::TEST().
|
inline |
Definition at line 282 of file BLI_stack.hh.
References blender::StackChunk< T >::begin, and BLI_assert.
|
inline |
Remove and return the top-most element from the stack. This invokes undefined behavior when the stack is empty.
Definition at line 255 of file BLI_stack.hh.
References blender::StackChunk< T >::begin, blender::StackChunk< T >::below, BLI_assert, blender::StackChunk< T >::capacity_end, and T.
Referenced by blender::fn::mf_network_optimization::compute_node_hashes(), blender::fn::MFNetwork::find_dependencies(), blender::fn::mf_network_optimization::mask_nodes_to_the_left(), blender::fn::mf_network_optimization::mask_nodes_to_the_right(), and blender::tests::TEST().
|
inline |
Add a new element to the top of the stack.
Definition at line 227 of file BLI_stack.hh.
References blender::Stack< T, InlineBufferCapacity, Allocator >::push_as().
Referenced by blender::fn::mf_network_optimization::compute_node_hashes(), blender::fn::mf_network_optimization::mask_nodes_to_the_left(), blender::fn::mf_network_optimization::mask_nodes_to_the_right(), and blender::tests::TEST().
|
inline |
Definition at line 231 of file BLI_stack.hh.
References blender::Stack< T, InlineBufferCapacity, Allocator >::push_as().
|
inline |
Definition at line 235 of file BLI_stack.hh.
References blender::StackChunk< T >::capacity_end, and T.
Referenced by blender::Stack< T, InlineBufferCapacity, Allocator >::push().
|
inline |
Add multiple elements to the stack. The values are pushed in the order they are in the array. This method is more efficient than pushing multiple elements individually and might cause less heap allocations.
Definition at line 294 of file BLI_stack.hh.
References blender::StackChunk< T >::capacity_end, blender::Span< T >::data(), blender::Span< T >::drop_front(), blender::Span< T >::is_empty(), min, blender::Span< T >::size(), and blender::uninitialized_copy_n().
Referenced by blender::fn::mf_network_optimization::compute_node_hashes(), blender::fn::MFNetwork::find_dependencies(), and blender::tests::TEST().
|
inline |
Returns the number of elements in the stack.
Definition at line 329 of file BLI_stack.hh.
Referenced by blender::tests::TEST().