Date: Tue, 24 Jan 2023 20:58:40 +0000
Instead of writing a function as follows:
template<typename T>
typename T::allocator_type::rebind<typename T::key_type> Func(T &container)
{
typename T::allocator_type::rebind<typename T::key_type> obj;
return obj;
}
It would be nice, inside the body of the function, to have a simple
keyword for the function's return type, like this:
template<typename T>
typename T::allocator_type::rebind<typename T::key_type> Func(T &container)
{
return_t obj;
return obj;
}
Furthermore this new keyword could be used in functions with 'auto' return type:
auto Func2(double a, int b)
{
return_t obj;
return a + b;
}
This could get pretty elaborate where one template function calls
another, for example:
template<class A, class B>
auto Func4(A a, B b)
{
return_t obj;
return Converter<B,A>::Process(a) + Converter<B,A>::Process(b) +
SumOf<A,B>(a,b);
}
template<typename T>
typename T::allocator_type::rebind<typename T::key_type> Func(T &container)
{
typename T::allocator_type::rebind<typename T::key_type> obj;
return obj;
}
It would be nice, inside the body of the function, to have a simple
keyword for the function's return type, like this:
template<typename T>
typename T::allocator_type::rebind<typename T::key_type> Func(T &container)
{
return_t obj;
return obj;
}
Furthermore this new keyword could be used in functions with 'auto' return type:
auto Func2(double a, int b)
{
return_t obj;
return a + b;
}
This could get pretty elaborate where one template function calls
another, for example:
template<class A, class B>
auto Func4(A a, B b)
{
return_t obj;
return Converter<B,A>::Process(a) + Converter<B,A>::Process(b) +
SumOf<A,B>(a,b);
}
Received on 2023-01-24 20:58:52