This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Use std::forward_list for displaced_step_inferior_states
On Mon, Nov 19, 2018 at 8:03 PM Simon Marchi <simon.marchi@polymtl.ca> wrote:
>
> On 2018-11-19 18:21, David Blaikie wrote:
> > Why forward list of pointers rather than forward list of values?
> > Forward list of pointers would make two allocations per node, rather
> > than one, I think?
>
> You are right, there's no good reason (except that maybe it was a
> smaller step).
>
> > Ah, I'd replied on the other thread about this with a patch, but my
> > email got bounced due to rich text (Google Inbox).
> >
> > I've attached my patch for this - though it uses list instead of
> > forward_list - good catch on that!
>
> Actually, I would use an std::vector. There's a single object per
> inferior, so that list is likely to be very small. A vector should be
> faster for pretty much every situation. From what I can see, it doesn't
> matter if objects are moved (we don't save a pointer to them anywhere).
> Does that sound good to you (I can take care of writing the patch)?
Yeah, for sure! Thanks!
- Dave
>
> Simon