I could pass 2 template arguments instead, ValueType and extraction functor separately.  Similar to std::map how you can pass a comparison functor <br><div class="gmail_quote"><div dir="ltr">On Fri, May 27, 2016 at 8:41 AM Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">ruiu added a comment.<br>
<br>
OK, I wouldn't make a trait class at this moment as it has already lots of meta programming, but it's your call.<br>
<br>
<br>
================<br>
Comment at: include/llvm/DebugInfo/CodeView/RecordIterator.h:41-44<br>
@@ +40,6 @@<br>
+    Item.Type = static_cast<Kind>(uint16_t(Prefix->RecordKind));<br>
+    if (auto EC = Reader.readBytes(Item.Length - 2, Item.Data)) {<br>
+      consumeError(std::move(EC));<br>
+      return 0;<br>
+    }<br>
+    return Prefix->RecordLen + 2;<br>
----------------<br>
Don't you want to propagate the error up to the caller? Hiding errors in a deep function call seems risky.<br>
<br>
<br>
<a href="http://reviews.llvm.org/D20724" rel="noreferrer" target="_blank">http://reviews.llvm.org/D20724</a><br>
<br>
<br>
<br>
</blockquote></div>