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
c18a4041
Commit
c18a4041
authored
Sep 04, 2017
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove conditional and to_iterator
parent
1cade7ef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
35 deletions
+2
-35
fmt/format.h
fmt/format.h
+1
-25
fmt/printf.h
fmt/printf.h
+1
-1
test/util-test.cc
test/util-test.cc
+0
-9
No files found.
fmt/format.h
View file @
c18a4041
...
...
@@ -768,12 +768,6 @@ class char_traits<wchar_t> : public basic_char_traits<wchar_t> {
const
wchar_t
*
format
,
unsigned
width
,
int
precision
,
T
value
);
};
template
<
bool
B
,
class
T
,
class
F
>
struct
conditional
{
typedef
T
type
;
};
template
<
class
T
,
class
F
>
struct
conditional
<
false
,
T
,
F
>
{
typedef
F
type
;
};
template
<
typename
Char
>
class
null_terminating_iterator
;
...
...
@@ -851,24 +845,6 @@ class null_terminating_iterator {
const
Char
*
end_
;
};
template
<
typename
T
,
typename
Char
,
typename
std
::
enable_if
<
std
::
is_same
<
T
,
null_terminating_iterator
<
Char
>
>::
value
,
int
>::
type
=
0
>
null_terminating_iterator
<
Char
>
to_iterator
(
basic_string_view
<
Char
>
v
)
{
const
Char
*
s
=
v
.
data
();
return
null_terminating_iterator
<
Char
>
(
s
,
s
+
v
.
size
());
}
template
<
typename
T
,
typename
Char
,
typename
std
::
enable_if
<
std
::
is_same
<
T
,
const
Char
*
>
::
value
,
int
>::
type
=
0
>
const
Char
*
to_iterator
(
basic_string_view
<
Char
>
v
)
{
return
v
.
data
();
}
template
<
typename
T
>
const
T
*
pointer_from
(
const
T
*
p
)
{
return
p
;
}
...
...
@@ -894,7 +870,7 @@ template <typename T>
struct
int_traits
{
// Smallest of uint32_t and uint64_t that is large enough to represent
// all values of T.
typedef
typename
conditional
<
typedef
typename
std
::
conditional
<
std
::
numeric_limits
<
T
>::
digits
<=
32
,
uint32_t
,
uint64_t
>::
type
main_type
;
};
...
...
fmt/printf.h
View file @
c18a4041
...
...
@@ -99,7 +99,7 @@ class ArgConverter {
typename
std
::
enable_if
<
std
::
is_integral
<
U
>::
value
>::
type
operator
()(
U
value
)
{
bool
is_signed
=
type_
==
'd'
||
type_
==
'i'
;
typedef
typename
internal
::
conditional
<
typedef
typename
std
::
conditional
<
std
::
is_same
<
T
,
void
>::
value
,
U
,
T
>::
type
TargetType
;
if
(
sizeof
(
TargetType
)
<=
sizeof
(
int
))
{
// Extra casts are used to silence warnings.
...
...
test/util-test.cc
View file @
c18a4041
...
...
@@ -839,12 +839,3 @@ TEST(UtilTest, IsEnumConvertibleToInt) {
EXPECT_TRUE
(
fmt
::
internal
::
convert_to_int
<
TestEnum
>::
enable_conversion
);
}
#endif
TEST
(
UtilTest
,
Conditional
)
{
int
i
=
0
;
fmt
::
internal
::
conditional
<
true
,
int
,
char
>::
type
*
pi
=
&
i
;
(
void
)
pi
;
char
c
=
0
;
fmt
::
internal
::
conditional
<
false
,
int
,
char
>::
type
*
pc
=
&
c
;
(
void
)
pc
;
}
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