1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/datatypes
2023-03-09 14:26:01 +01:00
..
fsm docs: fix typos using codespell (#17332) 2023-02-16 11:43:39 +02:00
bstree_test.v all: replace generic <> with [] - part 2 (#16536) 2022-11-26 18:23:26 +02:00
bstree.v datatypes: change optional to result (#16546) 2022-11-28 10:24:47 +02:00
doubly_linked_list_test.v datatypes: change optional to result (#16546) 2022-11-28 10:24:47 +02:00
doubly_linked_list.v all: replace generic '<>' with '[]' in error messages and comments (#16571) 2022-12-02 09:22:48 +02:00
heap_test.v datatypes: change optional to result (#16546) 2022-11-28 10:24:47 +02:00
heap.v datatypes: change optional to result (#16546) 2022-11-28 10:24:47 +02:00
linked_list_test.v datatypes: fix linked list of map (fix #17570) (#17573) 2023-03-09 14:26:01 +01:00
linked_list.v datatypes: fix linked list of map (fix #17570) (#17573) 2023-03-09 14:26:01 +01:00
quadtree_test.v datatypes: add quadtree, add its demo to examples/ (#16087) 2022-10-18 18:02:44 +03:00
quadtree.v datatypes: add quadtree, add its demo to examples/ (#16087) 2022-10-18 18:02:44 +03:00
queue_test.v datatypes: change optional to result (#16546) 2022-11-28 10:24:47 +02:00
queue.v datatypes: change optional to result (#16546) 2022-11-28 10:24:47 +02:00
README.md all: replace generic <> with [] - part 2 (#16536) 2022-11-26 18:23:26 +02:00
ringbuffer_test.v all: replace generic <> with [] - part 2 (#16536) 2022-11-26 18:23:26 +02:00
ringbuffer.v datatypes: change optional to result (#16546) 2022-11-28 10:24:47 +02:00
set_test.v all: replace generic <> with [] - part 2 (#16536) 2022-11-26 18:23:26 +02:00
set.v all: replace generic '<>' with '[]' in error messages and comments (#16571) 2022-12-02 09:22:48 +02:00
stack_test.v datatypes: change optional to result (#16546) 2022-11-28 10:24:47 +02:00
stack.v datatypes: change optional to result (#16546) 2022-11-28 10:24:47 +02:00

datatypes

This module provides implementations of less frequently used, but still common data types.

V's builtin module is imported implicitly, and has implementations for arrays, maps and strings. These are good for many applications, but there are a plethora of other useful data structures/containers, like linked lists, priority queues, tries, etc, that allow for algorithms with different time complexities, which may be more suitable for your specific application.

It is implemented using generics, that you have to specialise for the type of your actual elements. For example:

import datatypes

mut stack := datatypes.Stack[int]{}
stack.push(1)
println(stack)

Currently Implemented Datatypes:

  • Linked list
  • Doubly linked list
  • Stack (LIFO)
  • Queue (FIFO)
  • Min heap (priority queue)
  • Set
  • Quadtree
  • ...