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
86716894
Commit
86716894
authored
Sep 08, 2018
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs and formatting
parent
cc10b460
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
doc/api.rst
doc/api.rst
+3
-4
include/fmt/format.h
include/fmt/format.h
+9
-6
No files found.
doc/api.rst
View file @
86716894
...
@@ -253,11 +253,10 @@ custom argument formatter class::
...
@@ -253,11 +253,10 @@ custom argument formatter class::
using arg_formatter::operator();
using arg_formatter::operator();
void
operator()(int value) {
auto
operator()(int value) {
if (spec().type() == 'x')
if (spec().type() == 'x')
(*this)(static_cast<unsigned>(value)); // convert to unsigned and format
return (*this)(static_cast<unsigned>(value)); // convert to unsigned and format
else
return arg_formatter::operator()(value);
arg_formatter::operator()(value);
}
}
};
};
...
...
include/fmt/format.h
View file @
86716894
...
@@ -2145,7 +2145,7 @@ FMT_CONSTEXPR void parse_format_string(
...
@@ -2145,7 +2145,7 @@ FMT_CONSTEXPR void parse_format_string(
auto
end
=
begin
+
format_str
.
size
();
auto
end
=
begin
+
format_str
.
size
();
for
(;;)
{
for
(;;)
{
// 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
lon
g format strings.
// 2.5x faster than the naive one-pass implementation on
bi
g format strings.
const
Char
*
p
=
FMT_NULL
;
const
Char
*
p
=
FMT_NULL
;
if
(
!
find
<
IS_CONSTEXPR
>
(
begin
,
end
,
'{'
,
p
))
{
if
(
!
find
<
IS_CONSTEXPR
>
(
begin
,
end
,
'{'
,
p
))
{
if
(
begin
!=
end
)
if
(
begin
!=
end
)
...
@@ -2217,7 +2217,8 @@ class format_string_checker {
...
@@ -2217,7 +2217,8 @@ class format_string_checker {
FMT_CONSTEXPR
const
Char
*
on_format_specs
(
iterator
it
)
{
FMT_CONSTEXPR
const
Char
*
on_format_specs
(
iterator
it
)
{
auto
p
=
pointer_from
(
it
);
auto
p
=
pointer_from
(
it
);
context_
.
advance_to
(
p
);
context_
.
advance_to
(
p
);
return
to_unsigned
(
arg_id_
)
<
NUM_ARGS
?
parse_funcs_
[
arg_id_
](
context_
)
:
p
;
return
to_unsigned
(
arg_id_
)
<
NUM_ARGS
?
parse_funcs_
[
arg_id_
](
context_
)
:
p
;
}
}
FMT_CONSTEXPR
void
on_error
(
const
char
*
message
)
{
FMT_CONSTEXPR
void
on_error
(
const
char
*
message
)
{
...
@@ -2747,7 +2748,8 @@ class basic_writer {
...
@@ -2747,7 +2748,8 @@ class basic_writer {
}
}
template
<
typename
T
>
template
<
typename
T
>
typename
std
::
enable_if
<
std
::
is_same
<
T
,
void
>::
value
>::
type
write
(
const
T
*
p
)
{
typename
std
::
enable_if
<
std
::
is_same
<
T
,
void
>::
value
>::
type
write
(
const
T
*
p
)
{
format_specs
specs
;
format_specs
specs
;
specs
.
flags_
=
HASH_FLAG
;
specs
.
flags_
=
HASH_FLAG
;
specs
.
type_
=
'x'
;
specs
.
type_
=
'x'
;
...
@@ -3525,8 +3527,8 @@ inline format_to_n_result<OutputIt> vformat_to_n(
...
@@ -3525,8 +3527,8 @@ inline format_to_n_result<OutputIt> vformat_to_n(
/**
/**
\rst
\rst
Formats arguments, writes up to ``n`` characters of the result to the output
Formats arguments, writes up to ``n`` characters of the result to the output
iterator ``out`` and returns the total output size and the iterator past the
end
iterator ``out`` and returns the total output size and the iterator past the
of the output range.
end
of the output range.
\endrst
\endrst
*/
*/
template
<
typename
OutputIt
,
typename
...
Args
>
template
<
typename
OutputIt
,
typename
...
Args
>
...
@@ -3537,7 +3539,8 @@ inline format_to_n_result<OutputIt> format_to_n(
...
@@ -3537,7 +3539,8 @@ inline format_to_n_result<OutputIt> format_to_n(
}
}
template
<
typename
OutputIt
,
typename
...
Args
>
template
<
typename
OutputIt
,
typename
...
Args
>
inline
format_to_n_result
<
OutputIt
>
format_to_n
(
inline
format_to_n_result
<
OutputIt
>
format_to_n
(
OutputIt
out
,
std
::
size_t
n
,
wstring_view
format_str
,
const
Args
&
...
args
)
{
OutputIt
out
,
std
::
size_t
n
,
wstring_view
format_str
,
const
Args
&
...
args
)
{
typedef
internal
::
truncating_iterator
<
OutputIt
>
It
;
typedef
internal
::
truncating_iterator
<
OutputIt
>
It
;
auto
it
=
vformat_to
(
It
(
out
,
n
),
format_str
,
auto
it
=
vformat_to
(
It
(
out
,
n
),
format_str
,
make_format_args
<
typename
format_context_t
<
It
,
wchar_t
>::
type
>
(
args
...));
make_format_args
<
typename
format_context_t
<
It
,
wchar_t
>::
type
>
(
args
...));
...
...
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