Exemple #1
0
 void EXPECT_RIGHT_IS(const Expected &expected, either<Left, Right> &value) {
   EXPECT_IS_RIGHT(value);
   EXPECT_EQ(expected, value.right());
   EXPECT_EQ(expected, value.right_opt().get());
   EXPECT_EQ(boost::none, value.left_opt());
   const either<Left, Right> &const_value = value;
   EXPECT_EQ(expected, const_value.right());
   EXPECT_EQ(expected, const_value.right_opt().get());
   EXPECT_EQ(boost::none, const_value.left_opt());
 }
Exemple #2
0
bool operator==(either<Left, Right> const& lhs, either<Left, Right> const& rhs)
{
    if (lhs.is_left() == rhs.is_left())
    {
        if (lhs.is_left()) return lhs.left() == rhs.left();
        else return lhs.right() == rhs.right();
    }
    return false;
}
Exemple #3
0
 void EXPECT_IS_RIGHT(const either<Left,Right> &val) {
   EXPECT_FALSE(val.is_left());
   EXPECT_TRUE(val.is_right());
 }
Exemple #4
0
bool operator==(either<Left, Right> const& lhs, Right const& rhs)
{
    return lhs.is_right() && lhs.right() == rhs;
}
Exemple #5
0
inline bool empty(const either<Types...>& e)
{
    return !(e.which() > 0);    // index 0 is boost::blank, which means it's empty                               
}