Ditch internal::arg_map
This commit is contained in:
parent
d0623de510
commit
de290f5c4c
@ -1090,8 +1090,6 @@ enum { packed_arg_bits = 5 };
|
||||
enum { max_packed_args = 62 / packed_arg_bits };
|
||||
enum : unsigned long long { is_unpacked_bit = 1ULL << 63 };
|
||||
enum : unsigned long long { has_named_args_bit = 1ULL << 62 };
|
||||
|
||||
template <typename Context> class arg_map;
|
||||
} // namespace internal
|
||||
|
||||
// A formatting argument. It is a trivially copyable/constructible type to
|
||||
@ -1111,7 +1109,6 @@ template <typename Context> class basic_format_arg {
|
||||
-> decltype(vis(0));
|
||||
|
||||
friend class basic_format_args<Context>;
|
||||
friend class internal::arg_map<Context>;
|
||||
friend class dynamic_format_arg_store<Context>;
|
||||
|
||||
using char_type = typename Context::char_type;
|
||||
@ -1652,8 +1649,6 @@ template <typename Context> class basic_format_args {
|
||||
return static_cast<internal::type>((desc_ >> shift) & mask);
|
||||
}
|
||||
|
||||
friend class internal::arg_map<Context>;
|
||||
|
||||
basic_format_args(unsigned long long desc,
|
||||
const internal::value<Context>* values)
|
||||
: desc_(desc), values_(values) {}
|
||||
|
@ -23,46 +23,6 @@ int format_float(char* buf, std::size_t size, const char* format, int precision,
|
||||
return precision < 0 ? snprintf_ptr(buf, size, format, value)
|
||||
: snprintf_ptr(buf, size, format, precision, value);
|
||||
}
|
||||
|
||||
// DEPRECATED.
|
||||
template <typename Context> class arg_map {
|
||||
private:
|
||||
struct entry {
|
||||
basic_string_view<typename Context::char_type> name;
|
||||
basic_format_arg<Context> arg;
|
||||
};
|
||||
|
||||
entry* map_;
|
||||
unsigned size_;
|
||||
|
||||
void push_back(value<Context> val) {
|
||||
const auto& named = *val.named_arg;
|
||||
map_[size_] = {named.name, named.template deserialize<Context>()};
|
||||
++size_;
|
||||
}
|
||||
|
||||
public:
|
||||
void init(const basic_format_args<Context>& args);
|
||||
};
|
||||
|
||||
// This is deprecated and is kept only to preserve ABI compatibility.
|
||||
template <typename Context>
|
||||
void arg_map<Context>::init(const basic_format_args<Context>& args) {
|
||||
if (map_) return;
|
||||
map_ = new entry[internal::to_unsigned(args.max_size())];
|
||||
if (args.is_packed()) {
|
||||
for (int i = 0;; ++i) {
|
||||
internal::type arg_type = args.type(i);
|
||||
if (arg_type == internal::type::none_type) return;
|
||||
if (arg_type == internal::type::named_arg_type)
|
||||
push_back(args.values_[i]);
|
||||
}
|
||||
}
|
||||
for (int i = 0, n = args.max_size(); i < n; ++i) {
|
||||
auto type = args.args_[i].type_;
|
||||
if (type == internal::type::named_arg_type) push_back(args.args_[i].value_);
|
||||
}
|
||||
}
|
||||
} // namespace internal
|
||||
|
||||
template struct FMT_INSTANTIATION_DEF_API internal::basic_data<void>;
|
||||
@ -85,9 +45,6 @@ template FMT_API char internal::decimal_point_impl(locale_ref);
|
||||
|
||||
template FMT_API void internal::buffer<char>::append(const char*, const char*);
|
||||
|
||||
template FMT_API void internal::arg_map<format_context>::init(
|
||||
const basic_format_args<format_context>& args);
|
||||
|
||||
template FMT_API std::string internal::vformat<char>(
|
||||
string_view, basic_format_args<format_context>);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user