Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make segtree to allow more broad function types #160

Merged
merged 3 commits into from
Apr 6, 2023

Conversation

yosupo06
Copy link
Collaborator

I tried to make segtree / lazy_segtree can handle more broad function types.

By this change,

  • We continue to support to naive function (= S op(S a, S b), ...)
  • We can use other function types, e.g. S op(const S& a, const S& b) (C++17) or static lambda (C++20)
string op_const(const string& a, const string& b) {
    return a + b;
}

string e() { return ""; }

segtree<string, op_const, e> seg(10);
segtree<string, [](string a, string b) { return a + b; }, []() { return ""; }> seg(10);

(TBH I'm not sure whether this change really works well because it uses advanced C++ feature & I'm not a pro of C++)

@yosupo06 yosupo06 merged commit 16897e5 into atcoder:master Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant