templates-deduction

Template deduction in dynamic_cast

I have a class that is defined as the following: template <class WidgetType> class CometWidget : public WidgetType; Inside a function I am doing this: dynamic_cast<CometWidget *>(iter2->second.second)->changesCommited_(); and it resolves the CometWidget type, complies and run correctly. The code runs inside the CometWidget class....

Template deduction based on return type?

I'd like to be able to use template deduction to achieve the following: GCPtr<A> ptr1 = GC::Allocate(); GCPtr<B> ptr2 = GC::Allocate(); instead of (what I currently have): GCPtr<A> ptr1 = GC::Allocate<A>(); GCPtr<B> ptr2 = GC::Allocate<B>(); My current Allocate function looks like this: class GC { public: template <typename T>...