Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Alexander Lapshin
common
Commits
207a908b
Commit
207a908b
authored
Jun 15, 2021
by
Alexander Lapshin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
json output fix
parent
df3cb2db
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletion
+31
-1
TextFunctions.h
utils/TextFunctions.h
+31
-1
No files found.
utils/TextFunctions.h
View file @
207a908b
...
...
@@ -30,7 +30,37 @@ template <typename T> void hangle_to_chars_error(const std::to_chars_result& res
throw
Exp
()
<<
"failed to convert value ["
<<
arg
<<
"] to string"
;
}
template
<
typename
T
>
static
std
::
string
ToStr
(
const
int
arg
)
static
std
::
string
ToStr
(
const
int
arg
)
{
std
::
array
<
char
,
32
>
buf
;
const
auto
res
=
std
::
to_chars
(
buf
.
data
(),
buf
.
data
()
+
buf
.
size
(),
arg
);
if
(
res
.
ec
==
std
::
errc
())
{
return
std
::
string
(
buf
.
data
(),
res
.
ptr
-
buf
.
data
());
}
hangle_to_chars_error
(
res
,
arg
);
return
""
;
}
static
std
::
string
ToStr
(
const
double
arg
)
{
std
::
array
<
char
,
32
>
buf
;
const
auto
res
=
std
::
to_chars
(
buf
.
data
(),
buf
.
data
()
+
buf
.
size
(),
arg
);
if
(
res
.
ec
==
std
::
errc
())
{
return
std
::
string
(
buf
.
data
(),
res
.
ptr
-
buf
.
data
());
}
hangle_to_chars_error
(
res
,
arg
);
return
""
;
}
static
std
::
string
ToStr
(
const
long
long
arg
)
{
std
::
array
<
char
,
32
>
buf
;
...
...
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