mirror of
https://github.com/nlohmann/json.git
synced 2024-08-25 06:17:02 +02:00
checking Erasable concept
This commit is contained in:
parent
ae5bd307a2
commit
2ff2e10660
|
@ -10767,6 +10767,24 @@ TEST_CASE("concepts")
|
||||||
|
|
||||||
// the expression "X()" has the post-condition "X().empty()"
|
// the expression "X()" has the post-condition "X().empty()"
|
||||||
CHECK(json().empty());
|
CHECK(json().empty());
|
||||||
|
|
||||||
|
|
||||||
|
// from http://en.cppreference.com/w/cpp/concept/Container:
|
||||||
|
// T must be Eraseable
|
||||||
|
{
|
||||||
|
// prepare
|
||||||
|
auto m = json::get_allocator();
|
||||||
|
json* p = m.allocate(1);
|
||||||
|
m.construct(p, "foo");
|
||||||
|
|
||||||
|
// required
|
||||||
|
std::allocator_traits<json::allocator_type>::destroy(m, p);
|
||||||
|
|
||||||
|
CHECK(*p == "foo");
|
||||||
|
|
||||||
|
// cleanup
|
||||||
|
m.deallocate(p, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("class json")
|
SECTION("class json")
|
||||||
|
|
Loading…
Reference in a new issue