提交 2eea1f86 编写于 作者: A Anton Perkov

const_strlen without recursion

上级 52001a82
......@@ -54,11 +54,12 @@ namespace fc {
const T& min( const T& a, const T& b ) { return a < b ? a: b; }
constexpr size_t const_strlen(const char* str) {
if (*str == '\0') {
return 0;
size_t res = 0;
while (*str != '\0') {
++res;
++str;
}
return 1 + const_strlen(str+1);
return res;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册