MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / move_assignment

Function move_assignment

examples/src/pmr_allocator_examples.cpp:129–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129void move_assignment() // assignment
130{
131 char buffer[1024];
132 std::pmr::monotonic_buffer_resource pool{ std::data(buffer), std::size(buffer) };
133 std::pmr::polymorphic_allocator<char> alloc(&pool);
134
135 jsoncons::pmr::json j{ "String too long for short string", alloc };
136 assert(j.is_string());
137 assert(j.get_allocator().resource() == &pool);
138
139 jsoncons::pmr::json j1{ 10 };
140 assert(j1.is_number());
141
142 j1 = std::move(j);
143 assert(j1.is_string());
144 assert(j1.get_allocator().resource() == &pool);
145 assert(j.is_number());
146}
147
148int main()
149{

Callers 1

mainFunction · 0.70

Calls 3

sizeFunction · 0.85
is_stringMethod · 0.80
get_allocatorMethod · 0.45

Tested by

no test coverage detected