The eltype
method is used to get the type of items of the CircularDeque
object.
Note: The
CircularDeque object
object is a double-ended queue implementation using a circular buffer of fixed capacity (while creating the deque, the capacity should be provided). It supports insertion and deletion on both ends.
eltype!deque_object)
This method takes a CircularDeque
object and the values to be inserted as arguments.
This method returns the data type of the elements of the CircularDeque
object.
using DataStructures #create a new CircularDeque object for 5 elements deque = CircularDeque{Int}(5); push!(deque,2); push!(deque, 3); push!(deque, 4); println("\nDeque -> $(deque)") # print the data type of the elements of the deque println("\nDeque -> $(eltype(deque))")
CircularDeque
object with the name, deque
. For this object, we set the capacity as 5
, meaning it can hold 5 elements. Also, we set the elements of deque
to be an integer datatype.2
,3
, and 4
, to deque
using the push!
method.eltype
method to get the datatype of the deque
elements. We get Int64
as a result.RELATED TAGS
CONTRIBUTOR
View all Courses