
On Sat, Oct 24, 2009 at 4:11 AM, Bo Persson <bop@gmb.dk> wrote:
Don't you agree that string& name = c.name; name.size() is kinda ugly/unusable compared to just c.name->size() (possible) or c.name.size() (not possible, but ideal)?
I might be stupid here, but can not see any advantage at all for using c.name->size() over the traditional c.name().size().
Since references can't be rebound, I'm using a pointer to store the actual value. So the first syntax doesn't require any modification of call sites. The first one looks more natural to me without the ().
And why is the "ideal" c.cname.size(), should it not be c.name.size with size being a property of the string?
Yes, if std::string::size indeed becomes a property. That's unlikely to happen any time soon though. :( Olaf