From: Scott Worley Date: Sat, 9 Jan 2016 10:42:11 +0000 (-0800) Subject: successors is const X-Git-Url: http://git.scottworley.com/slidingtile/commitdiff_plain/f92e9dcac70dc0859e1cf176b84b39c42f677e3e successors is const --- diff --git a/sliding_tile_lib.cc b/sliding_tile_lib.cc index e4f2f12..5284dab 100644 --- a/sliding_tile_lib.cc +++ b/sliding_tile_lib.cc @@ -133,7 +133,7 @@ int Board::distance(const InvertedBoard& invo) const { return dist; } -std::vector Step::successors(std::shared_ptr shared_this) { +std::vector Step::successors(std::shared_ptr shared_this) const { std::vector suc; signed char hole_pos = board.hole(); for (int i = 0; adjacent[hole_pos][i] > 0; i++) { diff --git a/sliding_tile_lib.h b/sliding_tile_lib.h index 772817e..1b56da4 100644 --- a/sliding_tile_lib.h +++ b/sliding_tile_lib.h @@ -30,7 +30,7 @@ std::ostream& operator<<(std::ostream& os, const Board& board); struct Step { Board board; std::shared_ptr prev; - std::vector successors(std::shared_ptr shared_this); + std::vector successors(std::shared_ptr shared_this) const; static signed char adjacent[BOARD_SIZE][5]; }; std::ostream& operator<<(std::ostream& os, const Step& step);