struct
Pf::Kit::HybridArray(T, N)
- Pf::Kit::HybridArray(T, N)
- Struct
- Value
- Object
Included Modules
- Indexable::Mutable(T)
Defined in:
permafrost/kit/hybrid_array.crConstant Summary
-
INITIAL_SPILL_CAPACITY =
8
Constructors
Instance Method Summary
- #<<(object : T) : Nil
- #clear : Nil
-
#each(& : T -> )
Calls the given block once for each element in
self, passing that element as a parameter. - #inspect(io)
- #pop
- #pop? : T | Nil
- #pretty_print(pp) : Nil
- #push(object : T) : Nil
-
#size : Int32
Returns the number of elements in this container.
-
#to_s(io : IO) : Nil
Same as
#inspect(io). -
#top? : T | Nil
Provides fast access to the top of the stack.
-
#unsafe_fetch(index : Int) : T
Returns the element at the given index, without doing any bounds check.
-
#unsafe_put(index : Int, value : T) : Nil
Sets the element at the given index to value, without doing any bounds check.
- #unsafe_set(object : T)
- #unsafe_top : T
Instance methods inherited from module Enumerable(T)
to_pf_bidi
to_pf_bidi,
to_pf_map(& : T -> Tuple(K, V)) : Pf::Map(K, V) forall K, Vto_pf_map to_pf_map, to_pf_set : Pf::Set(T) to_pf_set, to_pf_uset32 : Pf::USet32 to_pf_uset32
Constructor Detail
Instance Method Detail
Calls the given block once for each element in self, passing that
element as a parameter.
a = ["a", "b", "c"]
a.each { |x| print x, " -- " }
produces:
a -- b -- c --
Returns the number of elements in this container.
Returns the element at the given index, without doing any bounds check.
Indexable makes sure to invoke this method with index in 0...size,
so converting negative indices to positive ones is not needed here.
Clients never invoke this method directly. Instead, they access
elements with #[](index) and #[]?(index).
This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.
Sets the element at the given index to value, without doing any bounds check.
Indexable::Mutable makes sure to invoke this method with index in
0...size, so converting negative indices to positive ones is not needed
here.
Clients never invoke this method directly. Instead, they modify elements
with #[]=(index, value).
This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.