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

Method testBoostPmr

test/memory_resource.cpp:23–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21{
22public:
23 void
24 testBoostPmr()
25 {
26 using allocator_type = container::pmr::polymorphic_allocator<value>;
27
28 // pass polymorphic_allocator
29 // where storage_ptr is expected
30 {
31 monotonic_resource mr;
32 value jv( allocator_type{&mr} );
33 object o( allocator_type{&mr} );
34 array a( allocator_type{&mr} );
35 string s( allocator_type{&mr} );
36 }
37 {
38 monotonic_resource mr;
39 allocator_type a(&mr);
40
41 boost::container::pmr::vector<value> v1(a);
42 v1.resize(3);
43 BOOST_TEST(v1[1].storage().get() == &mr);
44
45 std::vector<value, allocator_type> v2(3, {}, a);
46 BOOST_TEST(v2[1].storage().get() == &mr);
47 }
48 }
49
50 // These are here instead of the type-specific
51 // test TUs, so that we only need to link to

Callers

nothing calls this directly

Calls 2

resizeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected