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
24d249b0
Commit
24d249b0
authored
Feb 19, 2018
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix formatting of objects convertible to string_view
parent
e508e308
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
include/fmt/core.h
include/fmt/core.h
+3
-1
test/format-test.cc
test/format-test.cc
+8
-0
No files found.
include/fmt/core.h
View file @
24d249b0
...
...
@@ -570,7 +570,8 @@ FMT_MAKE_VALUE(cstring_type, signed char*, const signed char*)
FMT_MAKE_VALUE
(
cstring_type
,
const
signed
char
*
,
const
signed
char
*
)
FMT_MAKE_VALUE
(
cstring_type
,
unsigned
char
*
,
const
unsigned
char
*
)
FMT_MAKE_VALUE
(
cstring_type
,
const
unsigned
char
*
,
const
unsigned
char
*
)
FMT_MAKE_VALUE
(
string_type
,
basic_string_view
<
Char
>
,
basic_string_view
<
Char
>
)
FMT_MAKE_VALUE
(
string_type
,
basic_string_view
<
typename
C
::
char_type
>
,
basic_string_view
<
Char
>
)
FMT_MAKE_VALUE
(
string_type
,
const
std
::
basic_string
<
typename
C
::
char_type
>&
,
basic_string_view
<
Char
>
)
FMT_MAKE_VALUE
(
pointer_type
,
void
*
,
const
void
*
)
...
...
@@ -595,6 +596,7 @@ inline typename std::enable_if<
template
<
typename
C
,
typename
T
,
typename
Char
=
typename
C
::
char_type
>
inline
typename
std
::
enable_if
<
!
convert_to_int
<
T
,
Char
>::
value
&&
!
std
::
is_convertible
<
T
,
basic_string_view
<
Char
>>::
value
&&
!
std
::
is_convertible
<
T
,
std
::
basic_string
<
Char
>>::
value
,
typed_value
<
C
,
custom_type
>>::
type
make_value
(
const
T
&
val
)
{
return
val
;
}
...
...
test/format-test.cc
View file @
24d249b0
...
...
@@ -1223,6 +1223,14 @@ TEST(FormatterTest, FormatConvertibleToString) {
EXPECT_EQ
(
"foo"
,
format
(
"{}"
,
ConvertibleToString
()));
}
struct
ConvertibleToStringView
{
operator
fmt
::
string_view
()
const
{
return
"foo"
;
}
};
TEST
(
FormatterTest
,
FormatConvertibleToStringView
)
{
EXPECT_EQ
(
"foo"
,
format
(
"{}"
,
ConvertibleToStringView
()));
}
namespace
fmt
{
template
<
>
struct
formatter
<
Date
>
{
...
...
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