Skip to content

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.

1 participant