Re: [linux-audio-dev] [ot] [rant] gcc, you let me down one time toomany

From: stefan kersten <steve@email-addr-hidden-hornz.de>
Date: Thu Jun 09 2005 - 22:07:11 EEST

On Thu, Jun 09, 2005 at 09:39:21PM +0300, Jussi Laako wrote:
> On Thu, 2005-06-09 at 18:14 +0200, stefan kersten wrote:
>
> > int access(std::vector<int> v, int i)
> > {
> > return v[i];
> > }
>
> At least you are making copy here, should be
>
> int access(std::vector<int> &v, int i)

actually not, structs are passed by reference. operator[]
accesses a constant reference *(begin() + n) and the copy
constructor is not called. try it, the code generated is
exactly the same.

<sk>

Received on Fri Jun 10 00:15:07 2005

This archive was generated by hypermail 2.1.8 : Fri Jun 10 2005 - 00:15:07 EEST