[PATCH] D24842: Add StringRef {take, drop} x {_while, _until}

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 22 13:47:21 PDT 2016


zturner created this revision.
zturner added reviewers: majnemer, joker-eph.
zturner added a subscriber: llvm-commits.

    This adds support for some common functional style operations
    that allow you to take or drop characters until a certain
    condition is met.

Example: 

    assert(StringRef("ABCD2908XYZ".take_while([](char c) { return ::is_hexdigit(c); }) == "XYZ");

https://reviews.llvm.org/D24842

Files:
  include/llvm/ADT/StringRef.h
  unittests/ADT/StringRefTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24842.72208.patch
Type: text/x-patch
Size: 3045 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160922/9fc51a68/attachment.bin>


More information about the llvm-commits mailing list