Remove fmt/folly.h and clean up core API

This commit is contained in:
Victor Zverovich
2018-07-22 14:42:25 -07:00
parent 35538ca66c
commit 5befe6584d
5 changed files with 6 additions and 46 deletions

View File

@@ -385,9 +385,7 @@ class basic_buffer {
}
/** Clears this buffer. */
void clear() {
size_ = 0;
}
void clear() { size_ = 0; }
/** Reserves space to store at least *capacity* elements. */
void reserve(std::size_t new_capacity) {
@@ -1356,14 +1354,13 @@ template <typename String, typename... Args>
inline std::basic_string<
typename internal::format_string_traits<String>::char_type>
format(const String &format_str, const Args & ... args) {
typedef typename internal::format_string_traits<String>::char_type char_type;
internal::check_format_string<Args...>(format_str);
// This should be just
// return vformat(format_str, make_format_args(args...));
// but gcc has trouble optimizing the latter, so break it down.
typedef typename buffer_context<char_type>::type context_type;
format_arg_store<context_type, Args...> as{args...};
return vformat(basic_string_view<char_type>(format_str), as);
typedef typename internal::format_string_traits<String>::char_type char_t;
format_arg_store<typename buffer_context<char_t>::type, Args...> as{args...};
return vformat(basic_string_view<char_t>(format_str), as);
}
FMT_API void vprint(std::FILE *f, string_view format_str, format_args args);

View File

@@ -1,22 +0,0 @@
// Formatting library for C++ - folly::StringPiece formatter
//
// Copyright (c) 2012 - present, Victor Zverovich
// All rights reserved.
//
// For the license information refer to format.h.
#ifndef FMT_FOLLY_H_
#define FMT_FOLLY_H_
#include <folly/Range.h>
#include "core.h"
FMT_BEGIN_NAMESPACE
template <typename Ctx>
inline internal::typed_value<Ctx, internal::string_type>
make_value(folly::StringPiece s) {
return string_view(s.data(), s.size());
}
FMT_END_NAMESPACE
#endif // FMT_FOLLY_H_