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
cdfacb43
Commit
cdfacb43
authored
May 30, 2022
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup parse_format_string
parent
926ddd06
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
include/fmt/core.h
include/fmt/core.h
+8
-9
No files found.
include/fmt/core.h
View file @
cdfacb43
...
@@ -2591,21 +2591,21 @@ FMT_CONSTEXPR FMT_INLINE void parse_format_string(
...
@@ -2591,21 +2591,21 @@ FMT_CONSTEXPR FMT_INLINE void parse_format_string(
return
;
return
;
}
}
struct
writer
{
struct
writer
{
FMT_CONSTEXPR
void
operator
()(
const
Char
*
pbegin
,
const
Char
*
pend
)
{
FMT_CONSTEXPR
void
operator
()(
const
Char
*
from
,
const
Char
*
to
)
{
if
(
pbegin
==
pend
)
return
;
if
(
from
==
to
)
return
;
for
(;;)
{
for
(;;)
{
const
Char
*
p
=
nullptr
;
const
Char
*
p
=
nullptr
;
if
(
!
find
<
IS_CONSTEXPR
>
(
pbegin
,
pend
,
Char
(
'}'
),
p
))
if
(
!
find
<
IS_CONSTEXPR
>
(
from
,
to
,
Char
(
'}'
),
p
))
return
handler_
.
on_text
(
pbegin
,
pend
);
return
handler_
.
on_text
(
from
,
to
);
++
p
;
++
p
;
if
(
p
==
pend
||
*
p
!=
'}'
)
if
(
p
==
to
||
*
p
!=
'}'
)
return
handler_
.
on_error
(
"unmatched '}' in format string"
);
return
handler_
.
on_error
(
"unmatched '}' in format string"
);
handler_
.
on_text
(
pbegin
,
p
);
handler_
.
on_text
(
from
,
p
);
pbegin
=
p
+
1
;
from
=
p
+
1
;
}
}
}
}
Handler
&
handler_
;
Handler
&
handler_
;
}
write
{
handler
};
}
write
=
{
handler
};
while
(
begin
!=
end
)
{
while
(
begin
!=
end
)
{
// Doing two passes with memchr (one for '{' and another for '}') is up to
// Doing two passes with memchr (one for '{' and another for '}') is up to
// 2.5x faster than the naive one-pass implementation on big format strings.
// 2.5x faster than the naive one-pass implementation on big format strings.
...
@@ -2620,7 +2620,6 @@ FMT_CONSTEXPR FMT_INLINE void parse_format_string(
...
@@ -2620,7 +2620,6 @@ FMT_CONSTEXPR FMT_INLINE void parse_format_string(
template
<
typename
T
,
bool
=
is_named_arg
<
T
>
::
value
>
struct
strip_named_arg
{
template
<
typename
T
,
bool
=
is_named_arg
<
T
>
::
value
>
struct
strip_named_arg
{
using
type
=
T
;
using
type
=
T
;
};
};
template
<
typename
T
>
struct
strip_named_arg
<
T
,
true
>
{
template
<
typename
T
>
struct
strip_named_arg
<
T
,
true
>
{
using
type
=
remove_cvref_t
<
decltype
(
T
::
value
)
>
;
using
type
=
remove_cvref_t
<
decltype
(
T
::
value
)
>
;
};
};
...
...
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