xxsds / DYNAMIC

Dynamic succinct/compressed data structures
MIT License
111 stars 20 forks source link

const correctness #6

Closed ekg closed 5 years ago

ekg commented 5 years ago

Const correctness is a kind of disease that spreads through all levels of a library. Luckily, it grants super powers to the infected.

In this case, we're trying to integrate DYNAMIC behind an interface (the handle graph interface: handle.hpp) which makes a number of simple assertions about what should be const (things that access the graph but don't modify anything in it) that look to be useful to ensuring correct coding against it.

I've touched up a number of the core classes in DYNAMIC so that they are const correct. In most cases this was easy, although it was a little tricky to deal with the alphabet encoding functions, as these were doing double duty as encoding characters into the local alphabet (which should be const-able) and alphabet extension (which is not).

I did not try to do the same with the BWT and FM-index. These should presumably be pretty easy to fix, but I'm not using them and am not motivated to fix them now.

CC @jeizenga @edawson

ekg commented 5 years ago

I have updated the BWT and FM-index to make them const correct. What am I missing?

nicolaprezza commented 5 years ago

Thanks for the work Erik! I've given a quick scan and it looks great. Merged!

ekg commented 5 years ago

Ma figurati! :)