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
0d38cca0
Commit
0d38cca0
authored
Jun 15, 2021
by
Alexander Lapshin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tostr double fix
parent
207a908b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
TextFunctions.h
utils/TextFunctions.h
+15
-15
No files found.
utils/TextFunctions.h
View file @
0d38cca0
...
...
@@ -45,20 +45,20 @@ static std::string ToStr(const int 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 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
)
{
...
...
@@ -114,7 +114,7 @@ static std::string ToStr(const int arg, const int leading_zeros)
// return ss.str();
// }
static
std
::
string
ToStr
(
const
double
value
,
const
int
precision
)
static
std
::
string
ToStr
(
const
double
value
,
const
int
precision
=
0
)
{
std
::
ostringstream
ss
;
...
...
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