Skip to content

Conversation

@chronoxor
Copy link
Contributor

@chronoxor chronoxor commented Sep 27, 2016

Hello!

I found that if I put custom type as a named argument it is impossible to get its size in variadic functions:

template < typename Char >
void serialize(Buffer &buffer, const fmt::internal::NamedArg< Char >& arg) {
// serialize named argument
}

So I extend fmt::internal::NamedArg with no overhead:

template < typename Char, typename T >
struct NamedArgWithType : NamedArg< Char > {
NamedArgWithType(BasicStringRef< Char > argname, const T &value)
: NamedArg< Char >(argname, value) {}
};

With this fix I was able to cover all args serializaton/deserializaton for base and trivially copyable types.

Hope you'll accept this PR as well! Thanks in advance!

@vitaut vitaut merged commit f66d37f into fmtlib:master Sep 29, 2016
@vitaut
Copy link
Contributor

vitaut commented Sep 29, 2016

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants