Re: umm... something... template(s)... something else... pointer(s)... and such... 0.o yah, I'm hopeless and clueless o.0
From: John Harrison (john_andronicus_at_hotmail.com)
Date: 10/11/04
- Next message: Ivan Vecerina: "Re: most accurate printf("%f")"
- Previous message: Alex Gerdemann: "Performance of hash_set vs. Java"
- In reply to: deadram_at_hotmail.com: "Re: umm... something... template(s)... something else... pointer(s)... and such... 0.o yah, I'm hopeless and clueless o.0"
- Next in thread: deadram_at_hotmail.com: "Re: umm... something... template(s)... something else... pointer(s)... and such... 0.o yah, I'm hopeless and clueless o.0"
- Reply: deadram_at_hotmail.com: "Re: umm... something... template(s)... something else... pointer(s)... and such... 0.o yah, I'm hopeless and clueless o.0"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 11 Oct 2004 13:04:11 +0100
[snip]
> What's really important to me is what this template stuff ends up
> doing... in any sort of general way... it's hard to get to abstract with
> some of this stuff though ;) I guess I'm wondering if at compile time a
> function for each type (of T) is generated,
That's right.
> and what kind of slowdowns or
> bulk and the sorts ends up in most peoples code.
A compiler/linker should be able to remove multiple copies of generated
functions, ut this is a QOI issue of course.
> I've got all my templates
> working (... now I do anyways...), but I want to understand what was going
> on. I guessing, since this stuff could end up in a dll and the likes, that
> there is only one function created, unless you specify the "template < >
> SomeThing < aSpecialType > (...)". But all I really have is alot of
> guesswork and code that I bruteforced from a verbose compiler 0.o
>
It doesn't make sense to try an put a template in a DLL, since templates
cannot be object code, only instantiations of templates are object code.
Since templates don't get instantiated until they are used there is nothing
to put in a DLL. This is the same reason that template code goes in header
files not in source files.
You can explicitly instantiate a template and that instantiated template
could go in a DLL. But then you are limited to the instantiates you make
ahead of time (when you compile the DLL).
john
- Next message: Ivan Vecerina: "Re: most accurate printf("%f")"
- Previous message: Alex Gerdemann: "Performance of hash_set vs. Java"
- In reply to: deadram_at_hotmail.com: "Re: umm... something... template(s)... something else... pointer(s)... and such... 0.o yah, I'm hopeless and clueless o.0"
- Next in thread: deadram_at_hotmail.com: "Re: umm... something... template(s)... something else... pointer(s)... and such... 0.o yah, I'm hopeless and clueless o.0"
- Reply: deadram_at_hotmail.com: "Re: umm... something... template(s)... something else... pointer(s)... and such... 0.o yah, I'm hopeless and clueless o.0"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|