new std.variant (was Re: The Right Approach to Exceptions)
Jonathan M Davis
jmdavisProg at gmx.com
Wed Feb 22 16:51:27 PST 2012
On Thursday, February 23, 2012 01:38:05 Juan Manuel Cabo wrote:
> (And not talking about some cheesy insertion sort!!)
>
> If you build an array once and for all, and all you want
> is to do binary search on it later, it doesn't make sense to
> allocate that big contiguous .data. I'd rather leave it
> as an appender.
>
> --jm
>
>
> On Wednesday, 22 February 2012 at 23:22:35 UTC, Juan Manuel Cabo
>
> wrote:
> >> No, because the array doesn't actually exist until appender
> >> makes copy.
> >
> > Will one be able to use the sort!()() algorithm directly on
> > your appender,
> > that is, without accessing/creating the underlying array?
If appender ends up with multiple arrays in it, then random access is no
longer O(1) and is therefore unacceptable. As such, most sort algorithms
wouldn't work with it.
Also, your bit about using appender to pass an array around wouldn't work
either, because it wouldn't simply be wrapper around an array anymore.
- Jonathan M Davis
P.S. Please don't top post. Replies should go _after_ the preceding message.
More information about the Digitalmars-d
mailing list