Commit bcf360a9 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Sara Golemon

instance Eq Unit

Summary: [Folly] instance Eq Unit

    Unit::operator==(const Unit&)
    Unit::operator!=(const Unit&)

Reviewed By: @Gownta

Differential Revision: D2179384
parent 7f22ad99
......@@ -29,6 +29,8 @@ struct Unit {
template <class T> struct Lift : public std::false_type {
using type = T;
};
bool operator==(const Unit& other) const { return true; }
bool operator!=(const Unit& other) const { return false; }
};
// Lift void into Unit.
......
......@@ -26,6 +26,14 @@ TEST(Unit, futureDefaultCtor) {
Future<Unit>();
}
TEST(Unit, operatorEq) {
EXPECT_TRUE(Unit{} == Unit{});
}
TEST(Unit, operatorNe) {
EXPECT_FALSE(Unit{} != Unit{});
}
TEST(Unit, voidOrUnit) {
EXPECT_TRUE(is_void_or_unit<void>::value);
EXPECT_TRUE(is_void_or_unit<Unit>::value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment