MCPcopy Create free account
hub / github.com/boostorg/json / set1

Function set1

test/doc_storage_ptr.cpp:25–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23//----------------------------------------------------------
24
25static void set1() {
26
27//----------------------------------------------------------
28{
29// tag::doc_storage_ptr_1[]
30storage_ptr sp1;
31storage_ptr sp2;
32
33assert( sp1.get() != nullptr ); // always points to a valid resource
34assert( sp1.get() == sp2.get() ); // both point to the default resource
35assert( *sp1.get() == *sp2.get() ); // the default resource compares equal
36// end::doc_storage_ptr_1[]
37}
38//----------------------------------------------------------
39{
40// tag::doc_storage_ptr_2[]
41array arr; // default construction
42object obj;
43string str;
44value jv;
45
46assert( jv.storage().get() == storage_ptr().get() ); // uses the default memory resource
47assert( jv.storage().get() == arr.storage().get() ); // both point to the default resource
48assert( *arr.storage() == *obj.storage() ); // containers use equivalent resources
49// end::doc_storage_ptr_2[]
50}
51//----------------------------------------------------------
52{
53// tag::doc_storage_ptr_3[]
54monotonic_resource mr;
55
56value const jv = parse( "[1,2,3]", &mr );
57// end::doc_storage_ptr_3[]
58}
59//----------------------------------------------------------
60
61} // set1
62
63//----------------------------------------------------------
64

Callers

nothing calls this directly

Calls 2

storage_ptrClass · 0.50
getMethod · 0.45

Tested by

no test coverage detected