Standard Library¶
Auto-generated reference for the Spice standard library. Each page corresponds to one importable module.
data¶
- Binary Tree — A binary tree is a data structure to fasten up search speeds.
- Bitset — A BitSet stores a fixed number of bits in a compact form, packing 64 bits into every machine word.
- Deque — A deque in Spice is a commonly used data structure that allows insertion and removal of elements from both ends: front and back.
- Doubly Linked List — A doubly linked list is a common, dynamically resizable data structure to store uniform data in order.
- Graph — A graph in Spice is a data structure consisting of a set of vertices and a set of edges connecting them.
- Hash Table — A hash table in Spice is a commonly used data structure, which stores key-value pairs and allows fast access to a value by its key.
- Linked List — A linked list is a common, dynamically resizable data structure to store uniform data in order.
- Map — A map in Spice is a commonly used data structure, which can be used to represent a list of key value pairs.
- Optional — Optionals in Spice are wrappers around values, that allow them to be empty.
- Pair — A pair in Spice is a commonly used data structure, which saves two values of arbitrary type together in a correlation
- Priority Queue — A priority queue in Spice is a commonly used data structure, in which every item has a priority attached to it.
- Queue — A queue in Spice is a commonly used data structure, which uses the FiFo (first in, first out) principle.
- Red Black Tree — A Red-Black Tree is a self-balancing search tree, which is used e.g.
- Set — A set in Spice is a commonly used data structure, which can be used to represent a list of unique values.
- Stack — A stack in Spice is a commonly used data structure, which uses the FiLo (first in, last out) principle.
- Trie — A trie (also called prefix tree) is a data structure that stores a set of strings in a way that makes prefix-based lookups efficient.
- Triple — A triple in Spice is a commonly used data structure, which saves three values of arbitrary type together in a correlation
- Unordered Map — An unordered map in Spice is a commonly used data structure, which can be used to represent a list of key value pairs.
- Unordered Set — An unordered set in Spice is a commonly used data structure, which can be used to represent a list of unique values.
- Vector — A vector in Spice is a commonly used data structure, which can be used to represent a list of items.
io¶
- Cli Option — A single command line option of a CLI parser.
- Cli Parser — A command line argument parser.
- Cli Subcommand — A subcommand of a CLI parser.
- Dir — Creates an empty directory at the specified path, with the specified mode.
- File — A handle to an open file, wrapping the underlying C file pointer and tracking the end-of-file state
- Filepath — Represents a path to a file or directory on the local file system
- Logging — A log file that writes timestamped log messages to a file on disk and, optionally, also mirrors them to the console.
iterator¶
- Array Iterator — An ArrayIterator in Spice can be used to iterate over an arbitrary array
- Iterable — The IIterable interface must be implemented in order to be handled as a data structure that can be iterated over by Spice.
- Iterator — The IIterator interface must be implemented in order to be handled as an iterator by Spice.
- Number Iterator — A NumberIterator in Spice can be used to iterate over a range of numbers
math¶
- Fct — Calculate absolute value of the input
- Hash — Hash primitive numeric type
- Rand — Generates a random integer between min and max Note: Both min and max are inclusive: [min, max] Note: If min > max, the function always returns max
net¶
- Http — Struct, representing a simple HTTP server
- Socket — A network socket, wrapping the listening socket file descriptor and the current connection
os¶
- Allocator — An offset allocator that hands out regions from a fixed-size storage area using binned free lists.
- Atomic — A wrapper that guards a value of arbitrary type with a mutex, so it can be read and updated safely from multiple threads.
- Cmd — Retrieve the process id of the current process.
- Cpu — Causes the calling thread to relinquish the CPU.
- Env — Returns the content of an environment variable as string.
- Filesystem — Retrieve the path to the system's temporary directory
- Mutex — Mutex for reserving a resource for exclusive access between threads.
- Os — Check if the current operating system is Linux
- System — Returns the number of CPU cores of the host system.
- Thread — Lightweight thread, that uses posix threads (pthread) under the hood.
- Thread Pool — A thread pool that can be used to run multiple jobs in parallel.
runtime¶
- Error Rt — This is the generalized error type in Spice and part of the error handling mechanism.
- Memory Rt — Allocates a new block of memory of the given size.
- Result Rt — Result in Spice are wrappers around values, that allow to either provide a value or an error object.
- Rtti Rt — TypeInfo is a type that contains the name of a type.
- String Rt — Heap-allocated builtin String type to enable dynamic modification in contrast to the primitive string type.
test¶
- Assertions — Assert that the given condition is true
- Bench — Returns the input value as output
- Lifetime Object — Object that prints to cout when one of its lifetime methods is called.
text¶
- Analysis — Checks if the given character is a whitespace
- Csv Parser — Parser for CSV (comma-separated values) input.
- Format — Returns the given char as upper case version
- Json Parser — Recursive-descent JSON parser.
- Print — Print the given string to the console
- String Ext — Split the given input string by the given delimiter
- Stringstream — Helper data structure to construct strings.
- Xml Parser — Recursive-descent XML parser.
time¶
- Datetime — Calendar representation of a point in time in UTC.
- Delay — Suspends the execution for the given number of milliseconds
- Time — Retrieve seconds since epoch
- Timer — High resolution timer
type¶
- Any — Any is a type-erased container that can hold a value of an arbitrary type.
- Int — Check if an int is a power of two
- Lambda — Lambda is an owning wrapper around a native lambda value.
- Long — Check if a long is a power of two
- Short — Check if a short is a power of two
- Type Conversion — Convert an int to a double
- Types