add default ctor noexcept

This commit is contained in:
2019-05-10 10:06:14 +07:00
parent 519abd69a4
commit 47b24bb0ad
8 changed files with 76 additions and 8 deletions

View File

@@ -73,7 +73,8 @@ namespace
template < typename T >
class dummy_less {
public:
dummy_less(int i) : i(i) {}
dummy_less() = default;
dummy_less(int i) noexcept : i(i) {}
bool operator()(const T& l, const T& r) const {
return l < r;
}
@@ -95,6 +96,20 @@ TEST_CASE("flat_multimap") {
};
REQUIRE(sizeof(vc) == sizeof(int));
}
SECTION("noexcept") {
using alloc_t = dummy_allocator<std::pair<int,unsigned>>;
using map_t = flat_multimap<int, unsigned, dummy_less<int>, std::vector<std::pair<int,unsigned>, alloc_t>>;
static_assert(
std::is_nothrow_default_constructible<map_t>::value,
"unit test static error");
static_assert(
std::is_nothrow_move_constructible<map_t>::value,
"unit test static error");
static_assert(
std::is_nothrow_move_assignable<map_t>::value,
"unit test static error");
}
SECTION("types") {
using map_t = flat_multimap<int, unsigned>;