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
5efb24dd
Commit
5efb24dd
authored
Apr 19, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specialization test
parent
946498cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
include/fmt/ostream.h
include/fmt/ostream.h
+5
-3
test/ostream-test.cc
test/ostream-test.cc
+15
-0
No files found.
include/fmt/ostream.h
View file @
5efb24dd
...
...
@@ -112,9 +112,11 @@ struct fallback_formatter<
// Disable conversion to int if T has an overloaded operator<< which is a free
// function (not a member of std::ostream).
template
<
typename
T
,
typename
Char
>
struct
convert_to_int
<
T
,
Char
,
void
>
{
static
const
bool
value
=
convert_to_int
<
T
,
Char
,
int
>::
value
&&
!
internal
::
is_streamable
<
T
,
Char
>::
value
;
template
<
typename
T
,
typename
Char
>
struct
convert_to_int
<
T
,
Char
,
typename
std
::
enable_if
<
internal
::
is_streamable
<
T
,
Char
>::
value
>::
type
>
{
static
const
bool
value
=
false
;
};
template
<
typename
Char
>
...
...
test/ostream-test.cc
View file @
5efb24dd
...
...
@@ -6,6 +6,21 @@
// For the license information refer to format.h.
#define FMT_STRING_ALIAS 1
#include "fmt/format.h"
struct
test
{};
// Test that there is no issues with specializations when fmt/ostream.h is
// included after fmt/format.h.
namespace
fmt
{
template
<
>
struct
formatter
<
test
>
:
formatter
<
int
>
{
template
<
typename
FormatContext
>
typename
FormatContext
::
iterator
format
(
const
test
&
,
FormatContext
&
ctx
)
{
return
formatter
<
int
>::
format
(
42
,
ctx
);
}
};
}
// namespace fmt
#include "fmt/ostream.h"
#include <sstream>
...
...
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