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
6828d549
Commit
6828d549
authored
May 09, 2019
by
mocabe
Committed by
Victor Zverovich
May 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add FMT_ENABLE_IF_T
for definitions of functions which declared using FMT_ENABLE_IF
parent
3fd134be
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
12 deletions
+8
-12
include/fmt/chrono.h
include/fmt/chrono.h
+4
-8
include/fmt/core.h
include/fmt/core.h
+2
-1
include/fmt/format-inl.h
include/fmt/format-inl.h
+1
-2
include/fmt/format.h
include/fmt/format.h
+1
-1
No files found.
include/fmt/chrono.h
View file @
6828d549
...
@@ -376,13 +376,11 @@ struct chrono_format_checker {
...
@@ -376,13 +376,11 @@ struct chrono_format_checker {
FMT_NORETURN
void
on_tz_name
()
{
report_no_date
();
}
FMT_NORETURN
void
on_tz_name
()
{
report_no_date
();
}
};
};
template
<
typename
T
,
template
<
typename
T
,
FMT_ENABLE_IF
(
std
::
is_integral
<
T
>
::
value
)
>
typename
std
::
enable_if
<
std
::
is_integral
<
T
>
::
value
,
int
>::
type
=
0
>
inline
bool
isnan
(
T
)
{
inline
bool
isnan
(
T
)
{
return
false
;
return
false
;
}
}
template
<
typename
T
,
typename
std
::
enable_if
<
std
::
is_floating_point
<
T
>
::
value
,
template
<
typename
T
,
FMT_ENABLE_IF
(
std
::
is_floating_point
<
T
>
::
value
)
>
int
>::
type
=
0
>
inline
bool
isnan
(
T
value
)
{
inline
bool
isnan
(
T
value
)
{
return
std
::
isnan
(
value
);
return
std
::
isnan
(
value
);
}
}
...
@@ -394,13 +392,11 @@ template <typename T> inline int to_int(T value) {
...
@@ -394,13 +392,11 @@ template <typename T> inline int to_int(T value) {
return
static_cast
<
int
>
(
value
);
return
static_cast
<
int
>
(
value
);
}
}
template
<
typename
T
,
template
<
typename
T
,
FMT_ENABLE_IF
(
std
::
is_integral
<
T
>
::
value
)
>
typename
std
::
enable_if
<
std
::
is_integral
<
T
>
::
value
,
int
>::
type
=
0
>
inline
T
mod
(
T
x
,
int
y
)
{
inline
T
mod
(
T
x
,
int
y
)
{
return
x
%
y
;
return
x
%
y
;
}
}
template
<
typename
T
,
typename
std
::
enable_if
<
std
::
is_floating_point
<
T
>
::
value
,
template
<
typename
T
,
FMT_ENABLE_IF
(
std
::
is_floating_point
<
T
>
::
value
)
>
int
>::
type
=
0
>
inline
T
mod
(
T
x
,
int
y
)
{
inline
T
mod
(
T
x
,
int
y
)
{
return
std
::
fmod
(
x
,
y
);
return
std
::
fmod
(
x
,
y
);
}
}
...
...
include/fmt/core.h
View file @
6828d549
...
@@ -227,7 +227,8 @@
...
@@ -227,7 +227,8 @@
// An enable_if helper to be used in template parameters. enable_if in template
// An enable_if helper to be used in template parameters. enable_if in template
// parameters results in much shorter symbols: https://godbolt.org/z/sWw4vP.
// parameters results in much shorter symbols: https://godbolt.org/z/sWw4vP.
#define FMT_ENABLE_IF(...) typename std::enable_if<__VA_ARGS__, int>::type = 0
#define FMT_ENABLE_IF_T(...) typename std::enable_if<__VA_ARGS__, int>::type
#define FMT_ENABLE_IF(...) FMT_ENABLE_IF_T(__VA_ARGS__) = 0
FMT_BEGIN_NAMESPACE
FMT_BEGIN_NAMESPACE
namespace
internal
{
namespace
internal
{
...
...
include/fmt/format-inl.h
View file @
6828d549
...
@@ -682,8 +682,7 @@ template <int GRISU_VERSION> struct grisu_shortest_handler {
...
@@ -682,8 +682,7 @@ template <int GRISU_VERSION> struct grisu_shortest_handler {
}
}
};
};
template
<
typename
Double
,
typename
std
::
enable_if
<
template
<
typename
Double
,
FMT_ENABLE_IF_T
(
sizeof
(
Double
)
==
sizeof
(
uint64_t
))>
sizeof
(
Double
)
==
sizeof
(
uint64_t
),
int
>
::
type
>
FMT_FUNC
bool
grisu_format
(
Double
value
,
buffer
<
char
>&
buf
,
int
precision
,
FMT_FUNC
bool
grisu_format
(
Double
value
,
buffer
<
char
>&
buf
,
int
precision
,
unsigned
options
,
int
&
exp
)
{
unsigned
options
,
int
&
exp
)
{
FMT_ASSERT
(
value
>=
0
,
"value is negative"
);
FMT_ASSERT
(
value
>=
0
,
"value is negative"
);
...
...
include/fmt/format.h
View file @
6828d549
...
@@ -2239,7 +2239,7 @@ FMT_CONSTEXPR bool do_check_format_string(basic_string_view<Char> s,
...
@@ -2239,7 +2239,7 @@ FMT_CONSTEXPR bool do_check_format_string(basic_string_view<Char> s,
}
}
template
<
typename
...
Args
,
typename
S
,
template
<
typename
...
Args
,
typename
S
,
typename
std
::
enable_if
<
is_compile_string
<
S
>
::
value
,
int
>::
type
>
FMT_ENABLE_IF_T
(
is_compile_string
<
S
>
::
value
)
>
void
check_format_string
(
S
format_str
)
{
void
check_format_string
(
S
format_str
)
{
typedef
typename
S
::
char_type
char_t
;
typedef
typename
S
::
char_type
char_t
;
FMT_CONSTEXPR_DECL
bool
invalid_format
=
FMT_CONSTEXPR_DECL
bool
invalid_format
=
...
...
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