improved const correctness (#321)

This commit is contained in:
Juho Lauri 2019-10-02 21:25:28 +03:00 committed by Daniel Lemire
parent de8df0a05f
commit cf9dbe583d
2 changed files with 5 additions and 5 deletions

View File

@ -51,9 +51,9 @@ public:
// return false if the tape is likely wrong (e.g., you did not parse a valid
// JSON).
WARN_UNUSED
bool print_json(std::ostream &os);
bool print_json(std::ostream &os) const;
WARN_UNUSED
bool dump_raw_tape(std::ostream &os);
bool dump_raw_tape(std::ostream &os) const;
// all nodes are stored on the tape using a 64-bit word.
//
@ -91,7 +91,7 @@ public:
// tape[current_loc++] = *((uint64_t *)&d);
}
really_inline uint32_t get_current_loc() { return current_loc; }
really_inline uint32_t get_current_loc() const { return current_loc; }
really_inline void annotate_previous_loc(uint32_t saved_loc, uint64_t val) {
tape[saved_loc] |= val;

View File

@ -113,7 +113,7 @@ void ParsedJson::init() {
}
WARN_UNUSED
bool ParsedJson::print_json(std::ostream &os) {
bool ParsedJson::print_json(std::ostream &os) const {
if (!valid) {
return false;
}
@ -241,7 +241,7 @@ bool ParsedJson::print_json(std::ostream &os) {
}
WARN_UNUSED
bool ParsedJson::dump_raw_tape(std::ostream &os) {
bool ParsedJson::dump_raw_tape(std::ostream &os) const {
if (!valid) {
return false;
}