GraphInitWithDeepCopy
Description
Initialize an empty deep-copy Graph. ci is invoked on every push to clone the payload into graph-owned storage; cd is invoked on remove/clear/deinit to release that storage.
Parameters
| Name | Direction | Description |
|---|---|---|
ci |
in | GenericCopyInit callback (may be NULL for bitwise copy). |
cd |
in | GenericCopyDeinit callback (may be NULL when ci is NULL). |
typed_alloc_ptr |
in | Typed allocator handle, optional inside Scope. |
Success
Returns a live, empty deep-copy graph wired to the supplied callbacks.
Failure
Cannot fail at construction; allocation failures surface from later inserts.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Graph.Init.c:79:
typedef Graph(Str) StrGraph;
StrGraph graph = GraphInitWithDeepCopy(str_init_copy, str_deinit, &alloc);
Str name = StrInitFromZstr("alpha", &alloc);
GraphNodeId node_id;- In
Graph.Init.c:104:
typedef Graph(Str) StrGraph;
StrGraph graph = GraphInitWithDeepCopy(NULL, str_deinit, &alloc);
GraphNodeId node_id;
GraphNode node;- In
Graph.Init.c:143:
StrGraph graph_a = GraphInit(&alloc);
StrGraph graph_b = GraphInitT(graph_b, &alloc);
StrGraph graph_c = GraphInitWithDeepCopy(str_init_copy, str_deinit, &alloc);
StrGraph graph_d = GraphInitWithDeepCopyT(graph_d, str_init_copy, str_deinit, &alloc);
StrGraph graph_e = GraphInit(&aligned_8);- In
Graph.Init.c:147:
StrGraph graph_e = GraphInit(&aligned_8);
StrGraph graph_f = GraphInitT(graph_f, &aligned_16);
StrGraph graph_g = GraphInitWithDeepCopy(str_init_copy, str_deinit, &aligned_32);
StrGraph graph_h = GraphInitWithDeepCopyT(graph_h, str_init_copy, str_deinit, &aligned_64); DefaultAllocator alloc = DefaultAllocatorInit();
CityGraph graph = GraphInitWithDeepCopy(NULL, str_deinit, &alloc);
CityIndex index = MapInitWithDeepCopy(str_hash, str_compare, str_init_copy, str_deinit, NULL, NULL, &alloc);
Last updated on