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
83174f2a
Commit
83174f2a
authored
Jul 03, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor ranges
parent
c2e84ee9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
include/fmt/format.h
include/fmt/format.h
+15
-17
No files found.
include/fmt/format.h
View file @
83174f2a
...
...
@@ -212,7 +212,7 @@ inline Dest bit_cast(const Source& source) {
return
dest
;
}
// An
implement
ation of iterator_t for pre-C++20 systems.
// An
approxim
ation of iterator_t for pre-C++20 systems.
template
<
typename
T
>
using
iterator_t
=
decltype
(
std
::
begin
(
std
::
declval
<
T
&>
()));
...
...
@@ -220,26 +220,11 @@ using iterator_t = decltype(std::begin(std::declval<T&>()));
# define FMT_USE_GRISU 1
#endif
template
<
typename
T
>
inline
bool
use_grisu
()
{
template
<
typename
T
>
constexpr
bool
use_grisu
()
{
return
FMT_USE_GRISU
&&
std
::
numeric_limits
<
double
>::
is_iec559
&&
sizeof
(
T
)
<=
sizeof
(
double
);
}
// A range with an iterator appending to a buffer.
template
<
typename
T
>
class
buffer_range
{
public:
using
value_type
=
T
;
using
iterator
=
std
::
back_insert_iterator
<
buffer
<
T
>>
;
private:
iterator
begin_
;
public:
buffer_range
(
buffer
<
T
>&
buf
)
:
begin_
(
std
::
back_inserter
(
buf
))
{}
explicit
buffer_range
(
iterator
it
)
:
begin_
(
it
)
{}
iterator
begin
()
const
{
return
begin_
;
}
};
// A range with the specified output iterator and value type.
template
<
typename
OutputIt
,
typename
T
=
typename
OutputIt
::
value_type
>
class
output_range
{
...
...
@@ -249,9 +234,22 @@ class output_range {
public:
using
value_type
=
T
;
using
iterator
=
OutputIt
;
struct
sentinel
{};
explicit
output_range
(
OutputIt
it
)
:
it_
(
it
)
{}
OutputIt
begin
()
const
{
return
it_
;
}
sentinel
end
()
const
{
return
{};
}
// Sentinel is not used yet.
};
// A range with an iterator appending to a buffer.
template
<
typename
T
>
class
buffer_range
:
public
output_range
<
std
::
back_insert_iterator
<
buffer
<
T
>>
,
T
>
{
public:
using
iterator
=
std
::
back_insert_iterator
<
buffer
<
T
>>
;
using
output_range
<
iterator
,
T
>::
output_range
;
buffer_range
(
buffer
<
T
>&
buf
)
:
output_range
<
iterator
,
T
>
(
std
::
back_inserter
(
buf
))
{}
};
#ifdef _SECURE_SCL
...
...
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