Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
6e2e5c7d
Commit
6e2e5c7d
authored
Feb 28, 2017
by
StilesCrisis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Specialize StrLen for char/wchar_t
Compilers generally provide a much smarter strlen than ours.
parent
f349456b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
strfunc.h
include/rapidjson/internal/strfunc.h
+11
-0
No files found.
include/rapidjson/internal/strfunc.h
View file @
6e2e5c7d
...
...
@@ -16,6 +16,7 @@
#define RAPIDJSON_INTERNAL_STRFUNC_H_
#include "../stream.h"
#include <cwchar>
RAPIDJSON_NAMESPACE_BEGIN
namespace
internal
{
...
...
@@ -34,6 +35,16 @@ inline SizeType StrLen(const Ch* s) {
return
SizeType
(
p
-
s
);
}
template
<>
inline
SizeType
StrLen
(
const
char
*
s
)
{
return
SizeType
(
std
::
strlen
(
s
));
}
template
<>
inline
SizeType
StrLen
(
const
wchar_t
*
s
)
{
return
SizeType
(
std
::
wcslen
(
s
));
}
//! Returns number of code points in a encoded string.
template
<
typename
Encoding
>
bool
CountStringCodePoint
(
const
typename
Encoding
::
Ch
*
s
,
SizeType
length
,
SizeType
*
outCount
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment