mirror of
https://github.com/boostorg/utility.git
synced 2025-05-09 15:04:00 +00:00
fix breakage of string_ref logical ops, detabify, remove trailing whitespace
[SVN r83147]
This commit is contained in:
parent
9284a64936
commit
e0e16be802
@ -34,8 +34,6 @@ namespace boost {
|
||||
bool operator () ( charT val ) const { return traits::eq ( ch_, val ); }
|
||||
charT ch_;
|
||||
};
|
||||
|
||||
template<typename T> struct __identity { typedef T type; };
|
||||
}
|
||||
|
||||
template<typename charT, typename traits> class basic_string_ref;
|
||||
@ -259,22 +257,32 @@ namespace boost {
|
||||
};
|
||||
|
||||
|
||||
// Comparison operators (3 for each operation)
|
||||
// Comparison operators
|
||||
// Equality
|
||||
template<typename charT, typename traits>
|
||||
bool operator==(basic_string_ref<charT, traits> x, basic_string_ref<charT, traits> y) {
|
||||
if ( x.size () != y.size ()) return false;
|
||||
return x.compare(y) == 0;
|
||||
}
|
||||
template<typename charT, typename traits>
|
||||
bool operator==(basic_string_ref<charT, traits> x, typename detail::__identity<basic_string_ref<charT, traits> >::type y) {
|
||||
if ( x.size () != y.size ()) return false;
|
||||
return x.compare(y) == 0;
|
||||
|
||||
template<typename charT, typename traits, typename Allocator>
|
||||
bool operator==(basic_string_ref<charT, traits> x, const std::basic_string<charT, traits, Allocator> & y) {
|
||||
return x == basic_string_ref<charT, traits>(y);
|
||||
}
|
||||
|
||||
template<typename charT, typename traits, typename Allocator>
|
||||
bool operator==(const std::basic_string<charT, traits, Allocator> & x, basic_string_ref<charT, traits> y) {
|
||||
return basic_string_ref<charT, traits>(x) == y;
|
||||
}
|
||||
|
||||
template<typename charT, typename traits>
|
||||
bool operator==(typename detail::__identity<basic_string_ref<charT, traits> >::type x, basic_string_ref<charT, traits> y) {
|
||||
if ( x.size () != y.size ()) return false;
|
||||
return x.compare(y) == 0;
|
||||
bool operator==(basic_string_ref<charT, traits> x, const charT * y) {
|
||||
return x == basic_string_ref<charT, traits>(y);
|
||||
}
|
||||
|
||||
template<typename charT, typename traits>
|
||||
bool operator==(const charT * x, basic_string_ref<charT, traits> y) {
|
||||
return basic_string_ref<charT, traits>(x) == y;
|
||||
}
|
||||
|
||||
// Inequality
|
||||
@ -283,15 +291,25 @@ namespace boost {
|
||||
if ( x.size () != y.size ()) return true;
|
||||
return x.compare(y) != 0;
|
||||
}
|
||||
template<typename charT, typename traits>
|
||||
bool operator!=(basic_string_ref<charT, traits> x, typename detail::__identity<basic_string_ref<charT, traits> >::type y) {
|
||||
if ( x.size () != y.size ()) return true;
|
||||
return x.compare(y) != 0;
|
||||
|
||||
template<typename charT, typename traits, typename Allocator>
|
||||
bool operator!=(basic_string_ref<charT, traits> x, const std::basic_string<charT, traits, Allocator> & y) {
|
||||
return x != basic_string_ref<charT, traits>(y);
|
||||
}
|
||||
|
||||
template<typename charT, typename traits, typename Allocator>
|
||||
bool operator!=(const std::basic_string<charT, traits, Allocator> & x, basic_string_ref<charT, traits> y) {
|
||||
return basic_string_ref<charT, traits>(x) != y;
|
||||
}
|
||||
|
||||
template<typename charT, typename traits>
|
||||
bool operator!=(typename detail::__identity<basic_string_ref<charT, traits> >::type x, basic_string_ref<charT, traits> y) {
|
||||
if ( x.size () != y.size ()) return true;
|
||||
return x.compare(y) != 0;
|
||||
bool operator!=(basic_string_ref<charT, traits> x, const charT * y) {
|
||||
return x != basic_string_ref<charT, traits>(y);
|
||||
}
|
||||
|
||||
template<typename charT, typename traits>
|
||||
bool operator!=(const charT * x, basic_string_ref<charT, traits> y) {
|
||||
return basic_string_ref<charT, traits>(x) != y;
|
||||
}
|
||||
|
||||
// Less than
|
||||
@ -299,13 +317,25 @@ namespace boost {
|
||||
bool operator<(basic_string_ref<charT, traits> x, basic_string_ref<charT, traits> y) {
|
||||
return x.compare(y) < 0;
|
||||
}
|
||||
template<typename charT, typename traits>
|
||||
bool operator<(basic_string_ref<charT, traits> x, typename detail::__identity<basic_string_ref<charT, traits> >::type y) {
|
||||
return x.compare(y) < 0;
|
||||
|
||||
template<typename charT, typename traits, typename Allocator>
|
||||
bool operator<(basic_string_ref<charT, traits> x, const std::basic_string<charT, traits, Allocator> & y) {
|
||||
return x < basic_string_ref<charT, traits>(y);
|
||||
}
|
||||
|
||||
template<typename charT, typename traits, typename Allocator>
|
||||
bool operator<(const std::basic_string<charT, traits, Allocator> & x, basic_string_ref<charT, traits> y) {
|
||||
return basic_string_ref<charT, traits>(x) < y;
|
||||
}
|
||||
|
||||
template<typename charT, typename traits>
|
||||
bool operator<(typename detail::__identity<basic_string_ref<charT, traits> >::type x, basic_string_ref<charT, traits> y) {
|
||||
return x.compare(y) < 0;
|
||||
bool operator<(basic_string_ref<charT, traits> x, const charT * y) {
|
||||
return x < basic_string_ref<charT, traits>(y);
|
||||
}
|
||||
|
||||
template<typename charT, typename traits>
|
||||
bool operator<(const charT * x, basic_string_ref<charT, traits> y) {
|
||||
return basic_string_ref<charT, traits>(x) < y;
|
||||
}
|
||||
|
||||
// Greater than
|
||||
@ -313,13 +343,25 @@ namespace boost {
|
||||
bool operator>(basic_string_ref<charT, traits> x, basic_string_ref<charT, traits> y) {
|
||||
return x.compare(y) > 0;
|
||||
}
|
||||
template<typename charT, typename traits>
|
||||
bool operator>(basic_string_ref<charT, traits> x, typename detail::__identity<basic_string_ref<charT, traits> >::type y) {
|
||||
return x.compare(y) > 0;
|
||||
|
||||
template<typename charT, typename traits, typename Allocator>
|
||||
bool operator>(basic_string_ref<charT, traits> x, const std::basic_string<charT, traits, Allocator> & y) {
|
||||
return x > basic_string_ref<charT, traits>(y);
|
||||
}
|
||||
|
||||
template<typename charT, typename traits, typename Allocator>
|
||||
bool operator>(const std::basic_string<charT, traits, Allocator> & x, basic_string_ref<charT, traits> y) {
|
||||
return basic_string_ref<charT, traits>(x) > y;
|
||||
}
|
||||
|
||||
template<typename charT, typename traits>
|
||||
bool operator>(typename detail::__identity<basic_string_ref<charT, traits> >::type x, basic_string_ref<charT, traits> y) {
|
||||
return x.compare(y) > 0;
|
||||
bool operator>(basic_string_ref<charT, traits> x, const charT * y) {
|
||||
return x > basic_string_ref<charT, traits>(y);
|
||||
}
|
||||
|
||||
template<typename charT, typename traits>
|
||||
bool operator>(const charT * x, basic_string_ref<charT, traits> y) {
|
||||
return basic_string_ref<charT, traits>(x) > y;
|
||||
}
|
||||
|
||||
// Less than or equal to
|
||||
@ -327,13 +369,25 @@ namespace boost {
|
||||
bool operator<=(basic_string_ref<charT, traits> x, basic_string_ref<charT, traits> y) {
|
||||
return x.compare(y) <= 0;
|
||||
}
|
||||
template<typename charT, typename traits>
|
||||
bool operator<=(basic_string_ref<charT, traits> x, typename detail::__identity<basic_string_ref<charT, traits> >::type y) {
|
||||
return x.compare(y) <= 0;
|
||||
|
||||
template<typename charT, typename traits, typename Allocator>
|
||||
bool operator<=(basic_string_ref<charT, traits> x, const std::basic_string<charT, traits, Allocator> & y) {
|
||||
return x <= basic_string_ref<charT, traits>(y);
|
||||
}
|
||||
|
||||
template<typename charT, typename traits, typename Allocator>
|
||||
bool operator<=(const std::basic_string<charT, traits, Allocator> & x, basic_string_ref<charT, traits> y) {
|
||||
return basic_string_ref<charT, traits>(x) <= y;
|
||||
}
|
||||
|
||||
template<typename charT, typename traits>
|
||||
bool operator<=(typename detail::__identity<basic_string_ref<charT, traits> >::type x, basic_string_ref<charT, traits> y) {
|
||||
return x.compare(y) <= 0;
|
||||
bool operator<=(basic_string_ref<charT, traits> x, const charT * y) {
|
||||
return x <= basic_string_ref<charT, traits>(y);
|
||||
}
|
||||
|
||||
template<typename charT, typename traits>
|
||||
bool operator<=(const charT * x, basic_string_ref<charT, traits> y) {
|
||||
return basic_string_ref<charT, traits>(x) <= y;
|
||||
}
|
||||
|
||||
// Greater than or equal to
|
||||
@ -341,16 +395,26 @@ namespace boost {
|
||||
bool operator>=(basic_string_ref<charT, traits> x, basic_string_ref<charT, traits> y) {
|
||||
return x.compare(y) >= 0;
|
||||
}
|
||||
template<typename charT, typename traits>
|
||||
bool operator>=(basic_string_ref<charT, traits> x, typename detail::__identity<basic_string_ref<charT, traits> >::type y) {
|
||||
return x.compare(y) >= 0;
|
||||
}
|
||||
template<typename charT, typename traits>
|
||||
bool operator>=(typename detail::__identity<basic_string_ref<charT, traits> >::type x, basic_string_ref<charT, traits> y) {
|
||||
return x.compare(y) >= 0;
|
||||
|
||||
template<typename charT, typename traits, typename Allocator>
|
||||
bool operator>=(basic_string_ref<charT, traits> x, const std::basic_string<charT, traits, Allocator> & y) {
|
||||
return x >= basic_string_ref<charT, traits>(y);
|
||||
}
|
||||
|
||||
template<typename charT, typename traits, typename Allocator>
|
||||
bool operator>=(const std::basic_string<charT, traits, Allocator> & x, basic_string_ref<charT, traits> y) {
|
||||
return basic_string_ref<charT, traits>(x) >= y;
|
||||
}
|
||||
|
||||
template<typename charT, typename traits>
|
||||
bool operator>=(basic_string_ref<charT, traits> x, const charT * y) {
|
||||
return x >= basic_string_ref<charT, traits>(y);
|
||||
}
|
||||
|
||||
template<typename charT, typename traits>
|
||||
bool operator>=(const charT * x, basic_string_ref<charT, traits> y) {
|
||||
return basic_string_ref<charT, traits>(x) >= y;
|
||||
}
|
||||
|
||||
// Inserter
|
||||
template<class charT, class traits>
|
||||
|
@ -266,6 +266,7 @@ void compare ( const char *arg ) {
|
||||
|
||||
str1.assign ( arg );
|
||||
sr1 = arg;
|
||||
BOOST_CHECK ( sr1 == sr1); // compare string_ref and string_ref
|
||||
BOOST_CHECK ( sr1 == str1); // compare string and string_ref
|
||||
BOOST_CHECK ( str1 == sr1 ); // compare string_ref and string
|
||||
BOOST_CHECK ( sr1 == arg ); // compare string_ref and pointer
|
||||
|
Loading…
x
Reference in New Issue
Block a user