mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-04 14:14:09 +00:00
fix recursion depth: cstring algorithm
This commit is contained in:
parent
f26032dce8
commit
b51b14efa9
25 changed files with 792 additions and 142 deletions
|
@ -1,17 +1,30 @@
|
|||
#ifndef SPROUT_CSTRING_STRCOLL_HPP
|
||||
#define SPROUT_CSTRING_STRCOLL_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/type_traits/is_char_type.hpp>
|
||||
#include <sprout/cstring/strcmp.hpp>
|
||||
|
||||
namespace sprout {
|
||||
// Copyright (C) 2011 RiSK (sscrisk)
|
||||
|
||||
// 7.21.4.3 strcoll ŠÖ<C5A0>”
|
||||
//
|
||||
// recursion depth:
|
||||
// O(log(N1+N2))
|
||||
//
|
||||
inline SPROUT_CONSTEXPR int
|
||||
strcoll(char const* s1, char const* s2) {
|
||||
return sprout::strcmp(s1, s2);
|
||||
}
|
||||
|
||||
template<typename Elem>
|
||||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
sprout::is_char_type<Elem>::value,
|
||||
int
|
||||
>::type
|
||||
strcoll(Elem* s1, Elem* s2) {
|
||||
return sprout::strcmp(s1, s2);
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_CSTRING_STRCOLL_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue