-
Notifications
You must be signed in to change notification settings - Fork 250
Declaring several methods in atcoder::segtree as const #106
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
Comments
The situation that your suggested makes sense for me. Otherhand, we have a concern about your modification: If Probably we can solve this problem by |
Thanks for comments, @yosupo06. I understood the concern on the consistency of interface, and tried writing const-friendly lazy_segtrees. I first wrote the one using Below are the
|
Thanks for your careful investigation. I feel |
…azy_segtree #106: make several methods of segtree and lazy_segtree const
I want to append
const
to several method declarations inatcoder::segtree
.Some complicated DP problems require to maintain two segtrees to improve time complexity. In such situations, coders always have to pay attention to them. If one of them is not modifed at all (used like (disjoint) sparse tables), I want to declare it as
const
to reduce the risk of updating the wrong segtree.In current ACL, all
atcoder::segtree
methods are not declared asconst
, so we cannot declare the instances asconst
when there is no update query. On the other hand, it seems that the methodsget()
,prod()
,all_prod()
,max_right()
andmin_left()
do not affect any member variables. I suggest that these methods haveconst
like this to enable such usage ofatcoder::segtree
.What do you think of this modification?
The text was updated successfully, but these errors were encountered: