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
a38b99a1
Commit
a38b99a1
authored
Jun 05, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a regression in named argument handling introduced by prepare
parent
aa31028b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
include/fmt/format.h
include/fmt/format.h
+3
-5
include/fmt/prepare.h
include/fmt/prepare.h
+8
-7
No files found.
include/fmt/format.h
View file @
a38b99a1
...
...
@@ -1806,11 +1806,9 @@ struct string_view_metadata {
:
offset_
(
view
.
data
()
-
primary_string
.
data
()),
size_
(
view
.
size
())
{}
FMT_CONSTEXPR
string_view_metadata
(
std
::
size_t
offset
,
std
::
size_t
size
)
:
offset_
(
offset
),
size_
(
size
)
{}
template
<
typename
S
,
typename
Char
=
enable_if_t
<
internal
::
is_string
<
S
>
::
value
,
char_t
<
S
>>>
FMT_CONSTEXPR
basic_string_view
<
Char
>
to_view
(
S
&&
str
)
const
{
const
auto
view
=
to_string_view
(
str
);
return
basic_string_view
<
Char
>
(
view
.
data
()
+
offset_
,
size_
);
template
<
typename
Char
>
FMT_CONSTEXPR
basic_string_view
<
Char
>
to_view
(
const
Char
*
str
)
const
{
return
{
str
+
offset_
,
size_
};
}
std
::
size_t
offset_
;
...
...
include/fmt/prepare.h
View file @
a38b99a1
...
...
@@ -262,7 +262,7 @@ class prepared_format {
switch
(
part
.
which
)
{
case
format_part_t
:
:
which_value
::
text
:
{
const
auto
text
=
value
.
text
.
to_view
(
format_view
);
const
auto
text
=
value
.
text
.
to_view
(
format_view
.
data
()
);
auto
output
=
ctx
.
out
();
auto
&&
it
=
internal
::
reserve
(
output
,
text
.
size
());
it
=
std
::
copy_n
(
text
.
begin
(),
text
.
size
(),
it
);
...
...
@@ -276,16 +276,17 @@ class prepared_format {
case
format_part_t
:
:
which_value
::
named_argument_id
:
{
advance_parse_context_to_specification
(
parse_ctx
,
part
);
const
auto
named_arg_id
=
value
.
named_arg_id
.
to_view
(
format_view
);
const
auto
named_arg_id
=
value
.
named_arg_id
.
to_view
(
format_view
.
data
());
format_arg
<
Range
>
(
parse_ctx
,
ctx
,
named_arg_id
);
}
break
;
case
format_part_t
:
:
which_value
::
specification
:
{
const
auto
&
arg_id_value
=
value
.
spec
.
arg_id
.
val
;
const
auto
arg
=
value
.
spec
.
arg_id
.
which
==
format_part_t
::
argument_id
::
which_arg_id
::
index
?
ctx
.
arg
(
arg_id_value
.
index
)
:
ctx
.
arg
(
arg_id_value
.
named_index
.
to_view
(
format_
));
const
auto
arg
=
value
.
spec
.
arg_id
.
which
==
format_part_t
::
argument_id
::
which_arg_id
::
index
?
ctx
.
arg
(
arg_id_value
.
index
)
:
ctx
.
arg
(
arg_id_value
.
named_index
.
to_view
(
to_string_view
(
format_
).
data
()
));
auto
specs
=
value
.
spec
.
parsed_specs
;
...
...
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