> templates should never be an answer to "my type is too long to type out"
Eh, in some cases it's a wash.
std::vector<std::unique_ptr<mynamespace::MyWidget>> objects;
// ...
auto it = std::find_if(objects.begin(), objects.end(), [](auto& widget) { return widget->x == 1; });
Sure, you could repeat the type `std::unique_ptr<mynamespace::MyWidget>` in the lambda, but that's just noise. You don't spell out the types like that either in, say, C#. Yes, compilation time is an epsilon slower, but that consideration loses to readability any time of day. (Otherwise you could just remove all comments and indentation from your code - that also makes compilation faster!)
But I don't think it's so noisy in the case you've provided. If I encountered that code, I'd wonder whether that operator-> is safe, or if you're inadvertently dropping some qualifier (e.g. is it actually a raw pointer?).
And as I suggested, it's not much harder to add a using decl:
using UniqueWidget = std::unique_ptr<mynamespace::MyWidget>;
// ...
std::vector<UniqueWidget> objects;
// ...
auto it = std::find_if(objects.begin(), objects.end(), [](UniqueWidget&) { return widget->x == 1; });
Is it really slower ? The compiler has to compute the type of the right hand side in any case. It just has one less computation to do now (type checking the conversion to the left hand type)
I am fairly certain template expansion and skipping over whitespace while parsing are two entirely orthogonal things. using a template might make compilation an "epsilon" slower in one instance of such a use, but then those epsilons add up...
Eh, in some cases it's a wash.
Sure, you could repeat the type `std::unique_ptr<mynamespace::MyWidget>` in the lambda, but that's just noise. You don't spell out the types like that either in, say, C#. Yes, compilation time is an epsilon slower, but that consideration loses to readability any time of day. (Otherwise you could just remove all comments and indentation from your code - that also makes compilation faster!)