Most of the time, the C++17 inferred return type of a simple member function can be easily transformed to a C++11 trailing return type.
For example, the member function in
template<typename T>
struct X
{
T a;
auto f() { return frob(a); }
};
becomes
auto f() -> decltype(frob(a)) { return frob(a); }
Considering that using namespace is not permitted at top-level scope within a class body, how do you write a trailing return type for the following?
namespace widget
{
template<typename S>
int froz(S&&);
}
template<typename T>
struct Y
{
T b;
auto g() { using namespace widget; return froz(b); }
};
(For example, the usage of argument-dependent lookup with a fallback is very common when calling std::swap, std::begin, std::end)
template<typename T>
struct Z
{
T container;
auto h() { using namespace std; return begin(container); }
};
How about: