Template deduction based on return type?
- by Marlon
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>
static GCPtr<T> Allocate();
};
Would this be possible to knock off the extra < A and < B?
Thanks