1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 08:09:32 +02:00

TranslatableString::Format is aware of std::reference_wrapper

This commit is contained in:
Paul Licameli 2019-12-25 14:12:17 -05:00
parent c2c308733b
commit eba984303c

View File

@ -501,6 +501,13 @@ private:
template< typename T > static const T &TranslateArgument( const T &arg, bool )
{ return arg; }
// This allows you to wrap arguments of Format in std::cref so that they
// are captured (as if) by reference rather than by value
template< typename T > static auto TranslateArgument(
const std::reference_wrapper<T> &arg, bool debug )
-> decltype(
TranslatableString::TranslateArgument( arg.get(), debug ) )
{ return TranslatableString::TranslateArgument( arg.get(), debug ); }
static wxString TranslateArgument( const TranslatableString &arg, bool debug )
{ return arg.DoFormat( debug ); }