Documentation ¶
Overview ¶
Package stack provides a stack datatype built using a resized slice.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Stack ¶
type Stack[T any] struct { // contains filtered or unexported fields }
Stack is a stack using a resized slice to store its elements.
The zero value for a Stack is an empty stack ready to use.
func (*Stack[T]) Clone ¶
Clone clones the stack, returning a Stack with a copy of the underlying slice.
func (*Stack[T]) Peek ¶
func (s *Stack[T]) Peek() T
Peek returns the element at the top of the stack without removing it.
If the stack is of length 0, Peek will panic.
Click to show internal directories.
Click to hide internal directories.