* Johann:
Hi all. I've read that in C++ it's not possible to pass a complete
block of memory by value as a parameter to a function.
That is incorrect.
This is true in arrays.
No.
Possibly you're thinking of arrays decaying to pointers in various
situations, like
void foo( char const s[5] );
// Equivalent to void foo( char const* s )
but you can easily pass an array by value by encapsulating it in a struct:
struct S{ char elem[5]; };
void foo( S s );
and here the whole array is copied in a call of foo.
But i can do it with a vector.
Impossible to say for sure what you mean here.
What's the true then?
In C++ all argument passing, except pass by reference, is pass by value.
In the case exemplified by the first foo above, a pointer is passed by
value.
Another question: the implementantion of references it's like a const
pointer ??
That's a good conceptual model for the low-level aspects of references,
but references have properties different from pointers (e.g., you can
overload freestanding operator functions on reference arguments, but not
on pointer arguments).
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?