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

Function main

example/use_allocator.cpp:68–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68int
69main(int, char**)
70{
71
72 value const jv = { 1, 2, 3, 4, 5, 6, 7, 8 };
73
74 unsigned char buf[1024];
75 pmr::monotonic_buffer_resource mr( buf, sizeof(buf) );
76
77 auto v = value_to< pmr::vector<int> >(
78 jv,
79 use_allocator( pmr::polymorphic_allocator<int>(&mr) ) );
80
81 assert( v.size() == jv.as_array().size() );
82
83 for( auto i = 0u; i < v.size(); ++i )
84 assert( v[i] == jv.at(i).to_number<int>() );
85
86 return EXIT_SUCCESS;
87}
88
89// end::example_use_allocator[]

Callers

nothing calls this directly

Calls 2

use_allocatorFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected