mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-13 22:50:05 +00:00
Disable fallback_formatter for arrays
This commit is contained in:
parent
d58d19ba32
commit
20931baf1d
@ -70,8 +70,7 @@ void_t<> operator<<(std::basic_ostream<char, Traits>&, signed char);
|
||||
template <typename Traits>
|
||||
void_t<> operator<<(std::basic_ostream<char, Traits>&, unsigned char);
|
||||
|
||||
// Checks if T has a user-defined operator<< (e.g. not a member of
|
||||
// std::ostream).
|
||||
// Checks if T has a user-defined operator<< e.g. not a member of std::ostream.
|
||||
template <typename T, typename Char> class is_streamable {
|
||||
private:
|
||||
template <typename U>
|
||||
@ -90,6 +89,11 @@ template <typename T, typename Char> class is_streamable {
|
||||
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.
|
||||
template <typename Char>
|
||||
void write_buffer(std::basic_ostream<Char>& os, buffer<Char>& buf) {
|
||||
|
@ -1,7 +1,11 @@
|
||||
// Header-only configuration test
|
||||
|
||||
#include "fmt/core.h"
|
||||
#include "fmt/ostream.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#ifndef FMT_HEADER_ONLY
|
||||
# error "Not in the header-only mode."
|
||||
#endif
|
||||
|
||||
TEST(header_only_test, format) { EXPECT_EQ(fmt::format("foo"), "foo"); }
|
||||
|
Loading…
Reference in New Issue
Block a user