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
20931baf
Commit
20931baf
authored
Sep 03, 2021
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable fallback_formatter for arrays
parent
d58d19ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
include/fmt/ostream.h
include/fmt/ostream.h
+6
-2
test/header-only-test.cc
test/header-only-test.cc
+4
-0
No files found.
include/fmt/ostream.h
View file @
20931baf
...
@@ -70,8 +70,7 @@ void_t<> operator<<(std::basic_ostream<char, Traits>&, signed char);
...
@@ -70,8 +70,7 @@ void_t<> operator<<(std::basic_ostream<char, Traits>&, signed char);
template
<
typename
Traits
>
template
<
typename
Traits
>
void_t
<>
operator
<<
(
std
::
basic_ostream
<
char
,
Traits
>&
,
unsigned
char
);
void_t
<>
operator
<<
(
std
::
basic_ostream
<
char
,
Traits
>&
,
unsigned
char
);
// Checks if T has a user-defined operator<< (e.g. not a member of
// Checks if T has a user-defined operator<< e.g. not a member of std::ostream.
// std::ostream).
template
<
typename
T
,
typename
Char
>
class
is_streamable
{
template
<
typename
T
,
typename
Char
>
class
is_streamable
{
private:
private:
template
<
typename
U
>
template
<
typename
U
>
...
@@ -90,6 +89,11 @@ template <typename T, typename Char> class is_streamable {
...
@@ -90,6 +89,11 @@ template <typename T, typename Char> class is_streamable {
static
const
bool
value
=
result
::
value
;
static
const
bool
value
=
result
::
value
;
};
};
// Formatting of arrays is intentionally disabled to prevent conflicts with
// standard (non-ostream) formatters.
template
<
typename
T
,
size_t
N
,
typename
Char
>
struct
is_streamable
<
T
[
N
],
Char
>
:
std
::
false_type
{};
// Write the content of buf to os.
// Write the content of buf to os.
template
<
typename
Char
>
template
<
typename
Char
>
void
write_buffer
(
std
::
basic_ostream
<
Char
>&
os
,
buffer
<
Char
>&
buf
)
{
void
write_buffer
(
std
::
basic_ostream
<
Char
>&
os
,
buffer
<
Char
>&
buf
)
{
...
...
test/header-only-test.cc
View file @
20931baf
// Header-only configuration test
// Header-only configuration test
#include "fmt/core.h"
#include "fmt/core.h"
#include "fmt/ostream.h"
#include "gtest/gtest.h"
#ifndef FMT_HEADER_ONLY
#ifndef FMT_HEADER_ONLY
# error "Not in the header-only mode."
# error "Not in the header-only mode."
#endif
#endif
TEST
(
header_only_test
,
format
)
{
EXPECT_EQ
(
fmt
::
format
(
"foo"
),
"foo"
);
}
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