<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 11, 2009, at 10:54 AM, Bill Wendling wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; ">On Wed, Feb 11, 2009 at 10:36 AM, Ben Laurie <<a href="mailto:benl@google.com">benl@google.com</a>> wrote:<br><blockquote type="cite">I needed these for some work I'm doing in clang...<br></blockquote><blockquote type="cite"><br></blockquote>Yes sir! At least this message was informative. One thing:<br><br>+  int size() const {<br>+    int n = 0;<br>+    for(iterator i = begin() ; i != end() ; ++n, ++i)<br>+      ;<br>+    return n;<br>+  }<br>+  bool empty() const {<br>+    return size() == 0;<br>+  }<br><br>empty() here isn't a constant-time method. Can you make it's time<br>complexity O(1)?<br><br>-bw</span></blockquote></div><br><div>Bill's right; empty can be made constant time.  e.g.,  "return Root == 0";</div></body></html>