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

実装について #22

Open
rsk0315 opened this issue Oct 9, 2020 · 5 comments
Open

実装について #22

rsk0315 opened this issue Oct 9, 2020 · 5 comments

Comments

@rsk0315
Copy link
Owner

rsk0315 commented Oct 9, 2020

セグ木のアーチのところ、左側.chain(右側) みたいなイテレータを返す内部関数を作っておけば、見かけの実装がきれいになりそう
Vec を使わないようにもできそうだし

片側しか吐かなくていいなら他方はシフトだけしてればいい? だめか、だめだね

@rsk0315
Copy link
Owner Author

rsk0315 commented Oct 9, 2020

Mod みたいな実行時に決まりうる値をトレイトにするの、Mod っていう限定的な名前にする必要ないね

@rsk0315
Copy link
Owner Author

rsk0315 commented Oct 9, 2020

Distributive を実装するためのヘルパーがないじゃん

@rsk0315
Copy link
Owner Author

rsk0315 commented Dec 11, 2021

2-SAT のインタフェース、

ts.add_clause(i, -j);

じゃなくて

ts.add_clause((i, true), (j, false));

の方がうれしい?

@rsk0315
Copy link
Owner Author

rsk0315 commented Dec 18, 2021

セグ木とかでよく境界チェックしてるけど、毎回書くんじゃなくて https://doc.rust-lang.org/src/core/panicking.rs.html#67-77 みたいな感じで関数を作っておく方が楽そう

fn panic_bounds_check(by: impl Debug, safe: impl Debug) -> ! {
    panic!("index out of bounds: the safe range is {:?} but accessed by {:?}", safe, by)
}

とかみたいな感じで

@rsk0315
Copy link
Owner Author

rsk0315 commented Dec 23, 2021

by: usize, safe: Range<usize> に限定していい? だめかな

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

No branches or pull requests

1 participant