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
6b55c832
Commit
6b55c832
authored
Sep 05, 2021
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
is_const_formattable -> has_const_formatter
parent
2fe94ad7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
include/fmt/core.h
include/fmt/core.h
+6
-6
test/core-test.cc
test/core-test.cc
+4
-4
No files found.
include/fmt/core.h
View file @
6b55c832
...
@@ -684,19 +684,19 @@ class appender;
...
@@ -684,19 +684,19 @@ class appender;
FMT_BEGIN_DETAIL_NAMESPACE
FMT_BEGIN_DETAIL_NAMESPACE
template
<
typename
Context
,
typename
T
>
template
<
typename
Context
,
typename
T
>
constexpr
auto
is_const_formattable
_impl
(
T
*
)
constexpr
auto
has_const_formatter
_impl
(
T
*
)
->
decltype
(
typename
Context
::
template
formatter_type
<
T
>().
format
(
->
decltype
(
typename
Context
::
template
formatter_type
<
T
>().
format
(
std
::
declval
<
const
T
&>
(),
std
::
declval
<
Context
&>
()),
std
::
declval
<
const
T
&>
(),
std
::
declval
<
Context
&>
()),
true
)
{
true
)
{
return
true
;
return
true
;
}
}
template
<
typename
Context
>
template
<
typename
Context
>
constexpr
auto
is_const_formattable
_impl
(...)
->
bool
{
constexpr
auto
has_const_formatter
_impl
(...)
->
bool
{
return
false
;
return
false
;
}
}
template
<
typename
T
,
typename
Context
>
template
<
typename
T
,
typename
Context
>
constexpr
auto
is_const_formattable
()
->
bool
{
constexpr
auto
has_const_formatter
()
->
bool
{
return
is_const_formattable
_impl
<
Context
>
(
static_cast
<
T
*>
(
nullptr
));
return
has_const_formatter
_impl
<
Context
>
(
static_cast
<
T
*>
(
nullptr
));
}
}
// Extracts a reference to the container from back_insert_iterator.
// Extracts a reference to the container from back_insert_iterator.
...
@@ -1186,7 +1186,7 @@ template <typename Context> class value {
...
@@ -1186,7 +1186,7 @@ template <typename Context> class value {
auto
f
=
Formatter
();
auto
f
=
Formatter
();
parse_ctx
.
advance_to
(
f
.
parse
(
parse_ctx
));
parse_ctx
.
advance_to
(
f
.
parse
(
parse_ctx
));
using
qualified_type
=
using
qualified_type
=
conditional_t
<
is_const_formattable
<
T
,
Context
>
(),
const
T
,
T
>
;
conditional_t
<
has_const_formatter
<
T
,
Context
>
(),
const
T
,
T
>
;
ctx
.
advance_to
(
f
.
format
(
*
static_cast
<
qualified_type
*>
(
arg
),
ctx
));
ctx
.
advance_to
(
f
.
format
(
*
static_cast
<
qualified_type
*>
(
arg
),
ctx
));
}
}
};
};
...
@@ -1335,7 +1335,7 @@ template <typename Context> struct arg_mapper {
...
@@ -1335,7 +1335,7 @@ template <typename Context> struct arg_mapper {
template
<
typename
T
,
typename
U
=
remove_cvref_t
<
T
>
>
template
<
typename
T
,
typename
U
=
remove_cvref_t
<
T
>
>
struct
formattable
struct
formattable
:
bool_constant
<
is_const_formattable
<
U
,
Context
>
()
||
:
bool_constant
<
has_const_formatter
<
U
,
Context
>
()
||
!
std
::
is_const
<
remove_reference_t
<
T
>>::
value
||
!
std
::
is_const
<
remove_reference_t
<
T
>>::
value
||
has_fallback_formatter
<
U
,
char_type
>::
value
>
{};
has_fallback_formatter
<
U
,
char_type
>::
value
>
{};
...
...
test/core-test.cc
View file @
6b55c832
...
@@ -891,11 +891,11 @@ TEST(core_test, adl) {
...
@@ -891,11 +891,11 @@ TEST(core_test, adl) {
fmt
::
print
(
stdout
,
"{}"
,
s
);
fmt
::
print
(
stdout
,
"{}"
,
s
);
}
}
TEST
(
core_test
,
is_const_formattable
)
{
TEST
(
core_test
,
has_const_formatter
)
{
EXPECT_TRUE
((
fmt
::
detail
::
is_const_formattable
<
const_formattable
,
EXPECT_TRUE
((
fmt
::
detail
::
has_const_formatter
<
const_formattable
,
fmt
::
format_context
>
()));
EXPECT_FALSE
((
fmt
::
detail
::
has_const_formatter
<
nonconst_formattable
,
fmt
::
format_context
>
()));
fmt
::
format_context
>
()));
EXPECT_FALSE
((
fmt
::
detail
::
is_const_formattable
<
nonconst_formattable
,
fmt
::
format_context
>
()));
}
}
TEST
(
core_test
,
format_nonconst
)
{
TEST
(
core_test
,
format_nonconst
)
{
...
...
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