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