#include <boost/json/memory_resource.hpp>
#include <boost/json/monotonic_resource.hpp>
#include <boost/json/value.hpp>
-
-#ifndef BOOST_JSON_STANDALONE
#include <boost/container/pmr/vector.hpp>
-#endif
#include <vector>
#include "test_suite.hpp"
void
testBoostPmr()
{
-#ifndef BOOST_JSON_STANDALONE
using allocator_type =
polymorphic_allocator<value>;
std::vector<value, allocator_type> v2(3, {}, a);
BOOST_TEST(v2[1].storage().get() == &mr);
}
-#endif
- }
-
- void
- testStdPmr()
- {
-#ifdef BOOST_JSON_STANDALONE
- using allocator_type =
- std::pmr::polymorphic_allocator<value>;
-
- // pass polymorphic_allocator
- // where storage_ptr is expected
- {
- value jv( allocator_type{} );
- object o( allocator_type{} );
- array a( allocator_type{} );
- string s( allocator_type{} );
- }
- {
- monotonic_resource mr;
- allocator_type a(&mr);
-
- std::vector<value, allocator_type> v2(3, {}, a);
- BOOST_TEST(v2[1].storage().get() == &mr);
- }
-#endif
}
// These are here instead of the type-specific
run()
{
testBoostPmr();
- testStdPmr();
testPmr();
}
};