diff options
author | Victor Zverovich <viz@fb.com> | 2020-04-15 06:28:41 -0700 |
---|---|---|
committer | Victor Zverovich <viz@fb.com> | 2020-04-15 06:28:41 -0700 |
commit | 538d83fd08443b13d1f65234464392122785f056 (patch) | |
tree | 30e0c3af56f462d1fc6d1ce49c91c6dc2f4ae9ff /src | |
parent | 8a4630686e2dd24900897298c4ae1362de749ed8 (diff) | |
download | fmtlib-538d83fd08443b13d1f65234464392122785f056.tar.gz |
Cleanup named arguments
Diffstat (limited to 'src')
-rw-r--r-- | src/format.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/format.cc b/src/format.cc index 3d6da4db..e1f42a2e 100644 --- a/src/format.cc +++ b/src/format.cc @@ -115,6 +115,27 @@ char* sprintf_format(Double value, internal::buffer<char>& buf, return decimal_point_pos; } +// 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) { |