mirror of
https://github.com/boostorg/core.git
synced 2025-07-30 04:47:24 +02:00
Add other relational operators; update sv_eq_test
This commit is contained in:
@ -904,6 +904,26 @@ public:
|
|||||||
{
|
{
|
||||||
return sv1.compare( sv2 ) != 0;
|
return sv1.compare( sv2 ) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR friend bool operator<( basic_string_view sv1, basic_string_view sv2 ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return sv1.compare( sv2 ) < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR friend bool operator<=( basic_string_view sv1, basic_string_view sv2 ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return sv1.compare( sv2 ) <= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR friend bool operator>( basic_string_view sv1, basic_string_view sv2 ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return sv1.compare( sv2 ) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR friend bool operator>=( basic_string_view sv1, basic_string_view sv2 ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return sv1.compare( sv2 ) >= 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class Ch> std::basic_ostream<Ch>& operator<<( std::basic_ostream<Ch>& os, basic_string_view<Ch> str )
|
template<class Ch> std::basic_ostream<Ch>& operator<<( std::basic_ostream<Ch>& os, basic_string_view<Ch> str )
|
||||||
|
@ -9,8 +9,18 @@
|
|||||||
# include <string_view>
|
# include <string_view>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TEST_EQ(x, y) BOOST_TEST_EQ(x, y); BOOST_TEST_NOT((x) != (y))
|
#define TEST_EQ(x, y) \
|
||||||
#define TEST_NE(x, y) BOOST_TEST_NE(x, y); BOOST_TEST_NOT((x) == (y))
|
BOOST_TEST_EQ(x, y); \
|
||||||
|
BOOST_TEST_NOT((x) != (y)); \
|
||||||
|
BOOST_TEST_LE(x, y); \
|
||||||
|
BOOST_TEST_GE(x, y); \
|
||||||
|
BOOST_TEST_NOT((x) < (y)); \
|
||||||
|
BOOST_TEST_NOT((x) > (y))
|
||||||
|
|
||||||
|
#define TEST_NE(x, y) \
|
||||||
|
BOOST_TEST_NE(x, y); \
|
||||||
|
BOOST_TEST_NOT((x) == (y)); \
|
||||||
|
BOOST_TEST((x) < (y) || (x) > (y));
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user