disable all member function calls for rvalues?

Michel Fortin michel.fortin at michelf.com
Tue Dec 22 08:05:52 PST 2009


On 2009-12-22 08:45:00 -0500, "Steven Schveighoffer" 
<schveiguy at yahoo.com> said:

> The point is, wrapper types shouldn't have second-class citizenship as  
> rvalues to pointers and references.  There's got to be a way to 
> identify  types as being lvalues even though the compiler doesn't see 
> it that way.   If you can accomplish that, then I have no problem 
> disallowing setting  members of true rvalues.

What you need is tail const. Lvalues are similar to tail-const values: 
can't change them, but can change what they point to. The lvalueness is 
not transitive, so a transitive const isn't appropriate for 
representing lvalues.

Then of course you need to annotate member functions as being 
tail-const, and there the const system becomes more complicated.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list