C++11 has some new functions that use perfect forwarding. The most common example that comes up for me is make_shared. Here's an example:
class MyClass {
MyClass(int a, char b, float c);
explicit MyClass(short s);
};
auto p = std::make_shared<MyClass>(2, 'h', 5.0f);
When I type "std::make_shared<MyClass>", I would really like to see autocomplete for the MyClass constructors. In other words, when I type "make_shared<MyClass>(", I would like it to behave as if I had typed "new MyClass(".
Instead, once I type the opening parentheses, I see code completion for the make_shared function, which looks something like (since VS doesn't support variadic templates yet):
template <class Type>
shared_ptr<Type> make_shared();
template <class Type, class A1>
shared_ptr<Type> make_shared(A1&& a1);
template <class Type, class A1, class A2>
shared_ptr<Type> make_shared(A1&& a1, A2&& a2);
I know in general it isn't really possible to inspect a function that does perfect forwarding and determine what's being done. Maybe there are more sophisticated things that could be done, but I think it would be extremely useful to allow the user to specify that a function has these semantics. In other words, have a list of functions in some configuration, containing make_shared by default. If this is a function template, with the first template argument as a class, explicitly specified, and the rest as rvalue reference parameters, show autocompletion for constructors of the class that is the first template argument. In other words, show the constructors of MyClass in my example.
So, if the user types "function_name<SomeClass>(", and function_name is in that list, autocomplete would show results for constructors of SomeClass.
Thanks for your time!