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
e5512c5d
Commit
e5512c5d
authored
May 29, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use static_assert instead of SFINAE in arg(...)
parent
afc571ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
include/fmt/core.h
include/fmt/core.h
+3
-1
No files found.
include/fmt/core.h
View file @
e5512c5d
...
@@ -1416,8 +1416,9 @@ typename buffer_context<Char>::type::iterator vformat_to(
...
@@ -1416,8 +1416,9 @@ typename buffer_context<Char>::type::iterator vformat_to(
fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23));
fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23));
\endrst
\endrst
*/
*/
template
<
typename
S
,
typename
T
,
FMT_ENABLE_IF
(
internal
::
is_string
<
S
>
::
value
)
>
template
<
typename
S
,
typename
T
>
inline
internal
::
named_arg
<
T
,
FMT_CHAR
(
S
)
>
arg
(
const
S
&
name
,
const
T
&
arg
)
{
inline
internal
::
named_arg
<
T
,
FMT_CHAR
(
S
)
>
arg
(
const
S
&
name
,
const
T
&
arg
)
{
static_assert
(
internal
::
is_string
<
S
>::
value
,
""
);
return
{
name
,
arg
};
return
{
name
,
arg
};
}
}
...
@@ -1472,6 +1473,7 @@ inline std::basic_string<Char> vformat(
...
@@ -1472,6 +1473,7 @@ inline std::basic_string<Char> vformat(
std::string message = fmt::format("The answer is {}", 42);
std::string message = fmt::format("The answer is {}", 42);
\endrst
\endrst
*/
*/
// Use SFINAE instead of static_assert because of color overload of fmt::format.
template
<
typename
S
,
typename
...
Args
,
template
<
typename
S
,
typename
...
Args
,
FMT_ENABLE_IF
(
internal
::
is_string
<
S
>
::
value
)
>
FMT_ENABLE_IF
(
internal
::
is_string
<
S
>
::
value
)
>
inline
std
::
basic_string
<
FMT_CHAR
(
S
)
>
format
(
const
S
&
format_str
,
inline
std
::
basic_string
<
FMT_CHAR
(
S
)
>
format
(
const
S
&
format_str
,
...
...
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