<div class="gmail_quote">On Wed, Dec 21, 2011 at 2:34 PM, Jakub Staszak <span dir="ltr"><<a href="mailto:kubastaszak@gmail.com">kubastaszak@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">I have to agree with operator[] vs lookup(). We don't get any benefit here, so there is no point to make code less readable. In this case I'd have to revert the whole patch, because most of these operator[] won't work because of its lack of constantness.</div>
</blockquote><div><br></div><div>For reference, I'm fine with that. I don't think constantness is helping this code.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br></div><div>- Kuba</div><div><div class="h5"><div><br><div><div>On Dec 21, 2011, at 11:11 PM, Chandler Carruth wrote:</div><br><blockquote type="cite"><div class="gmail_quote">On Wed, Dec 21, 2011 at 2:00 PM, Jakub Staszak <span dir="ltr"><<a href="mailto:kubastaszak@gmail.com" target="_blank">kubastaszak@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
operator[] inserts an object for key if it doesn't exist.<br>
<br>
// X is empty<br>
if (X[0] == a) { }<br>
if (X[1] == b) { }<br>
if (X[2] == c) { }<br>
// X.size() = 3<br>
<br>
This is the way that std::map works. I believe we want to be quite compatible here.</blockquote><div><br></div><div>Certainly, but is it actually cheaper if you know ahead of time that no such insertion will occur? I would expect the lookup path to a hot path through the [] operators.</div>

<div><br></div><div>To be honest, I'm beginning to question the entire patch. No insertion ever happens with these [] uses, and they seem more readable to me than lookup... I don't feel strongly about the lookup, but I do feel strongly about the const thing. I'd really rather you strip back out all the const here.</div>

</div>
</blockquote></div><br></div></div></div></div></blockquote></div><br>