mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Add "is_initialized" to check if a map has been initialized.
This commit is contained in:
@@ -45,6 +45,17 @@ fn void HashMap.tinit(HashMap* map, uint capacity = DEFAULT_INITIAL_CAPACITY, fl
|
|||||||
map.init(capacity, load_factor, mem::temp());
|
map.init(capacity, load_factor, mem::temp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has this hash map been initialized yet?
|
||||||
|
*
|
||||||
|
* @param [&in] map "The hash map we are testing"
|
||||||
|
* @return "Returns true if it has been initialized, false otherwise"
|
||||||
|
**/
|
||||||
|
fn bool HashMap.is_initialized(HashMap* map)
|
||||||
|
{
|
||||||
|
return map.allocator != null;
|
||||||
|
}
|
||||||
|
|
||||||
fn void HashMap.init_from_map(HashMap* map, HashMap* other_map, Allocator* using = mem::heap())
|
fn void HashMap.init_from_map(HashMap* map, HashMap* other_map, Allocator* using = mem::heap())
|
||||||
{
|
{
|
||||||
map.init(other_map.table.len, other_map.load_factor, using);
|
map.init(other_map.table.len, other_map.load_factor, using);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define COMPILER_VERSION "0.4.508"
|
#define COMPILER_VERSION "0.4.509"
|
||||||
Reference in New Issue
Block a user