| 26 | } |
| 27 | |
| 28 | void copy_construction() |
| 29 | { |
| 30 | char buffer[1024]; |
| 31 | std::pmr::monotonic_buffer_resource pool{ std::data(buffer), std::size(buffer) }; |
| 32 | std::pmr::polymorphic_allocator<char> alloc(&pool); |
| 33 | |
| 34 | jsoncons::pmr::json j{ "String too long for short string", alloc }; |
| 35 | assert(j.is_string()); |
| 36 | assert(j.get_allocator().resource() == &pool); |
| 37 | |
| 38 | jsoncons::pmr::json j1(j); |
| 39 | assert(j1 == j); |
| 40 | assert(j1.get_allocator() == std::allocator_traits<std::pmr::polymorphic_allocator<char>>:: |
| 41 | select_on_container_copy_construction(j.get_allocator())); |
| 42 | assert(j1.get_allocator() == std::pmr::polymorphic_allocator<char>{}); // expected result for pmr allocators |
| 43 | } |
| 44 | |
| 45 | void allocator_extended_copy_construction() // extended copy |
| 46 | { |
no test coverage detected