2012-04-01 13:15:09 +00:00
|
|
|
|
#ifndef SPROUT_CSTRING_STRLEN_HPP
|
|
|
|
|
#define SPROUT_CSTRING_STRLEN_HPP
|
|
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
|
#include <sprout/config.hpp>
|
|
|
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
|
// Copyright (C) 2011 RiSK (sscrisk)
|
|
|
|
|
|
|
|
|
|
namespace detail {
|
2012-10-05 15:58:56 +00:00
|
|
|
|
inline SPROUT_CONSTEXPR std::size_t
|
|
|
|
|
strlen_impl(char const* s, std::size_t n) {
|
2012-04-01 13:15:09 +00:00
|
|
|
|
return !*s ? n :
|
|
|
|
|
sprout::detail::strlen_impl(s + 1, n + 1)
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
} // namespace detail
|
|
|
|
|
|
|
|
|
|
// 7.21.6.3 strlen <20><EFBFBD>
|
2012-10-05 15:58:56 +00:00
|
|
|
|
inline SPROUT_CONSTEXPR std::size_t
|
|
|
|
|
strlen(char const* s) {
|
2012-04-01 13:15:09 +00:00
|
|
|
|
return sprout::detail::strlen_impl(s, 0);
|
|
|
|
|
}
|
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_CSTRING_STRLEN_HPP
|