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
c2f38054
Commit
c2f38054
authored
Jun 23, 2018
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add vformat_to_n (#769)
parent
ce500635
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
+24
-4
include/fmt/format.h
include/fmt/format.h
+24
-4
No files found.
include/fmt/format.h
View file @
c2f38054
...
...
@@ -3576,6 +3576,28 @@ struct format_to_n_result {
std
::
size_t
size
;
};
template
<
typename
OutputIt
>
using
format_to_n_context
=
typename
fmt
::
format_context_t
<
fmt
::
internal
::
truncating_iterator
<
OutputIt
>>::
type
;
template
<
typename
OutputIt
>
using
format_to_n_args
=
fmt
::
basic_format_args
<
format_to_n_context
<
OutputIt
>>
;
template
<
typename
OutputIt
,
typename
...
Args
>
inline
format_arg_store
<
format_to_n_context
<
OutputIt
>
,
Args
...
>
make_format_to_n_args
(
const
Args
&
...
args
)
{
return
format_arg_store
<
format_to_n_context
<
OutputIt
>
,
Args
...
>
(
args
...);
}
template
<
typename
OutputIt
,
typename
...
Args
>
inline
format_to_n_result
<
OutputIt
>
vformat_to_n
(
OutputIt
out
,
std
::
size_t
n
,
string_view
format_str
,
format_to_n_args
<
OutputIt
>
args
)
{
typedef
internal
::
truncating_iterator
<
OutputIt
>
It
;
auto
it
=
vformat_to
(
It
(
out
,
n
),
format_str
,
args
);
return
{
it
.
base
(),
it
.
count
()};
}
/**
\rst
Formats arguments, writes up to ``n`` characters of the result to the output
...
...
@@ -3586,10 +3608,8 @@ struct format_to_n_result {
template
<
typename
OutputIt
,
typename
...
Args
>
inline
format_to_n_result
<
OutputIt
>
format_to_n
(
OutputIt
out
,
std
::
size_t
n
,
string_view
format_str
,
const
Args
&
...
args
)
{
typedef
internal
::
truncating_iterator
<
OutputIt
>
It
;
auto
it
=
vformat_to
(
It
(
out
,
n
),
format_str
,
make_format_args
<
typename
format_context_t
<
It
>::
type
>
(
args
...));
return
{
it
.
base
(),
it
.
count
()};
return
vformat_to_n
(
out
,
n
,
format_str
,
make_format_to_n_args
<
OutputIt
>
(
args
...));
}
template
<
typename
OutputIt
,
typename
...
Args
>
inline
format_to_n_result
<
OutputIt
>
format_to_n
(
...
...
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