Skip to content

Unify needle overloads of std.algorithm.searching.find#5575

Merged
dlang-bot merged 1 commit intodlang:masterfrom
wilzbach:unify-find-step1
Jul 17, 2017
Merged

Unify needle overloads of std.algorithm.searching.find#5575
dlang-bot merged 1 commit intodlang:masterfrom
wilzbach:unify-find-step1

Conversation

@wilzbach
Copy link
Contributor

@wilzbach wilzbach commented Jul 7, 2017

First step at allowing partial instantiation of find (I will try to keep the PRs small) - more work to follow soon.

This PR groups three overloads into one overload. As discussed so often - a user shouldn't need to know about internal performance optimization, so this should be valuable regardless.

See: #5497 (comment)

CC @CyberShadow @andralex

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

@CyberShadow
Copy link
Member

CyberShadow commented Jul 7, 2017

Thanks for working on this!

Here's some use cases / examples / unit tests I wrote:

///
@safe unittest
{
    import std.functional : not;
    import std.ascii : isWhite;

    // Skip whitespace at the front of a string
    alias skipWhitespace = find!(not!isWhite);
    assert("  Hello".skipWhitespace == "Hello");
}

///
@safe unittest
{
    import std.uni : toLower;

    // Case-insensitive find
    alias ifind = find!((a, b) => toLower(a) == toLower(b));
    assert(ifind("Hello World", "OR") == "orld");
}

@wilzbach
Copy link
Contributor Author

wilzbach commented Jul 8, 2017

Here's some use cases / examples / unit tests I wrote

Thanks - I will keep them in mind, but I think I am still two or three PRs away from the eponymous conversion of find. Well, let's see and go step by step :)

@wilzbach
Copy link
Contributor Author

wilzbach commented Jul 9, 2017

Well, let's see and go step by step

Urgh - I just realized that I have done this before: #5150 :/

Copy link
Member

@andralex andralex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nicely done thx

@dlang-bot dlang-bot merged commit fedab33 into dlang:master Jul 17, 2017
@wilzbach wilzbach deleted the unify-find-step1 branch December 11, 2017 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants