fix recursion depth: cstring algorithm

This commit is contained in:
bolero-MURAKAMI 2013-01-13 01:16:48 +09:00
parent f26032dce8
commit b51b14efa9
25 changed files with 792 additions and 142 deletions

View file

@ -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