MT Core (C++)
Core library for replacing C++ standard in project usage
|
Collection of data structures and collections. More...
Namespaces | |
namespace | mtcore |
Core library for C++ with Zig-related functionality. | |
namespace | mtcore::slices |
Additional algorithms that can be performed on slices, such as comparisons, searching, etc. | |
namespace | mtcore::iter |
Generic iterator defaults built on common contracts Does not guarantee performance of iterators Actual performance is \(O(N * complexityOfOperator[])\) IE an operator[] with \(O(1)\) will get an iterator complexity of \(O(N)\), while an operator[] with \(O(N)\) will get an iterator complexity of \(O(N^2)\). | |
Classes | |
struct | mtcore::ArrayList< T > |
Array list is a growable, dynamic array with elements inside Elements are stored in an array, and are copied when resizing needs to happen Accessing elements is \(O(1)\) Adding elements is worst case \(O(N)\) Removing elements while preserving order is \(O(N)\) Removing elements while not preserving order is \(O(1)\). More... | |
struct | mtcore::Bitset |
Represents a bitset with dynamically allocated memory (using an mtcore allocator) Allows operating on an arbitrary number of bits. More... | |
struct | mtcore::Bitset2D |
Represents a bitset with dynamically allocated memory (using an mtcore allocator) Allows operating on an arbitrary number of bits. More... | |
struct | mtcore::BitsetFixed< NumBits > |
Represents a bitset with dynamically allocated memory (using an mtcore allocator) Allows operating on an arbitrary number of bits. More... | |
struct | mtcore::Handle |
Handle to an item in the list. More... | |
struct | mtcore::GenList< T > |
Represents a generational list where removed items are marked and recycled. More... | |
struct | mtcore::PtrIter< T > |
Iterator that gives pointers to elements of a collection. More... | |
struct | mtcore::ConstPtrIter< T > |
Iterator that gives const pointers to elements of a collection. More... | |
struct | mtcore::ValIter< T > |
Iterator that gives copies of elements of a collection. More... | |
struct | mtcore::Optional< T > |
Represents a value that may or may not exist (an "Optional" value) Similar concept to std::optional, but different implementation and additional nicety methods which makes this a better alternative for simple loop-based iteration (via copy_if_present and move_if_present) More... | |
struct | mtcore::Optional< T * > |
Represents a pointer that may or may not be null. More... | |
struct | mtcore::Nullopt |
Placeholder value for any empty Optional (similar to std::nullopt) More... | |
struct | mtcore::Queue< T > |
FIFO Queue (First In, First Out) Dynamically allocated, can be resized. More... | |
struct | mtcore::FixedQueue< T, Capacity > |
Statically allocated FIFO queue with fixed maximum capacity. More... | |
struct | mtcore::RingBuffer< T > |
Represents a ring buffer with dynamically allocated memory Can be used as a FIFO or LIFO queue Allows memory reuse rather than continuous memory allocations as it is used May be dynamically resized. More... | |
struct | mtcore::FixedRingBuffer< T, Capacity > |
Represents a ring buffer with static memory allocation Can be used as a FIFO or LIFO queue Allows memory reuse by wrapping pointers Cannot be dynamically resized. More... | |
struct | mtcore::SegmentedList< T > |
Segmented list where each segment contains multiple nodes Allows growing the list without having to invalidate all previous memory addresses. More... | |
struct | mtcore::Slice< T > |
A Slice which is just a pointer + length Accessing elements through the array operator will do bounds checks Accessing out of bounds will terminate the program instead of throw Can also get sub slices. More... | |
Functions | |
template<typename T> | |
PtrIter< T > | mtcore::iter::ptr (T &r) |
Generic pointer iterator that uses the operator[] and incrementing indexes to iterate over a collection Returns pointers to elements inside the collection (can be modified) | |
template<typename T> | |
ValIter< T > | mtcore::iter::val (const T &r) |
Generic value iterator that uses the operator[] and incrementing indexes to iterate over a collection Does copies when iterating`. | |
template<typename T> | |
ConstPtrIter< T > | mtcore::iter::const_ptr (const T &r) |
Generic constant pointer iterator that uses the operator[] and incrementing indexes to iterate over a collection Returns constant pointers to elements inside the collection (cannot be modified) Useful for reads while avoiding copies. | |
constexpr Slice< char32_t > | mtcore::mut_slice_from (char32_t *cstr, size_t len) |
Creates a mutable slice from a utf32 string and length. | |
constexpr Slice< char32_t > | mtcore::mut_slice_from (char32_t *cstr) |
Creates a mutable slice from a utf32 string in the form of a c string. | |
constexpr Slice< const char32_t > | mtcore::slice_from (char32_t *cstr) |
Creates a slice from a utf32 string in the form of a c string. | |
constexpr Slice< const char32_t > | mtcore::slice_from (char32_t *cstr, size_t len) |
Creates a slice from a utf32 string and length. | |
constexpr Slice< const char32_t > | mtcore::slice_from (const char32_t *cstr, size_t len) |
Creates a slice from a utf32 string and length. | |
constexpr Slice< const char32_t > | mtcore::slice_from (const char32_t *cstr) |
Creates a slice from a utf32 string in the form of a c string. | |
constexpr Slice< char16_t > | mtcore::mut_slice_from (char16_t *cstr, size_t len) |
Creates a mutable slice from a utf16 string and length. | |
constexpr Slice< const char16_t > | mtcore::slice_from (char16_t *cstr, size_t len) |
Creates a slice from a utf16 string and length. | |
constexpr Slice< const char16_t > | mtcore::slice_from (const char16_t *cstr, size_t len) |
Creates a slice from a utf16 string and length. | |
constexpr Slice< char8_t > | mtcore::mut_slice_from (char8_t *cstr, size_t len) |
Creates a mutable slice from a utf8 string and length. | |
constexpr Slice< const char8_t > | mtcore::slice_from (char8_t *cstr, size_t len) |
Creates a slice from a utf8 string and length. | |
constexpr Slice< const char8_t > | mtcore::slice_from (const char8_t *cstr, size_t len) |
Creates a slice from a utf8 string and length. | |
constexpr Slice< char16_t > | mtcore::mut_slice_from (char16_t *cstr) |
Creates a mutable slice from a utf16 string in the form of a c string. | |
constexpr Slice< const char16_t > | mtcore::slice_from (char16_t *cstr) |
Creates a slice from a utf16 string in the form of a c string. | |
constexpr Slice< const char16_t > | mtcore::slice_from (const char16_t *cstr) |
Creates a slice from a utf16 string in the form of a c string. | |
constexpr Slice< char8_t > | mtcore::mut_slice_from (char8_t *cstr) |
Creates a mutable slice from a utf8 string in the form of a c string. | |
constexpr Slice< const char8_t > | mtcore::slice_from (char8_t *cstr) |
Creates a slice from a utf8 string in the form of a c string. | |
constexpr Slice< const char8_t > | mtcore::slice_from (const char8_t *cstr) |
Creates a slice from a utf8 string in the form of a c string. | |
constexpr Slice< const char > | mtcore::slice_from (char *cstr) |
Creates a slice from a string in the form of a c string. | |
constexpr Slice< const char > | mtcore::slice_from (const char *cstr) |
Creates a slice from a string in the form of a c string. | |
constexpr Slice< const char > | mtcore::slice_from (char *cstr, const size_t len) |
Creates a slice from a string with a length. | |
constexpr Slice< char > | mtcore::mut_slice_from (char *cstr, const size_t len) |
Creates a mutable slice from a string with a length. | |
constexpr Slice< const char > | mtcore::slice_from (const char *cstr, const size_t len) |
Creates a slice from a string with a length. | |
Slice< const char > | mtcore::slice_from (const std::string &str) |
Creates a slice from a std::string. | |
constexpr Slice< const char > | mtcore::slice_from (const std::string_view &sv) |
Creates a slice from a std::string_view. | |
template<typename T> | |
Slice< std::add_const_t< T > > | mtcore::slice_from (const std::vector< T > &arr) |
Creates a slice from a vector. | |
template<typename T> | |
Slice< T > | mtcore::mut_slice_from (std::vector< T > &arr) |
Creates a mutable slice from a vector. | |
template<typename T, size_t N> | |
constexpr Slice< std::add_const_t< T > > | mtcore::slice_from (const std::array< T, N > &arr) |
Creates a slice from an array. | |
template<typename T, size_t N> | |
constexpr Slice< T > | mtcore::mut_slice_from (std::array< T, N > &arr) |
Creates a mutable slice from an array. | |
Slice< char > | mtcore::mut_slice_from (char *cstr) |
Creates a mutable slice from a c string. | |
Slice< char > | mtcore::mut_slice_from (std::string &str) |
Creates a mutable slice from a string. | |
template<typename T> | |
bool | mtcore::slices::starts_with (const Slice< T > &needle, const Slice< T > &haystack) |
Checks whether a slice (the haystack) starts with elements in another slice in the same order (the needle) - \(O(N)\) Uses the equality operator of the underlying type E.g. | |
template<typename T> | |
bool | mtcore::slices::starts_with (const std::remove_const_t< T > &needle, const Slice< T > &haystack) |
Checks whether a slice (the haystack) starts with a specific element (the needle) - \(O(N)\) Uses the equality operator of the underlying type E.g. | |
template<typename T> | |
bool | mtcore::slices::contains (const std::remove_const_t< T > &needle, const Slice< T > &haystack) |
Checks whether a slice (the haystack) contains an element (the needle) Uses the equality operator of the underlying type E.g. | |
template<typename T> | |
bool | mtcore::slices::contains (const Slice< T > &needle, const Slice< T > &haystack) |
Checks whether a slice (the haystack) contains elements in another slice in the same order (the needle) - \(O(N^2)\) Uses the equality operator of the underlying type E.g. | |
template<typename T> | |
mtcore::Optional< size_t > | mtcore::slices::first_index_not_proceeded_by (const std::remove_const_t< T > &prefix, const std::remove_const_t< T > &needle, const Slice< T > &haystack) |
Gets the first index that a needle appears in the haystack, or nullopt if the needle does not appear - \(O(N^2)\) Uses the equality operator of the underlying type. | |
template<typename T> | |
mtcore::Optional< size_t > | mtcore::slices::first_index_not_proceeded_by (const std::remove_const_t< T > &prefix, const Slice< T > &needle, const Slice< T > &haystack) |
Gets the first index that a needle appears in the haystack, or nullopt if the needle does not appear - \(O(N^2)\) Uses the equality operator of the underlying type. | |
template<typename T> | |
mtcore::Optional< size_t > | mtcore::slices::first_index (const Slice< T > &needle, const Slice< T > &haystack) |
Gets the first index that a needle appears in the haystack, or nullopt if the needle does not appear - \(O(N^2)\) Uses the equality operator of the underlying type. | |
template<typename T> | |
mtcore::Optional< size_t > | mtcore::slices::first_index_not (const std::remove_const_t< T > &needle, const Slice< T > &haystack) |
Gets the first index that a needle appears in the haystack, or nullopt if the needle does not appear - \(O(N^2)\) Uses the equality operator of the underlying type. | |
template<typename T> | |
mtcore::Optional< size_t > | mtcore::slices::first_index (const std::remove_const_t< T > &needle, const Slice< T > &haystack) |
Gets the first index that a needle appears in the haystack, or nullopt if the needle does not appear - \(O(N^2)\) Uses the equality operator of the underlying type. | |
template<typename T> | |
mtcore::Optional< size_t > | mtcore::slices::last_index (const Slice< T > &needle, const Slice< T > &haystack) |
Gets the last index that a needle appears in the haystack, or nullopt if the needle does not appear - \(O(N^2)\) Uses the equality operator of the underlying type. | |
template<typename T> | |
mtcore::Optional< size_t > | mtcore::slices::last_index (const std::remove_const_t< T > &needle, const Slice< T > &haystack) |
Gets the last index that a needle appears in the haystack, or nullopt if the needle does not appear - \(O(N^2)\) Uses the equality operator of the underlying type. | |
template<typename T> | |
SearchIndexes< T, Slice< T > > | mtcore::slices::indexes_of (const Slice< T > &needle, const Slice< T > &haystack) |
Returns an iterator of all indexes of occurrences of a needle in a haystack If the needle isn't present, will return an empty iterator. | |
template<typename T> | |
SearchIndexes< T, std::remove_const_t< T > > | mtcore::slices::indexes_of (const std::remove_const_t< T > &needle, const Slice< T > &haystack) |
Returns an iterator of all indexes of occurrences of a needle in a haystack If the needle isn't present, will return an empty iterator. | |
template<typename T> | |
SplitIter< T, Slice< T > > | mtcore::slices::split (const Slice< T > &needle, const Slice< T > &haystack) |
Splits a slice into smaller sub slices. | |
template<typename T> | |
SplitIter< T, std::remove_const_t< T > > | mtcore::slices::split (const std::remove_const_t< T > &needle, const Slice< T > &haystack) |
Splits a slice into smaller sub slices. | |
Variables | |
constexpr auto | mtcore::nullopt = Nullopt{} |
Placeholder value for an empty Optional. | |
Collection of data structures and collections.
ConstPtrIter< T > mtcore::iter::const_ptr | ( | const T & | r | ) |
Generic constant pointer iterator that uses the operator[] and incrementing indexes to iterate over a collection Returns constant pointers to elements inside the collection (cannot be modified) Useful for reads while avoiding copies.
T | Collection type to iterate over |
r | Collection to iterate over |
Definition at line 128 of file iter.hpp.
bool mtcore::slices::contains | ( | const Slice< T > & | needle, |
const Slice< T > & | haystack ) |
Checks whether a slice (the haystack) contains elements in another slice in the same order (the needle) - \(O(N^2)\) Uses the equality operator of the underlying type E.g.
"hello" contains "ll", so this would return true E.g. "hello" does not contain with "wo", so this would return false
T | Element stored in slice |
needle | Needle to check for |
haystack | Haystack to search in |
Definition at line 120 of file slice_algo.hpp.
bool mtcore::slices::contains | ( | const std::remove_const_t< T > & | needle, |
const Slice< T > & | haystack ) |
Checks whether a slice (the haystack) contains an element (the needle) Uses the equality operator of the underlying type E.g.
"hello" contains 'l', so this would return true E.g. "hello" does not contain with 'w', so this would return false
T | Element stored in slice |
needle | Needle to check for |
haystack | Haystack to search in |
Definition at line 98 of file slice_algo.hpp.
mtcore::Optional< size_t > mtcore::slices::first_index | ( | const Slice< T > & | needle, |
const Slice< T > & | haystack ) |
Gets the first index that a needle appears in the haystack, or nullopt if the needle does not appear - \(O(N^2)\) Uses the equality operator of the underlying type.
T | Element stored in slice |
needle | Needle to check for |
haystack | Haystack to search in |
Definition at line 228 of file slice_algo.hpp.
mtcore::Optional< size_t > mtcore::slices::first_index | ( | const std::remove_const_t< T > & | needle, |
const Slice< T > & | haystack ) |
Gets the first index that a needle appears in the haystack, or nullopt if the needle does not appear - \(O(N^2)\) Uses the equality operator of the underlying type.
T | Element stored in slice |
needle | Needle to check for |
haystack | Haystack to search in |
Definition at line 285 of file slice_algo.hpp.
mtcore::Optional< size_t > mtcore::slices::first_index_not | ( | const std::remove_const_t< T > & | needle, |
const Slice< T > & | haystack ) |
Gets the first index that a needle appears in the haystack, or nullopt if the needle does not appear - \(O(N^2)\) Uses the equality operator of the underlying type.
T | Element stored in slice |
needle | Needle to check for |
haystack | Haystack to search in |
Definition at line 262 of file slice_algo.hpp.
mtcore::Optional< size_t > mtcore::slices::first_index_not_proceeded_by | ( | const std::remove_const_t< T > & | prefix, |
const Slice< T > & | needle, | ||
const Slice< T > & | haystack ) |
Gets the first index that a needle appears in the haystack, or nullopt if the needle does not appear - \(O(N^2)\) Uses the equality operator of the underlying type.
T | Element stored in slice |
needle | Needle to check for |
haystack | Haystack to search in |
Definition at line 185 of file slice_algo.hpp.
mtcore::Optional< size_t > mtcore::slices::first_index_not_proceeded_by | ( | const std::remove_const_t< T > & | prefix, |
const std::remove_const_t< T > & | needle, | ||
const Slice< T > & | haystack ) |
Gets the first index that a needle appears in the haystack, or nullopt if the needle does not appear - \(O(N^2)\) Uses the equality operator of the underlying type.
T | Element stored in slice |
needle | Needle to check for |
haystack | Haystack to search in |
Definition at line 154 of file slice_algo.hpp.
SearchIndexes< T, Slice< T > > mtcore::slices::indexes_of | ( | const Slice< T > & | needle, |
const Slice< T > & | haystack ) |
Returns an iterator of all indexes of occurrences of a needle in a haystack If the needle isn't present, will return an empty iterator.
T | Elements to iterate |
needle | Needle to search for |
haystack | Haystack to search ; |
Definition at line 385 of file slice_algo.hpp.
SearchIndexes< T, std::remove_const_t< T > > mtcore::slices::indexes_of | ( | const std::remove_const_t< T > & | needle, |
const Slice< T > & | haystack ) |
Returns an iterator of all indexes of occurrences of a needle in a haystack If the needle isn't present, will return an empty iterator.
T | Elements to iterate |
needle | Needle to search for |
haystack | Haystack to search ; |
Definition at line 398 of file slice_algo.hpp.
mtcore::Optional< size_t > mtcore::slices::last_index | ( | const Slice< T > & | needle, |
const Slice< T > & | haystack ) |
Gets the last index that a needle appears in the haystack, or nullopt if the needle does not appear - \(O(N^2)\) Uses the equality operator of the underlying type.
T | Element stored in slice |
needle | Needle to check for |
haystack | Haystack to search in |
Definition at line 306 of file slice_algo.hpp.
mtcore::Optional< size_t > mtcore::slices::last_index | ( | const std::remove_const_t< T > & | needle, |
const Slice< T > & | haystack ) |
Gets the last index that a needle appears in the haystack, or nullopt if the needle does not appear - \(O(N^2)\) Uses the equality operator of the underlying type.
T | Element stored in slice |
needle | Needle to check for |
haystack | Haystack to search in |
Definition at line 341 of file slice_algo.hpp.
|
inlinenodiscard |
Creates a mutable slice from a c string.
cstr | C string (must be NULL terminated) |
Definition at line 584 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a mutable slice from a string with a length.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 510 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a mutable slice from a utf16 string in the form of a c string.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 389 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a mutable slice from a utf16 string and length.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 337 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a mutable slice from a utf32 string in the form of a c string.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 277 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a mutable slice from a utf32 string and length.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 268 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a mutable slice from a utf8 string in the form of a c string.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 431 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a mutable slice from a utf8 string and length.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 364 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a mutable slice from an array.
arr | array to create slice from |
Definition at line 575 of file colls/slice.hpp.
|
inlinenodiscard |
Creates a mutable slice from a string.
str | String |
Definition at line 598 of file colls/slice.hpp.
|
nodiscard |
Creates a mutable slice from a vector.
arr | vector to create slice from |
Definition at line 555 of file colls/slice.hpp.
PtrIter< T > mtcore::iter::ptr | ( | T & | r | ) |
Generic pointer iterator that uses the operator[] and incrementing indexes to iterate over a collection Returns pointers to elements inside the collection (can be modified)
T | Collection type to iterate over |
r | Collection to iterate over |
Definition at line 101 of file iter.hpp.
|
nodiscardconstexpr |
Creates a slice from a string in the form of a c string.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 473 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a string with a length.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 501 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a utf16 string in the form of a c string.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 403 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a utf16 string and length.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 346 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a utf32 string in the form of a c string.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 291 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a utf32 string and length.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 305 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a utf8 string in the form of a c string.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 445 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a utf8 string and length.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 371 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a string in the form of a c string.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 487 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a string with a length.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 517 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a utf16 string in the form of a c string.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 417 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a utf16 string and length.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 355 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a utf32 string in the form of a c string.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 323 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a utf32 string and length.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 314 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a utf8 string in the form of a c string.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 459 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a utf8 string and length.
cstr | C string to create slice from (must be NULL terminated) |
Definition at line 380 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from an array.
arr | array to create slice from |
Definition at line 565 of file colls/slice.hpp.
|
inlinenodiscard |
Creates a slice from a std::string.
str | string to create slice from |
Definition at line 526 of file colls/slice.hpp.
|
nodiscardconstexpr |
Creates a slice from a std::string_view.
sv | string to create slice from |
Definition at line 535 of file colls/slice.hpp.
|
nodiscard |
Creates a slice from a vector.
arr | array to create slice from |
Definition at line 545 of file colls/slice.hpp.
SplitIter< T, Slice< T > > mtcore::slices::split | ( | const Slice< T > & | needle, |
const Slice< T > & | haystack ) |
Splits a slice into smaller sub slices.
Returns an iterator that iterates over each sub slice. Does NOT return the needle separating each sub slice (so some sub slices may be empty if the needle is sequential)
T | Elements to iterate |
needle | Needle to search for |
haystack | Haystack to search ; |
Definition at line 474 of file slice_algo.hpp.
SplitIter< T, std::remove_const_t< T > > mtcore::slices::split | ( | const std::remove_const_t< T > & | needle, |
const Slice< T > & | haystack ) |
Splits a slice into smaller sub slices.
Returns an iterator that iterates over each sub slice. Does NOT return the needle separating each sub slice (so some sub slices may be empty if the needle is sequential)
T | Elements to iterate |
needle | Needle to search for |
haystack | Haystack to search ; |
Definition at line 487 of file slice_algo.hpp.
bool mtcore::slices::starts_with | ( | const Slice< T > & | needle, |
const Slice< T > & | haystack ) |
Checks whether a slice (the haystack) starts with elements in another slice in the same order (the needle) - \(O(N)\) Uses the equality operator of the underlying type E.g.
"hello" starts with "he", so this would return true E.g. "hello" does not start with "ll", so this would return false
T | Element stored in slice |
needle | Needle to check for |
haystack | Haystack to search in |
Definition at line 40 of file slice_algo.hpp.
bool mtcore::slices::starts_with | ( | const std::remove_const_t< T > & | needle, |
const Slice< T > & | haystack ) |
Checks whether a slice (the haystack) starts with a specific element (the needle) - \(O(N)\) Uses the equality operator of the underlying type E.g.
"hello" starts with 'h', so this would return true E.g. "hello" does not start with 'l', so this would return false
T | Element stored in slice |
needle | Needle to check for |
haystack | Haystack to search in |
Definition at line 80 of file slice_algo.hpp.
ValIter< T > mtcore::iter::val | ( | const T & | r | ) |
Generic value iterator that uses the operator[] and incrementing indexes to iterate over a collection Does copies when iterating`.
T | Collection type to iterate over |
r | Collection to iterate over |
Definition at line 114 of file iter.hpp.
|
constexpr |