Make relational operators constexpr; add test/variant_eq_ne_cx.cpp

This commit is contained in:
Peter Dimov
2019-03-06 00:26:55 +02:00
parent e5e09c1c04
commit 204bcce9df
3 changed files with 105 additions and 4 deletions

View File

@ -1562,7 +1562,7 @@ template<class... T> struct eq_L
variant<T...> const & v;
variant<T...> const & w;
template<class I> bool operator()( I i ) const
template<class I> constexpr bool operator()( I i ) const
{
return v._get_impl( i ) == w._get_impl( i );
}
@ -1583,7 +1583,7 @@ template<class... T> struct ne_L
variant<T...> const & v;
variant<T...> const & w;
template<class I> bool operator()( I i ) const
template<class I> constexpr bool operator()( I i ) const
{
return v._get_impl( i ) != w._get_impl( i );
}
@ -1604,7 +1604,7 @@ template<class... T> struct lt_L
variant<T...> const & v;
variant<T...> const & w;
template<class I> bool operator()( I i ) const
template<class I> constexpr bool operator()( I i ) const
{
return v._get_impl( i ) < w._get_impl( i );
}
@ -1630,7 +1630,7 @@ template<class... T> struct le_L
variant<T...> const & v;
variant<T...> const & w;
template<class I> bool operator()( I i ) const
template<class I> constexpr bool operator()( I i ) const
{
return v._get_impl( i ) <= w._get_impl( i );
}