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
b02e5af5
Unverified
Commit
b02e5af5
authored
Jan 14, 2022
by
Vladislav Shchapov
Committed by
GitHub
Jan 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fmt::join support FMT_COMPILE (#2720)
parent
58fb7823
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
4 deletions
+9
-4
include/fmt/format.h
include/fmt/format.h
+2
-2
include/fmt/ostream.h
include/fmt/ostream.h
+2
-2
test/compile-test.cc
test/compile-test.cc
+5
-0
No files found.
include/fmt/format.h
View file @
b02e5af5
...
...
@@ -2818,8 +2818,8 @@ struct formatter<join_view<It, Sentinel, Char>, Char> {
}
template
<
typename
FormatContext
>
auto
format
(
const
join_view
<
It
,
Sentinel
,
Char
>&
value
,
FormatContext
&
ctx
)
->
decltype
(
ctx
.
out
())
{
auto
format
(
const
join_view
<
It
,
Sentinel
,
Char
>&
value
,
FormatContext
&
ctx
)
const
->
decltype
(
ctx
.
out
())
{
auto
it
=
value
.
begin
;
auto
out
=
ctx
.
out
();
if
(
it
!=
value
.
end
)
{
...
...
include/fmt/ostream.h
View file @
b02e5af5
...
...
@@ -86,7 +86,7 @@ struct fallback_formatter<T, Char, enable_if_t<is_streamable<T, Char>::value>>
using
formatter
<
basic_string_view
<
Char
>
,
Char
>::
parse
;
template
<
typename
OutputIt
>
auto
format
(
const
T
&
value
,
basic_format_context
<
OutputIt
,
Char
>&
ctx
)
auto
format
(
const
T
&
value
,
basic_format_context
<
OutputIt
,
Char
>&
ctx
)
const
->
OutputIt
{
auto
buffer
=
basic_memory_buffer
<
Char
>
();
format_value
(
buffer
,
value
,
ctx
.
locale
());
...
...
@@ -96,7 +96,7 @@ struct fallback_formatter<T, Char, enable_if_t<is_streamable<T, Char>::value>>
// DEPRECATED!
template
<
typename
OutputIt
>
auto
format
(
const
T
&
value
,
basic_printf_context
<
OutputIt
,
Char
>&
ctx
)
auto
format
(
const
T
&
value
,
basic_printf_context
<
OutputIt
,
Char
>&
ctx
)
const
->
OutputIt
{
auto
buffer
=
basic_memory_buffer
<
Char
>
();
format_value
(
buffer
,
value
,
ctx
.
locale
());
...
...
test/compile-test.cc
View file @
b02e5af5
...
...
@@ -201,6 +201,11 @@ TEST(compile_test, named) {
# endif
}
TEST
(
compile_test
,
join
)
{
unsigned
char
data
[]
=
{
0x1
,
0x2
,
0xaf
};
EXPECT_EQ
(
"0102af"
,
fmt
::
format
(
FMT_COMPILE
(
"{:02x}"
),
fmt
::
join
(
data
,
""
)));
}
TEST
(
compile_test
,
format_to
)
{
char
buf
[
8
];
auto
end
=
fmt
::
format_to
(
buf
,
FMT_COMPILE
(
"{}"
),
42
);
...
...
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