From 2ff2e106606b4a40229e9bd17d2d972b127a907b Mon Sep 17 00:00:00 2001 From: Niels Date: Fri, 5 Feb 2016 22:30:37 +0100 Subject: [PATCH] checking Erasable concept --- test/unit.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/unit.cpp b/test/unit.cpp index fc77fe28..e94bb980 100644 --- a/test/unit.cpp +++ b/test/unit.cpp @@ -10767,6 +10767,24 @@ TEST_CASE("concepts") // the expression "X()" has the post-condition "X().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::destroy(m, p); + + CHECK(*p == "foo"); + + // cleanup + m.deallocate(p, 1); + } } SECTION("class json")