Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
d05d4275
Commit
d05d4275
authored
Jun 12, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove old msvc workaround from arg_formatter_base and fix warning
parent
d32fe0f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
14 deletions
+20
-14
include/fmt/format.h
include/fmt/format.h
+17
-13
test/format-test.cc
test/format-test.cc
+3
-1
No files found.
include/fmt/format.h
View file @
d05d4275
...
...
@@ -1423,20 +1423,24 @@ class arg_formatter_base {
return
out
();
}
template
<
typename
T
,
FMT_ENABLE_IF
(
std
::
is_integral
<
T
>
::
value
||
std
::
is_same
<
T
,
char_type
>::
value
)
>
template
<
typename
T
,
FMT_ENABLE_IF
(
std
::
is_integral
<
T
>
::
value
)
>
iterator
operator
()(
T
value
)
{
// MSVC2013 fails to compile separate overloads for bool and char_type so
// use std::is_same instead.
if
(
std
::
is_same
<
T
,
bool
>::
value
)
{
if
(
specs_
&&
specs_
->
type
)
return
(
*
this
)(
value
?
1
:
0
);
write
(
value
!=
0
);
}
else
if
(
std
::
is_same
<
T
,
char_type
>::
value
)
{
internal
::
handle_char_specs
(
specs_
,
char_spec_handler
(
*
this
,
static_cast
<
char_type
>
(
value
)));
}
else
{
specs_
?
writer_
.
write_int
(
value
,
*
specs_
)
:
writer_
.
write
(
value
);
}
if
(
specs_
)
writer_
.
write_int
(
value
,
*
specs_
);
else
writer_
.
write
(
value
);
return
out
();
}
iterator
operator
()(
char_type
value
)
{
internal
::
handle_char_specs
(
specs_
,
char_spec_handler
(
*
this
,
static_cast
<
char_type
>
(
value
)));
return
out
();
}
iterator
operator
()(
bool
value
)
{
if
(
specs_
&&
specs_
->
type
)
return
(
*
this
)(
value
?
1
:
0
);
write
(
value
!=
0
);
return
out
();
}
...
...
test/format-test.cc
View file @
d05d4275
...
...
@@ -2494,7 +2494,9 @@ TEST(FormatTest, CharTraitsIsNotAmbiguous) {
struct
mychar
{
int
value
;
mychar
()
=
default
;
mychar
(
char
val
)
:
value
(
val
)
{}
template
<
typename
T
>
mychar
(
T
val
)
:
value
(
static_cast
<
int
>
(
val
))
{}
operator
int
()
const
{
return
value
;
}
};
...
...
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