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
1d2adef2
Commit
1d2adef2
authored
Mar 01, 2018
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compilation errors on gcc 4.4
parent
45518c3f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
10 deletions
+37
-10
include/fmt/core.h
include/fmt/core.h
+9
-0
include/fmt/format.h
include/fmt/format.h
+28
-10
No files found.
include/fmt/core.h
View file @
1d2adef2
...
...
@@ -170,8 +170,10 @@
namespace
fmt
{
// An implementation of declval for pre-C++11 compilers such as gcc 4.
namespace
internal
{
template
<
typename
T
>
typename
std
::
add_rvalue_reference
<
T
>::
type
declval
()
FMT_NOEXCEPT
;
}
/**
\rst
...
...
@@ -962,8 +964,15 @@ class arg_store {
public:
static
const
uint64_t
TYPES
;
#if FMT_GCC_VERSION && FMT_GCC_VERSION <= 405 && !defined(__clang__)
// Workaround an array initialization bug in gcc 4.5 and earlier.
arg_store
(
const
Args
&
...
args
)
{
data_
=
{
internal
::
make_arg
<
IS_PACKED
,
Context
>
(
args
)...};
}
#else
arg_store
(
const
Args
&
...
args
)
:
data_
{
internal
::
make_arg
<
IS_PACKED
,
Context
>
(
args
)...}
{}
#endif
basic_format_args
<
Context
>
operator
*
()
const
{
return
*
this
;
}
...
...
include/fmt/format.h
View file @
1d2adef2
...
...
@@ -212,6 +212,19 @@ inline uint32_t clzll(uint64_t x) {
namespace
fmt
{
namespace
internal
{
// An implementation of begin and end for pre-C++11 compilers such as gcc 4.
template
<
typename
C
>
FMT_CONSTEXPR
auto
begin
(
const
C
&
c
)
->
decltype
(
c
.
begin
())
{
return
c
.
begin
();
}
template
<
typename
T
,
std
::
size_t
N
>
FMT_CONSTEXPR
T
*
begin
(
T
(
&
array
)[
N
])
FMT_NOEXCEPT
{
return
array
;
}
template
<
typename
C
>
FMT_CONSTEXPR
auto
end
(
const
C
&
c
)
->
decltype
(
c
.
end
())
{
return
c
.
end
();
}
template
<
typename
T
,
std
::
size_t
N
>
FMT_CONSTEXPR
T
*
end
(
T
(
&
array
)[
N
])
FMT_NOEXCEPT
{
return
array
+
N
;
}
struct
dummy_int
{
int
data
[
2
];
operator
int
()
const
{
return
0
;
}
...
...
@@ -2093,7 +2106,7 @@ template <typename Range>
class
arg_formatter
:
public
internal
::
arg_formatter_base
<
Range
>
{
private:
typedef
typename
Range
::
value_type
char_type
;
typedef
decltype
(
declval
<
Range
>
().
begin
())
iterator
;
typedef
decltype
(
internal
::
declval
<
Range
>
().
begin
())
iterator
;
typedef
internal
::
arg_formatter_base
<
Range
>
base
;
typedef
basic_context
<
iterator
,
char_type
>
context_type
;
...
...
@@ -2191,7 +2204,7 @@ template <typename Range>
class
basic_writer
{
public:
typedef
typename
Range
::
value_type
char_type
;
typedef
decltype
(
declval
<
Range
>
().
begin
())
iterator
;
typedef
decltype
(
internal
::
declval
<
Range
>
().
begin
())
iterator
;
typedef
basic_format_specs
<
char_type
>
format_specs
;
private:
...
...
@@ -2660,10 +2673,15 @@ void basic_writer<Range>::write_double(T value, const format_specs &spec) {
sign
=
spec
.
flag
(
PLUS_FLAG
)
?
'+'
:
' '
;
}
auto
write_inf_or_nan
=
[
this
,
&
spec
,
sign
](
const
char
*
str
)
{
this
->
write_padded
(
INF_SIZE
+
(
sign
?
1
:
0
),
spec
,
struct
write_inf_or_nan_t
{
basic_writer
&
writer
;
format_specs
spec
;
char
sign
;
void
operator
()(
const
char
*
str
)
const
{
writer
.
write_padded
(
INF_SIZE
+
(
sign
?
1
:
0
),
spec
,
inf_or_nan_writer
{
sign
,
str
});
};
}
}
write_inf_or_nan
=
{
*
this
,
spec
,
sign
};
// Format NaN and ininity ourselves because sprintf's output is not consistent
// across platforms.
...
...
@@ -3235,14 +3253,14 @@ arg_join<It, wchar_t> join(It begin, It end, wstring_view sep) {
#if FMT_USE_TRAILING_RETURN
template
<
typename
Range
>
auto
join
(
const
Range
&
range
,
string_view
sep
)
->
arg_join
<
decltype
(
std
::
begin
(
range
)),
char
>
{
return
join
(
std
::
begin
(
range
),
std
::
end
(
range
),
sep
);
->
arg_join
<
decltype
(
internal
::
begin
(
range
)),
char
>
{
return
join
(
internal
::
begin
(
range
),
internal
::
end
(
range
),
sep
);
}
template
<
typename
Range
>
auto
join
(
const
Range
&
range
,
wstring_view
sep
)
->
arg_join
<
decltype
(
std
::
begin
(
range
)),
wchar_t
>
{
return
join
(
std
::
begin
(
range
),
std
::
end
(
range
),
sep
);
->
arg_join
<
decltype
(
internal
::
begin
(
range
)),
wchar_t
>
{
return
join
(
internal
::
begin
(
range
),
internal
::
end
(
range
),
sep
);
}
#endif
...
...
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