What does the
float&
mean?
Here, &
means "reference", so the argument is passed by reference.
I know that in other places
&
is used as a==
is that the case here?
&
means various things in various contexts, but it never means ==
. In this case, it's not an operator either; it's part of a type specification, meaning that it's a reference type.
I know the << is a the bit shift, and I assume the
&
is==
No, it's a bitwise and operator. The result has its bits set where a bit is set in both operands. Here, with 1<<k
as one operand, the result is the kth bit of G[j]
; so this tests whether that bit is set.
Are the for loops just like one for loop in an other?
Yes. If you don't use braces around a for-loop's body, then the body is a single statement. So in this case, the body of the first loop is the second loop. To make this clear, I would recommend indenting the body of the loop, and using braces whether or not they are strictly necessary. But of course, I don't write (deliberately) obfuscated code.
Finally, this line:
v p(13,13,13);
v
is a class with a constructor taking three arguments. This declares an variable called p
, of type v
, initialised using that constructor; i.e. the three co-ordinates are initialised to 13
.