While I have std::tr1::shared_ptr<T>
available in my compiler, I don't
have make_shared
.
Can someone point me to a proper implementation of make_shared
? I see
that I need to use varargs to provide arguments to constructor of T.
But I don't have variadic templates available in my compiler as well.
If your compiler don't give an implementation of make_shared and you can't use boost, and you don't mind the lack of single-allocation optimization both for the object and the reference counter then make_shared is something like this:
Without variadic template support:
If your compiler don't support r-value references, then make 2 versions for each arguments count: one const Arg& and one Arg&
With variadic template support: