basic_buffer -> buffer
This reduces symbol sizes and gets rid of shadowing warnings.
This commit is contained in:
@@ -241,10 +241,10 @@ FMT_CONSTEXPR typename std::make_unsigned<Int>::type to_unsigned(Int value) {
|
||||
}
|
||||
|
||||
/** A contiguous memory buffer with an optional growing ability. */
|
||||
template <typename T> class basic_buffer {
|
||||
template <typename T> class buffer {
|
||||
private:
|
||||
basic_buffer(const basic_buffer&) = delete;
|
||||
void operator=(const basic_buffer&) = delete;
|
||||
buffer(const buffer&) = delete;
|
||||
void operator=(const buffer&) = delete;
|
||||
|
||||
T* ptr_;
|
||||
std::size_t size_;
|
||||
@@ -252,12 +252,12 @@ template <typename T> class basic_buffer {
|
||||
|
||||
protected:
|
||||
// Don't initialize ptr_ since it is not accessed to save a few cycles.
|
||||
basic_buffer(std::size_t sz) FMT_NOEXCEPT : size_(sz), capacity_(sz) {}
|
||||
buffer(std::size_t sz) FMT_NOEXCEPT : size_(sz), capacity_(sz) {}
|
||||
|
||||
basic_buffer(T* p = FMT_NULL, std::size_t sz = 0,
|
||||
std::size_t cap = 0) FMT_NOEXCEPT : ptr_(p),
|
||||
size_(sz),
|
||||
capacity_(cap) {}
|
||||
buffer(T* p = FMT_NULL, std::size_t sz = 0, std::size_t cap = 0) FMT_NOEXCEPT
|
||||
: ptr_(p),
|
||||
size_(sz),
|
||||
capacity_(cap) {}
|
||||
|
||||
/** Sets the buffer data and capacity. */
|
||||
void set(T* buf_data, std::size_t buf_capacity) FMT_NOEXCEPT {
|
||||
@@ -272,7 +272,7 @@ template <typename T> class basic_buffer {
|
||||
typedef T value_type;
|
||||
typedef const T& const_reference;
|
||||
|
||||
virtual ~basic_buffer() {}
|
||||
virtual ~buffer() {}
|
||||
|
||||
T* begin() FMT_NOEXCEPT { return ptr_; }
|
||||
T* end() FMT_NOEXCEPT { return ptr_ + size_; }
|
||||
@@ -317,12 +317,9 @@ template <typename T> class basic_buffer {
|
||||
const T& operator[](std::size_t index) const { return ptr_[index]; }
|
||||
};
|
||||
|
||||
typedef basic_buffer<char> buffer;
|
||||
typedef basic_buffer<wchar_t> wbuffer;
|
||||
|
||||
// A container-backed buffer.
|
||||
template <typename Container>
|
||||
class container_buffer : public basic_buffer<typename Container::value_type> {
|
||||
class container_buffer : public buffer<typename Container::value_type> {
|
||||
private:
|
||||
Container& container_;
|
||||
|
||||
@@ -334,7 +331,7 @@ class container_buffer : public basic_buffer<typename Container::value_type> {
|
||||
|
||||
public:
|
||||
explicit container_buffer(Container& c)
|
||||
: basic_buffer<typename Container::value_type>(c.size()), container_(c) {}
|
||||
: buffer<typename Container::value_type>(c.size()), container_(c) {}
|
||||
};
|
||||
|
||||
// Extracts a reference to the container from back_insert_iterator.
|
||||
@@ -1141,7 +1138,7 @@ template <typename OutputIt, typename Char> class basic_format_context {
|
||||
|
||||
template <typename Char> struct buffer_context {
|
||||
typedef basic_format_context<
|
||||
std::back_insert_iterator<internal::basic_buffer<Char>>, Char>
|
||||
std::back_insert_iterator<internal::buffer<Char>>, Char>
|
||||
type;
|
||||
};
|
||||
typedef buffer_context<char>::type format_context;
|
||||
@@ -1381,7 +1378,7 @@ std::basic_string<Char> vformat(
|
||||
|
||||
template <typename Char>
|
||||
typename buffer_context<Char>::type::iterator vformat_to(
|
||||
internal::basic_buffer<Char>& buf, basic_string_view<Char> format_str,
|
||||
internal::buffer<Char>& buf, basic_string_view<Char> format_str,
|
||||
basic_format_args<typename buffer_context<Char>::type> args);
|
||||
} // namespace internal
|
||||
|
||||
@@ -1415,7 +1412,7 @@ template <typename Char>
|
||||
struct is_contiguous<std::basic_string<Char>> : std::true_type {};
|
||||
|
||||
template <typename Char>
|
||||
struct is_contiguous<internal::basic_buffer<Char>> : std::true_type {};
|
||||
struct is_contiguous<internal::buffer<Char>> : std::true_type {};
|
||||
|
||||
/** Formats a string and writes the output to ``out``. */
|
||||
template <typename Container, typename S>
|
||||
|
||||
@@ -85,7 +85,7 @@ inline int fmt_snprintf(char* buffer, size_t size, const char* format, ...) {
|
||||
# define FMT_SWPRINTF swprintf
|
||||
#endif // defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT)
|
||||
|
||||
typedef void (*FormatFunc)(internal::buffer&, int, string_view);
|
||||
typedef void (*FormatFunc)(internal::buffer<char>&, int, string_view);
|
||||
|
||||
// Portable thread-safe version of strerror.
|
||||
// Sets buffer to point to a string describing the error code.
|
||||
@@ -154,7 +154,7 @@ int safe_strerror(int error_code, char*& buffer,
|
||||
return dispatcher(error_code, buffer, buffer_size).run();
|
||||
}
|
||||
|
||||
void format_error_code(internal::buffer& out, int error_code,
|
||||
void format_error_code(internal::buffer<char>& out, int error_code,
|
||||
string_view message) FMT_NOEXCEPT {
|
||||
// Report error code making sure that the output fits into
|
||||
// inline_buffer_size to avoid dynamic memory allocation and potential
|
||||
@@ -661,7 +661,7 @@ struct shortest_handler {
|
||||
|
||||
template <typename Double, typename std::enable_if<
|
||||
sizeof(Double) == sizeof(uint64_t), int>::type>
|
||||
FMT_FUNC bool grisu2_format(Double value, buffer& buf, int precision,
|
||||
FMT_FUNC bool grisu2_format(Double value, buffer<char>& buf, int precision,
|
||||
bool fixed, int& exp) {
|
||||
FMT_ASSERT(value >= 0, "value is negative");
|
||||
if (value <= 0) { // <= instead of == to silence a warning.
|
||||
@@ -713,7 +713,7 @@ FMT_FUNC bool grisu2_format(Double value, buffer& buf, int precision,
|
||||
}
|
||||
|
||||
template <typename Double>
|
||||
void sprintf_format(Double value, internal::buffer& buf,
|
||||
void sprintf_format(Double value, internal::buffer<char>& buf,
|
||||
core_format_specs spec) {
|
||||
// Buffer capacity must be non-zero, otherwise MSVC's vsnprintf_s will fail.
|
||||
FMT_ASSERT(buf.capacity() != 0, "empty buffer");
|
||||
@@ -849,7 +849,7 @@ FMT_FUNC void windows_error::init(int err_code, string_view format_str,
|
||||
base = std::runtime_error(to_string(buffer));
|
||||
}
|
||||
|
||||
FMT_FUNC void internal::format_windows_error(internal::buffer& out,
|
||||
FMT_FUNC void internal::format_windows_error(internal::buffer<char>& out,
|
||||
int error_code,
|
||||
string_view message) FMT_NOEXCEPT {
|
||||
FMT_TRY {
|
||||
@@ -883,7 +883,7 @@ FMT_FUNC void internal::format_windows_error(internal::buffer& out,
|
||||
|
||||
#endif // FMT_USE_WINDOWS_H
|
||||
|
||||
FMT_FUNC void format_system_error(internal::buffer& out, int error_code,
|
||||
FMT_FUNC void format_system_error(internal::buffer<char>& out, int error_code,
|
||||
string_view message) FMT_NOEXCEPT {
|
||||
FMT_TRY {
|
||||
memory_buffer buf;
|
||||
|
||||
@@ -352,8 +352,8 @@ class back_insert_range
|
||||
back_insert_range(typename base::iterator it) : base(it) {}
|
||||
};
|
||||
|
||||
typedef basic_writer<back_insert_range<internal::buffer>> writer;
|
||||
typedef basic_writer<back_insert_range<internal::wbuffer>> wwriter;
|
||||
typedef basic_writer<back_insert_range<internal::buffer<char>>> writer;
|
||||
typedef basic_writer<back_insert_range<internal::buffer<wchar_t>>> wwriter;
|
||||
|
||||
/** A formatting error such as invalid format string. */
|
||||
class format_error : public std::runtime_error {
|
||||
@@ -383,7 +383,7 @@ template <typename T> inline T* make_checked(T* p, std::size_t) { return p; }
|
||||
|
||||
template <typename T>
|
||||
template <typename U>
|
||||
void basic_buffer<T>::append(const U* begin, const U* end) {
|
||||
void buffer<T>::append(const U* begin, const U* end) {
|
||||
std::size_t new_size = size_ + internal::to_unsigned(end - begin);
|
||||
reserve(new_size);
|
||||
std::uninitialized_copy(begin, end,
|
||||
@@ -454,8 +454,7 @@ enum { inline_buffer_size = 500 };
|
||||
*/
|
||||
template <typename T, std::size_t SIZE = inline_buffer_size,
|
||||
typename Allocator = std::allocator<T>>
|
||||
class basic_memory_buffer : private Allocator,
|
||||
public internal::basic_buffer<T> {
|
||||
class basic_memory_buffer : private Allocator, public internal::buffer<T> {
|
||||
private:
|
||||
T store_[SIZE];
|
||||
|
||||
@@ -1087,7 +1086,8 @@ class utf16_to_utf8 {
|
||||
FMT_API int convert(wstring_view s);
|
||||
};
|
||||
|
||||
FMT_API void format_windows_error(fmt::internal::buffer& out, int error_code,
|
||||
FMT_API void format_windows_error(fmt::internal::buffer<char>& out,
|
||||
int error_code,
|
||||
fmt::string_view message) FMT_NOEXCEPT;
|
||||
#endif
|
||||
|
||||
@@ -1149,10 +1149,10 @@ namespace internal {
|
||||
// Formats value using Grisu2 algorithm:
|
||||
// https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf
|
||||
template <typename Double, FMT_ENABLE_IF(sizeof(Double) == sizeof(uint64_t))>
|
||||
FMT_API bool grisu2_format(Double value, buffer& buf, int precision, bool fixed,
|
||||
int& exp);
|
||||
FMT_API bool grisu2_format(Double value, buffer<char>& buf, int precision,
|
||||
bool fixed, int& exp);
|
||||
template <typename Double, FMT_ENABLE_IF(sizeof(Double) != sizeof(uint64_t))>
|
||||
inline bool grisu2_format(Double, buffer&, int, bool, int&) {
|
||||
inline bool grisu2_format(Double, buffer<char>&, int, bool, int&) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1242,7 +1242,7 @@ It grisu2_prettify(const char* digits, int size, int exp, It it,
|
||||
}
|
||||
|
||||
template <typename Double>
|
||||
void sprintf_format(Double, internal::buffer&, core_format_specs);
|
||||
void sprintf_format(Double, internal::buffer<char>&, core_format_specs);
|
||||
|
||||
template <typename Handler>
|
||||
FMT_CONSTEXPR void handle_int_type_spec(char spec, Handler&& handler) {
|
||||
@@ -2405,7 +2405,7 @@ class system_error : public std::runtime_error {
|
||||
may look like "Unknown error -1" and is platform-dependent.
|
||||
\endrst
|
||||
*/
|
||||
FMT_API void format_system_error(internal::buffer& out, int error_code,
|
||||
FMT_API void format_system_error(internal::buffer<char>& out, int error_code,
|
||||
fmt::string_view message) FMT_NOEXCEPT;
|
||||
|
||||
/**
|
||||
@@ -2654,7 +2654,7 @@ template <typename Range> class basic_writer {
|
||||
|
||||
struct double_writer {
|
||||
char sign;
|
||||
internal::buffer& buffer;
|
||||
internal::buffer<char>& buffer;
|
||||
|
||||
size_t size() const { return buffer.size() + (sign ? 1 : 0); }
|
||||
size_t width() const { return size(); }
|
||||
@@ -2667,14 +2667,14 @@ template <typename Range> class basic_writer {
|
||||
|
||||
class grisu_writer {
|
||||
private:
|
||||
internal::buffer& digits_;
|
||||
internal::buffer<char>& digits_;
|
||||
size_t size_;
|
||||
char sign_;
|
||||
int exp_;
|
||||
internal::gen_digits_params params_;
|
||||
|
||||
public:
|
||||
grisu_writer(char sign, internal::buffer& digits, int exp,
|
||||
grisu_writer(char sign, internal::buffer<char>& digits, int exp,
|
||||
const internal::gen_digits_params& params)
|
||||
: digits_(digits), sign_(sign), exp_(exp), params_(params) {
|
||||
int num_digits = static_cast<int>(digits.size());
|
||||
@@ -3392,9 +3392,9 @@ std::basic_string<Char> to_string(const basic_memory_buffer<Char, SIZE>& buf) {
|
||||
|
||||
template <typename Char>
|
||||
typename buffer_context<Char>::type::iterator internal::vformat_to(
|
||||
internal::basic_buffer<Char>& buf, basic_string_view<Char> format_str,
|
||||
internal::buffer<Char>& buf, basic_string_view<Char> format_str,
|
||||
basic_format_args<typename buffer_context<Char>::type> args) {
|
||||
typedef back_insert_range<internal::basic_buffer<Char>> range;
|
||||
typedef back_insert_range<internal::buffer<Char>> range;
|
||||
return vformat_to<arg_formatter<range>>(buf, to_string_view(format_str),
|
||||
args);
|
||||
}
|
||||
@@ -3402,7 +3402,7 @@ typename buffer_context<Char>::type::iterator internal::vformat_to(
|
||||
template <typename S, typename Char = FMT_CHAR(S),
|
||||
FMT_ENABLE_IF(internal::is_string<S>::value)>
|
||||
inline typename buffer_context<Char>::type::iterator vformat_to(
|
||||
internal::basic_buffer<Char>& buf, const S& format_str,
|
||||
internal::buffer<Char>& buf, const S& format_str,
|
||||
basic_format_args<typename buffer_context<Char>::type> args) {
|
||||
return internal::vformat_to(buf, to_string_view(format_str), args);
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@ FMT_BEGIN_NAMESPACE
|
||||
namespace internal {
|
||||
template <typename Char>
|
||||
typename buffer_context<Char>::type::iterator vformat_to(
|
||||
const std::locale& loc, basic_buffer<Char>& buf,
|
||||
const std::locale& loc, buffer<Char>& buf,
|
||||
basic_string_view<Char> format_str,
|
||||
basic_format_args<typename buffer_context<Char>::type> args) {
|
||||
typedef back_insert_range<basic_buffer<Char>> range;
|
||||
typedef back_insert_range<buffer<Char>> range;
|
||||
return vformat_to<arg_formatter<range>>(buf, to_string_view(format_str), args,
|
||||
internal::locale_ref(loc));
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ template <class Char> class formatbuf : public std::basic_streambuf<Char> {
|
||||
typedef typename std::basic_streambuf<Char>::int_type int_type;
|
||||
typedef typename std::basic_streambuf<Char>::traits_type traits_type;
|
||||
|
||||
basic_buffer<Char>& buffer_;
|
||||
buffer<Char>& buffer_;
|
||||
|
||||
public:
|
||||
formatbuf(basic_buffer<Char>& buffer) : buffer_(buffer) {}
|
||||
formatbuf(buffer<Char>& buffer) : buffer_(buffer) {}
|
||||
|
||||
protected:
|
||||
// The put-area is actually always empty. This makes the implementation
|
||||
@@ -71,7 +71,7 @@ template <typename T, typename Char> class is_streamable {
|
||||
|
||||
// Write the content of buf to os.
|
||||
template <typename Char>
|
||||
void write(std::basic_ostream<Char>& os, basic_buffer<Char>& buf) {
|
||||
void write(std::basic_ostream<Char>& os, buffer<Char>& buf) {
|
||||
const Char* data = buf.data();
|
||||
typedef std::make_unsigned<std::streamsize>::type UnsignedStreamSize;
|
||||
UnsignedStreamSize size = buf.size();
|
||||
@@ -86,7 +86,7 @@ void write(std::basic_ostream<Char>& os, basic_buffer<Char>& buf) {
|
||||
}
|
||||
|
||||
template <typename Char, typename T>
|
||||
void format_value(basic_buffer<Char>& buffer, const T& value) {
|
||||
void format_value(buffer<Char>& buffer, const T& value) {
|
||||
internal::formatbuf<Char> format_buf(buffer);
|
||||
std::basic_ostream<Char> output(&format_buf);
|
||||
output.exceptions(std::ios_base::failbit | std::ios_base::badbit);
|
||||
|
||||
@@ -216,7 +216,7 @@ class prepared_format {
|
||||
|
||||
std::basic_string<char_type> format(const Args&... args) const {
|
||||
basic_memory_buffer<char_type> buffer;
|
||||
typedef back_insert_range<internal::basic_buffer<char_type>> range;
|
||||
typedef back_insert_range<internal::buffer<char_type>> range;
|
||||
this->vformat_to(range(buffer), make_args_checked(format_, args...));
|
||||
return to_string(buffer);
|
||||
}
|
||||
@@ -225,7 +225,7 @@ class prepared_format {
|
||||
inline std::back_insert_iterator<Container> format_to(
|
||||
std::back_insert_iterator<Container> out, const Args&... args) const {
|
||||
internal::container_buffer<Container> buffer(internal::get_container(out));
|
||||
typedef back_insert_range<internal::basic_buffer<char_type>> range;
|
||||
typedef back_insert_range<internal::buffer<char_type>> range;
|
||||
this->vformat_to(range(buffer), make_args_checked(format_, args...));
|
||||
return out;
|
||||
}
|
||||
@@ -241,7 +241,7 @@ class prepared_format {
|
||||
template <std::size_t SIZE = inline_buffer_size>
|
||||
inline typename buffer_context<char_type>::type::iterator format_to(
|
||||
basic_memory_buffer<char_type, SIZE>& buf, const Args&... args) const {
|
||||
typedef back_insert_range<internal::basic_buffer<char_type>> range;
|
||||
typedef back_insert_range<internal::buffer<char_type>> range;
|
||||
return this->vformat_to(range(buf), make_args_checked(format_, args...));
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ class printf_width_handler : public function<unsigned> {
|
||||
};
|
||||
|
||||
template <typename Char, typename Context>
|
||||
void printf(basic_buffer<Char>& buf, basic_string_view<Char> format,
|
||||
void printf(buffer<Char>& buf, basic_string_view<Char> format,
|
||||
basic_format_args<Context> args) {
|
||||
Context(std::back_inserter(buf), format, args).format();
|
||||
}
|
||||
@@ -198,8 +198,8 @@ using internal::printf; // For printing into memory_buffer.
|
||||
template <typename Range> class printf_arg_formatter;
|
||||
|
||||
template <typename OutputIt, typename Char,
|
||||
typename ArgFormatter = printf_arg_formatter<
|
||||
back_insert_range<internal::basic_buffer<Char>>>>
|
||||
typename ArgFormatter =
|
||||
printf_arg_formatter<back_insert_range<internal::buffer<Char>>>>
|
||||
class basic_printf_context;
|
||||
|
||||
/**
|
||||
@@ -578,8 +578,8 @@ template <typename Buffer> struct basic_printf_context_t {
|
||||
type;
|
||||
};
|
||||
|
||||
typedef basic_printf_context_t<internal::buffer>::type printf_context;
|
||||
typedef basic_printf_context_t<internal::wbuffer>::type wprintf_context;
|
||||
typedef basic_printf_context_t<internal::buffer<char>>::type printf_context;
|
||||
typedef basic_printf_context_t<internal::buffer<wchar_t>>::type wprintf_context;
|
||||
|
||||
typedef basic_format_args<printf_context> printf_args;
|
||||
typedef basic_format_args<wprintf_context> wprintf_args;
|
||||
@@ -612,7 +612,7 @@ template <typename S, typename Char = FMT_CHAR(S)>
|
||||
inline std::basic_string<Char> vsprintf(
|
||||
const S& format,
|
||||
basic_format_args<
|
||||
typename basic_printf_context_t<internal::basic_buffer<Char>>::type>
|
||||
typename basic_printf_context_t<internal::buffer<Char>>::type>
|
||||
args) {
|
||||
basic_memory_buffer<Char> buffer;
|
||||
printf(buffer, to_string_view(format), args);
|
||||
@@ -633,7 +633,7 @@ template <typename S, typename... Args,
|
||||
inline std::basic_string<FMT_CHAR(S)> sprintf(const S& format,
|
||||
const Args&... args) {
|
||||
internal::check_format_string<Args...>(format);
|
||||
typedef internal::basic_buffer<FMT_CHAR(S)> buffer;
|
||||
typedef internal::buffer<FMT_CHAR(S)> buffer;
|
||||
typedef typename basic_printf_context_t<buffer>::type context;
|
||||
format_arg_store<context, Args...> as{args...};
|
||||
return vsprintf(to_string_view(format), basic_format_args<context>(as));
|
||||
@@ -643,7 +643,7 @@ template <typename S, typename Char = FMT_CHAR(S)>
|
||||
inline int vfprintf(
|
||||
std::FILE* f, const S& format,
|
||||
basic_format_args<
|
||||
typename basic_printf_context_t<internal::basic_buffer<Char>>::type>
|
||||
typename basic_printf_context_t<internal::buffer<Char>>::type>
|
||||
args) {
|
||||
basic_memory_buffer<Char> buffer;
|
||||
printf(buffer, to_string_view(format), args);
|
||||
@@ -666,7 +666,7 @@ template <typename S, typename... Args,
|
||||
FMT_ENABLE_IF(internal::is_string<S>::value)>
|
||||
inline int fprintf(std::FILE* f, const S& format, const Args&... args) {
|
||||
internal::check_format_string<Args...>(format);
|
||||
typedef internal::basic_buffer<FMT_CHAR(S)> buffer;
|
||||
typedef internal::buffer<FMT_CHAR(S)> buffer;
|
||||
typedef typename basic_printf_context_t<buffer>::type context;
|
||||
format_arg_store<context, Args...> as{args...};
|
||||
return vfprintf(f, to_string_view(format), basic_format_args<context>(as));
|
||||
@@ -676,7 +676,7 @@ template <typename S, typename Char = FMT_CHAR(S)>
|
||||
inline int vprintf(
|
||||
const S& format,
|
||||
basic_format_args<
|
||||
typename basic_printf_context_t<internal::basic_buffer<Char>>::type>
|
||||
typename basic_printf_context_t<internal::buffer<Char>>::type>
|
||||
args) {
|
||||
return vfprintf(stdout, to_string_view(format), args);
|
||||
}
|
||||
@@ -694,7 +694,7 @@ template <typename S, typename... Args,
|
||||
FMT_ENABLE_IF(internal::is_string<S>::value)>
|
||||
inline int printf(const S& format_str, const Args&... args) {
|
||||
internal::check_format_string<Args...>(format_str);
|
||||
typedef internal::basic_buffer<FMT_CHAR(S)> buffer;
|
||||
typedef internal::buffer<FMT_CHAR(S)> buffer;
|
||||
typedef typename basic_printf_context_t<buffer>::type context;
|
||||
format_arg_store<context, Args...> as{args...};
|
||||
return vprintf(to_string_view(format_str), basic_format_args<context>(as));
|
||||
@@ -704,7 +704,7 @@ template <typename S, typename Char = FMT_CHAR(S)>
|
||||
inline int vfprintf(
|
||||
std::basic_ostream<Char>& os, const S& format,
|
||||
basic_format_args<
|
||||
typename basic_printf_context_t<internal::basic_buffer<Char>>::type>
|
||||
typename basic_printf_context_t<internal::buffer<Char>>::type>
|
||||
args) {
|
||||
basic_memory_buffer<Char> buffer;
|
||||
printf(buffer, to_string_view(format), args);
|
||||
@@ -726,7 +726,7 @@ template <typename S, typename... Args,
|
||||
inline int fprintf(std::basic_ostream<FMT_CHAR(S)>& os, const S& format_str,
|
||||
const Args&... args) {
|
||||
internal::check_format_string<Args...>(format_str);
|
||||
typedef internal::basic_buffer<FMT_CHAR(S)> buffer;
|
||||
typedef internal::buffer<FMT_CHAR(S)> buffer;
|
||||
typedef typename basic_printf_context_t<buffer>::type context;
|
||||
format_arg_store<context, Args...> as{args...};
|
||||
return vfprintf(os, to_string_view(format_str),
|
||||
|
||||
@@ -41,10 +41,10 @@ namespace std {
|
||||
template<class O, class charT> FMT_REQUIRES(OutputIterator<O, const charT&>)
|
||||
class basic_format_context;
|
||||
using format_context = basic_format_context<
|
||||
/* unspecified */ std::back_insert_iterator<fmt::internal::basic_buffer<char>>,
|
||||
/* unspecified */ std::back_insert_iterator<fmt::internal::buffer<char>>,
|
||||
char>;
|
||||
using wformat_context = basic_format_context<
|
||||
/* unspecified */ std::back_insert_iterator<fmt::internal::basic_buffer<wchar_t>>,
|
||||
/* unspecified */ std::back_insert_iterator<fmt::internal::buffer<wchar_t>>,
|
||||
wchar_t>;
|
||||
|
||||
template<class T, class charT = char> struct formatter {
|
||||
@@ -686,8 +686,8 @@ template<class... Args>
|
||||
|
||||
string vformat(string_view fmt, format_args args) {
|
||||
fmt::memory_buffer mbuf;
|
||||
fmt::internal::buffer& buf = mbuf;
|
||||
typedef fmt::back_insert_range<fmt::internal::buffer> range;
|
||||
fmt::internal::buffer<char>& buf = mbuf;
|
||||
typedef fmt::back_insert_range<fmt::internal::buffer<char>> range;
|
||||
detail::format_handler<detail::arg_formatter<range>, char, format_context>
|
||||
h(range(std::back_inserter(buf)), fmt, args, {});
|
||||
fmt::internal::parse_format_string<false>(fmt::to_string_view(fmt), h);
|
||||
|
||||
Reference in New Issue
Block a user