Re: returning lvalue in C vs C++
- From: "Alf P. Steinbach" <alfps@xxxxxxxx>
- Date: Thu, 30 Mar 2006 02:50:22 +0200
* Kai-Uwe Bux:
* Ben C:
But x is an int, so if f().x = 200 works on that basis, why not g() = 4?
Yup: why not?
Because you can't assign to an rvalue.
I don't know. But for classes, it sure works:>
struct dummy {
dummy & operator= ( dummy const & other ) {
std::cout << "hello world!\n";
return ( *this );
}
};
But you can call a member function on an rvalue of class type.
--
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?
.
- Follow-Ups:
- Re: returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- References:
- returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- From: Phlip
- Re: returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- From: Ben C
- Re: returning lvalue in C vs C++
- From: Kai-Uwe Bux
- returning lvalue in C vs C++
- Prev by Date: Re: returning lvalue in C vs C++
- Next by Date: Re: returning lvalue in C vs C++
- Previous by thread: Re: returning lvalue in C vs C++
- Next by thread: Re: returning lvalue in C vs C++
- Index(es):