[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed

From: al davis
Subject: Re: [Discuss-gnuradio] ANCI-C vs Gnuradio/C++ speeeed
Date: Fri, 12 May 2006 18:55:56 -0400
User-agent: KMail/1.9.1

On Friday 12 May 2006 18:24, Ilia Mirkin wrote:
> Also, when you do
> vector<int> x;
> x[0] = 5;
> keep in mind that internally it instantiates a new int
> object, and then calls operator= on it. The compiler might
> optimize this to a certain extent, but certainly not to the
> level of simplicity of a single memory access/write.

A good compiler will optimize it that well.

Your code is wrong.  The vector x is of size zero.  It should 

You need:
vector<int> x;
x[0] = 5;

vector<int> x(5);
x[0] = 5;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]