Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions include/fmt/args.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ FMT_EXPORT template <typename Context> class dynamic_format_arg_store {
data_.emplace_back(arg);
}

template <typename T>
void emplace_arg(const detail::named_arg<T, char_type>& arg) {
template <typename T> void emplace_arg(const named_arg<T, char_type>& arg) {
if (named_info_.empty())
data_.insert(data_.begin(), basic_format_arg<Context>(nullptr, 0));
data_.emplace_back(detail::unwrap(arg.value));
Expand Down Expand Up @@ -183,8 +182,7 @@ FMT_EXPORT template <typename Context> class dynamic_format_arg_store {
* formatting function. `std::reference_wrapper` is supported to avoid
* copying of the argument. The name is always copied into the store.
*/
template <typename T>
void push_back(const detail::named_arg<T, char_type>& arg) {
template <typename T> void push_back(const named_arg<T, char_type>& arg) {
const char_type* arg_name =
dynamic_args_.push<std::basic_string<char_type>>(arg.name).c_str();
if FMT_CONSTEXPR20 (need_copy<T>::value) {
Expand Down
5 changes: 4 additions & 1 deletion include/fmt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -2342,6 +2342,9 @@ inline void vprint_mojibake(FILE*, string_view, const format_args&, bool) {}

// The main public API.

template <typename T, typename Char = char>
using named_arg = detail::named_arg<T, Char>;

template <typename Char>
FMT_CONSTEXPR void parse_context<Char>::do_check_arg_id(int arg_id) {
// Argument id is only checked at compile time during parsing because
Expand Down Expand Up @@ -2718,7 +2721,7 @@ using vargs =
* sufficiently new compilers. See `operator""_a()`.
*/
template <typename T>
inline auto arg(const char* name, const T& arg) -> detail::named_arg<T> {
inline auto arg(const char* name, const T& arg) -> named_arg<T> {
return {name, arg};
}

Expand Down
2 changes: 1 addition & 1 deletion include/fmt/xchar.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ inline auto operator""_a(const wchar_t* s, size_t) -> detail::udl_arg<wchar_t> {
#endif

template <typename T>
auto arg(const wchar_t* name, const T& arg) -> detail::named_arg<T, wchar_t> {
auto arg(const wchar_t* name, const T& arg) -> named_arg<T, wchar_t> {
return {name, arg};
}

Expand Down