<div dir="ltr">Well, I don't have data points to make a decision, so if you like that way I don't object. The other way would be to make it switchable, e.g.<div><div><br></div><div>  auto Ret = StringSwtich<T>(Str)</div><div>    .Case("case-sensitive", foo)</div><div>    .CaseInsensitive()</div><div>    .Case("case-insensitive", bar)</div><div>    .CaseSensitive()</div><div>    ...</div><div><br></div><div>but it's probably too much.</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 3, 2016 at 1:30 PM, Zachary Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">That is true, but it would make it impossible to have both case sensitive and case-insensitive cases in the same switch.  For example, the following is currently possible:<div><br></div><div>StringSwitch<int>(s).Case("<wbr>one").CaseLower("two");</div><div><br></div><div>I'm not sure how useful this would be, but I see no reason not to allow it.  One idea might be to templatize the member function itself, and give it a default value of case sensitive.  But then you still have to write:</div><div><br></div><div>StringSwitch<int>(s).Case<>("<wbr>one").Case<false>("two");</div><div><br></div><div>which might be awkward.  thoughts?</div></div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 3, 2016 at 1:26 PM Rui Ueyama <<a href="mailto:ruiu@google.com" target="_blank">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"><div dir="ltr" class="m_-4118106945002421305gmail_msg">It just comes to my mind that you could make StringSwitch case-insensitive instead of adding case-insensitive versions of StartsWith, Case and Cases. It'd probably be something like<div class="m_-4118106945002421305gmail_msg"><br class="m_-4118106945002421305gmail_msg"></div><div class="m_-4118106945002421305gmail_msg">  auto Ret = StringSwtich<T>(Str, /*CaseInsensitive=*/true)</div><div class="m_-4118106945002421305gmail_msg">      .Case("foo", bar) //  "foo" is compared in the insensitive manner</div><div class="m_-4118106945002421305gmail_msg">      ...</div><div class="m_-4118106945002421305gmail_msg"><br class="m_-4118106945002421305gmail_msg"></div><div class="m_-4118106945002421305gmail_msg">With this, you don't need to double the number of member functions.</div></div><div class="gmail_extra m_-4118106945002421305gmail_msg"><br class="m_-4118106945002421305gmail_msg"><div class="gmail_quote m_-4118106945002421305gmail_msg">On Mon, Oct 3, 2016 at 1:15 PM, Zachary Turner <span dir="ltr" class="m_-4118106945002421305gmail_msg"><<a href="mailto:zturner@google.com" class="m_-4118106945002421305gmail_msg" target="_blank">zturner@google.com</a>></span> wrote:<br class="m_-4118106945002421305gmail_msg"><blockquote class="gmail_quote m_-4118106945002421305gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">zturner updated this revision to Diff 73327.<br class="m_-4118106945002421305gmail_msg">
zturner added a comment.<br class="m_-4118106945002421305gmail_msg">
<br class="m_-4118106945002421305gmail_msg">
Unit tests for the case-sensitive versions were removed and submitted separately.  The `Optional` variant of the function is removed and will be submitted later.  This patch only contains case-insensitive versions of the functions with associated unit tests.<br class="m_-4118106945002421305gmail_msg">
<br class="m_-4118106945002421305gmail_msg">
<br class="m_-4118106945002421305gmail_msg">
<a href="https://reviews.llvm.org/D24686" rel="noreferrer" class="m_-4118106945002421305gmail_msg" target="_blank">https://reviews.llvm.org/<wbr>D24686</a><br class="m_-4118106945002421305gmail_msg">
<br class="m_-4118106945002421305gmail_msg">
Files:<br class="m_-4118106945002421305gmail_msg">
  include/llvm/ADT/StringSwitch.<wbr>h<br class="m_-4118106945002421305gmail_msg">
  unittests/ADT/<wbr>StringSwitchTest.cpp<br class="m_-4118106945002421305gmail_msg">
<br class="m_-4118106945002421305gmail_msg">
</blockquote></div><br class="m_-4118106945002421305gmail_msg"></div>
</blockquote></div>
</div></div></blockquote></div><br></div>