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 
crash.

You need:
vector<int> x;
x.reserve(5);
x[0] = 5;

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


_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to