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
c7695756
Commit
c7695756
authored
Aug 31, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FixedEnum -> StrongEnum and make it a regression test
parent
200ee6f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
include/fmt/core.h
include/fmt/core.h
+2
-1
test/format-test.cc
test/format-test.cc
+4
-2
No files found.
include/fmt/core.h
View file @
c7695756
...
@@ -825,7 +825,8 @@ template <typename Context> struct arg_mapper {
...
@@ -825,7 +825,8 @@ template <typename Context> struct arg_mapper {
FMT_ENABLE_IF
(
std
::
is_enum
<
T
>
::
value
&&
FMT_ENABLE_IF
(
std
::
is_enum
<
T
>
::
value
&&
!
has_formatter
<
T
,
Context
>::
value
&&
!
has_formatter
<
T
,
Context
>::
value
&&
!
has_fallback_formatter
<
T
,
Context
>::
value
)
>
!
has_fallback_formatter
<
T
,
Context
>::
value
)
>
FMT_CONSTEXPR
auto
map
(
const
T
&
val
)
->
decltype
(
map
(
static_cast
<
typename
std
::
underlying_type
<
T
>::
type
>
(
val
)))
{
FMT_CONSTEXPR
auto
map
(
const
T
&
val
)
->
decltype
(
map
(
static_cast
<
typename
std
::
underlying_type
<
T
>::
type
>
(
val
)))
{
return
map
(
static_cast
<
typename
std
::
underlying_type
<
T
>::
type
>
(
val
));
return
map
(
static_cast
<
typename
std
::
underlying_type
<
T
>::
type
>
(
val
));
}
}
template
<
typename
T
,
template
<
typename
T
,
...
...
test/format-test.cc
View file @
c7695756
...
@@ -1906,9 +1906,11 @@ TEST(FormatTest, FormatterNotSpecialized) {
...
@@ -1906,9 +1906,11 @@ TEST(FormatTest, FormatterNotSpecialized) {
}
}
#if FMT_HAS_FEATURE(cxx_strong_enums)
#if FMT_HAS_FEATURE(cxx_strong_enums)
enum
TestFixedEnum
:
short
{
B
=
1
};
enum
big_enum
:
unsigned
long
long
{
big_enum_value
=
5000000000ULL
};
TEST
(
FormatTest
,
FixedEnum
)
{
EXPECT_EQ
(
"1"
,
fmt
::
format
(
"{}"
,
B
));
}
TEST
(
FormatTest
,
StrongEnum
)
{
EXPECT_EQ
(
"5000000000"
,
fmt
::
format
(
"{}"
,
big_enum_value
));
}
#endif
#endif
using
buffer_range
=
fmt
::
buffer_range
<
char
>
;
using
buffer_range
=
fmt
::
buffer_range
<
char
>
;
...
...
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