On 24/09/2007, Jonathan Adamczewski <[EMAIL PROTECTED]> wrote:
>
> What about something like the following?
>
> struct proxy {
> T& t;
> proxy(T& t_) : t(t_) {}
> proxy& operator=(const T& r) { foo(t, r); return *this; }
> };
>
> struct B { proxy get() { return proxy(bar); } };
>
> int
Jonathan Wakely wrote:
I believe Andrew's right and the strcpy case is valid, but you do have
a point. I think this should be rejected:
struct A { int i; };
struct B { A get() { return A(); } };
int main ()
{
B b;
b.get().i = 0;
// int& error = b.get().i;
}
What about somethin
On 21/09/2007, Michiel de Bondt <[EMAIL PROTECTED]> wrote:
> Using strings to show my point was not a good idea. You can add a field
> "int number" to the struct and perform similar operations (with =
> instead of strcpy).
I believe Andrew's right and the strcpy case is valid, but you do have
a po
Michiel de Bondt wrote:
Using strings to show my point was not a good idea. You can add a field
"int number" to the struct and perform similar operations (with =
instead of strcpy).
But even with strings, gcc should give an error like: "strcpy(const
char*, const char*) does not exists". In c
Using strings to show my point was not a good idea. You can add a field
"int number" to the struct and perform similar operations (with =
instead of strcpy).
But even with strings, gcc should give an error like: "strcpy(const
char*, const char*) does not exists". In case of a "typedef char
st
On 9/20/07, Michiel de Bondt <[EMAIL PROTECTED]> wrote:
> struct string100 { char value[100]; };
> strcpy (a[0].value, "Non-lvalue assignment."); // illegal
So you basically have:
a.operator[](0).value
Where value ia an array, I cannot remember the specific rules here but
value decays to &valu
Hello all,
I think the gcc compiler should not accept assignments to non-lvalues.
gcc does this however, but does not execute the assignment (probably the
assignment is executed on a copy, but that copy is entirely floating).
Here is my code:
#include
#include
#include
template class SuperAr