Safer casts

Janice Caron caron800 at googlemail.com
Sun May 11 12:10:46 PDT 2008


On 11/05/2008, Yigal Chripun <yigal100 at gmail.com> wrote:
>  I don't know how
>  Andrei implemented it, but either the template inlines stuff

If the function is called N times (where N > 0), the template is
instantiated exactly once.

The function /may/ get inlined, but this will be true of all
functions, not just template functions. In D, there is no way to say
"never inline this function".



>  if not than it would be the same as the delegate version.

Yes.


>  only it'll
>  bloat the executable since for each unique delegate there will be a copy
>  of the template.

It is certainly possible to ensure that there is exactly one delegate
type for each element type, so the number of copies can be made
minimal.


>  If my understanding here is wrong, feel free to correct me. [Janice?]

See separate post. By my reckoning, your OrderedCollection interface
results in more executable bloat than use of std.algorithm.sort. (But
if my understanding of your idea is wrong, feel free to correct me).



More information about the Digitalmars-d mailing list