2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
2014-01-08 07:48:12 +00:00
|
|
|
Copyright (c) 2011-2014 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)
|
|
|
|
=============================================================================*/
|
2013-02-18 17:49:10 +00:00
|
|
|
#ifndef SPROUT_STRING_DETAIL_COMPARE_HPP
|
|
|
|
#define SPROUT_STRING_DETAIL_COMPARE_HPP
|
|
|
|
|
|
|
|
#include <sprout/config.hpp>
|
2013-02-19 16:12:56 +00:00
|
|
|
#include HDR_ALGORITHM_MIN_MAX_SSCRISK_CEL_OR_SPROUT
|
2013-02-18 17:49:10 +00:00
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
namespace string_detail {
|
|
|
|
template<typename String>
|
|
|
|
static SPROUT_CONSTEXPR int
|
|
|
|
compare_impl_1(
|
|
|
|
int compared, typename String::size_type n1, typename String::size_type n2
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return compared != 0 ? compared
|
|
|
|
: n1 < n2 ? -1
|
|
|
|
: n2 < n1 ? 1
|
|
|
|
: 0
|
|
|
|
;
|
|
|
|
}
|
|
|
|
template<typename String, typename ConstIterator>
|
|
|
|
static SPROUT_CONSTEXPR int
|
|
|
|
compare_impl(
|
|
|
|
typename String::const_iterator data, typename String::size_type pos1, typename String::size_type n1,
|
|
|
|
ConstIterator s, typename String::size_type n2
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return sprout::string_detail::compare_impl_1<String>(
|
|
|
|
String::traits_type::compare(data + pos1, s, NS_SSCRISK_CEL_OR_SPROUT::min(n1, n2)),
|
|
|
|
n1, n2
|
|
|
|
);
|
|
|
|
}
|
2013-03-22 05:24:19 +00:00
|
|
|
} // namespace string_detail
|
|
|
|
} // namespace sprout
|
2013-02-18 17:49:10 +00:00
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_STRING_DETAIL_COMPARE_HPP
|