by Marcin Swiderski <sfider.best@[EMAIL PROTECTED]
>
May 7, 2008 at 06:31 PM
On 7 Maj, 18:58, Bharath <tiromarc...@[EMAIL PROTECTED]
> wrote:
> basically he is extending the Vector<void*> to Vector<T*>. Why is it
> so? In my example given above, I didn't derive from anything else. But
> I think I'm solving the purpose to define a specialization that is
> used for every my_vec of pointers and ONLY for my_vec of pointers.
> I couldn't understand the author's intention correctly. Can someone
> please explain ?
The solution shown in the example has the advantage of generating
less code then the naive solution. The code for handling vector of
pointers is generated only once (Vector<void*>) and then reused
with Vector<T*> thanks to ability to static_cast void* to T* for
every possible type T.
Cheers
Sfider
--
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]