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
Init.c:84:
typedef Graph(Str) StrGraph;
StrGraph graph = GraphInitWithDeepCopy(str_init_copy, str_deinit, &alloc);
Str name = StrInitFromZstr("alpha", &alloc);
GraphNodeId node_id;- In
Init.c:109:
typedef Graph(Str) StrGraph;
StrGraph graph = GraphInitWithDeepCopy(NULL, str_deinit, &alloc);
GraphNodeId node_id;
GraphNode node;- In
Init.c:148:
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
Init.c:152:
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);- In
Insert.c:181:
typedef Graph(int) IntGraph;
IntGraph graph = GraphInitWithDeepCopy(flaky_int_copy, NULL, &alloc);
GraphNodeId a = GraphAddNodeR(&graph, 10);- In
Insert.c:217:
typedef Graph(int) IntGraph;
IntGraph graph = GraphInitWithDeepCopy(flaky_int_copy, NULL, &alloc);
GraphNodeId a = GraphAddNodeR(&graph, 10);- In
Insert.c:259:
typedef Graph(int) IntGraph;
IntGraph graph = GraphInitWithDeepCopy(flaky_int_copy, NULL, &dbg);
// Pre-reserve so the failing add appends a slot WITHOUT reallocating the
- In
Insert.c:297:
typedef Graph(int) IntGraph;
IntGraph graph = GraphInitWithDeepCopy(flaky_int_copy, NULL, &dbg);
GraphNodeId a = GraphAddNodeR(&graph, 10);- In
Foreach.c:83:
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