#include #include #include #include TEST(Optional, Emplace) { m5::stl::optional, std::pair>> i; i.emplace(std::piecewise_construct, std::make_tuple(0, 2), std::make_tuple(3, 4)); EXPECT_TRUE(i->first.first == 0); EXPECT_TRUE(i->first.second == 2); EXPECT_TRUE(i->second.first == 3); EXPECT_TRUE(i->second.second == 4); } struct A { A() { throw std::exception(); } }; TEST(Optional, EmplaceWithException) { m5::stl::optional a; EXPECT_ANY_THROW(a.emplace()); }