2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
2016-02-25 09:48:28 +00:00
|
|
|
Copyright (c) 2011-2016 Bolero MURAKAMI
|
2013-08-08 09:54:33 +00:00
|
|
|
https://github.com/bolero-MURAKAMI/Sprout
|
|
|
|
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
=============================================================================*/
|
2016-03-29 09:02:51 +00:00
|
|
|
#ifndef SPROUT_UTILITY_STRING_VIEW_COMPARISON_HPP
|
|
|
|
#define SPROUT_UTILITY_STRING_VIEW_COMPARISON_HPP
|
2013-02-18 17:49:10 +00:00
|
|
|
|
|
|
|
#include <sprout/config.hpp>
|
2014-04-30 07:30:26 +00:00
|
|
|
#include <sprout/workaround/std/cstddef.hpp>
|
2013-02-18 17:49:10 +00:00
|
|
|
#include <sprout/string/string.hpp>
|
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
//
|
|
|
|
// operator==
|
|
|
|
// operator!=
|
|
|
|
// operator<
|
|
|
|
// operator>
|
|
|
|
// operator<=
|
|
|
|
// operator>=
|
|
|
|
//
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator==(sprout::basic_string_view<T, Traits> const& lhs, sprout::basic_string_view<T, Traits> const& rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return lhs.compare(rhs) == 0;
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator==(sprout::basic_string_view<T, Traits> const& lhs, T const* rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return lhs.compare(rhs) == 0;
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator==(T const* lhs, sprout::basic_string_view<T, Traits> const& rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return 0 == rhs.compare(lhs);
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator!=(sprout::basic_string_view<T, Traits> const& lhs, sprout::basic_string_view<T, Traits> const& rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return !(lhs == rhs);
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator!=(sprout::basic_string_view<T, Traits> const& lhs, T const* rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return !(lhs == rhs);
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator!=(T const* lhs, sprout::basic_string_view<T, Traits> const& rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return !(lhs == rhs);
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator<(sprout::basic_string_view<T, Traits> const& lhs, sprout::basic_string_view<T, Traits> const& rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return lhs.compare(rhs) < 0;
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator<(sprout::basic_string_view<T, Traits> const& lhs, T const* rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return lhs.compare(rhs) < 0;
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator<(T const* lhs, sprout::basic_string_view<T, Traits> const& rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return 0 < rhs.compare(lhs);
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator>(sprout::basic_string_view<T, Traits> const& lhs, sprout::basic_string_view<T, Traits> const& rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return rhs < lhs;
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator>(sprout::basic_string_view<T, Traits> const& lhs, T const* rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return rhs < lhs;
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator>(T const* lhs, sprout::basic_string_view<T, Traits> const& rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return rhs < lhs;
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator<=(sprout::basic_string_view<T, Traits> const& lhs, sprout::basic_string_view<T, Traits> const& rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return !(rhs < lhs);
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator<=(sprout::basic_string_view<T, Traits> const& lhs, T const* rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return !(rhs < lhs);
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator<=(T const* lhs, sprout::basic_string_view<T, Traits> const& rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return !(rhs < lhs);
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator>=(sprout::basic_string_view<T, Traits> const& lhs, sprout::basic_string_view<T, Traits> const& rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return !(lhs < rhs);
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator>=(sprout::basic_string_view<T, Traits> const& lhs, T const* rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return !(lhs < rhs);
|
|
|
|
}
|
|
|
|
template<typename T, typename Traits>
|
|
|
|
inline SPROUT_CONSTEXPR bool
|
2016-03-29 09:02:51 +00:00
|
|
|
operator>=(T const* lhs, sprout::basic_string_view<T, Traits> const& rhs) {
|
2013-02-18 17:49:10 +00:00
|
|
|
return !(lhs < rhs);
|
|
|
|
}
|
|
|
|
} // namespace sprout
|
|
|
|
|
2016-03-29 09:02:51 +00:00
|
|
|
#endif // #ifndef SPROUT_UTILITY_STRING_VIEW_COMPARISON_HPP
|