From cea272cfec1cf181ca673cc9454517b6d91a4f97 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 31 Dec 2015 22:03:37 -0800 Subject: [PATCH 1/1] Mark const methods const. --- sliding_tile_lib.cc | 4 ++-- sliding_tile_lib.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sliding_tile_lib.cc b/sliding_tile_lib.cc index b8ddc15..5b2e798 100644 --- a/sliding_tile_lib.cc +++ b/sliding_tile_lib.cc @@ -22,7 +22,7 @@ signed char adjacent[BOARD_SIZE][5] = { 11, 14, -1, -1, -1, }; -bool Board::is_valid() { +bool Board::is_valid() const { bool seen[BOARD_SIZE]; for (int i = 0; i < BOARD_SIZE; i++) { seen[i] = false; @@ -65,7 +65,7 @@ std::istream& operator>>(std::istream& is, Board& board) { return is; } -signed char Board::hole() { +signed char Board::hole() const { for (int i = 0; i < BOARD_SIZE; i++) { if (board[i] == 0) { return i; diff --git a/sliding_tile_lib.h b/sliding_tile_lib.h index 84d422e..4d6c015 100644 --- a/sliding_tile_lib.h +++ b/sliding_tile_lib.h @@ -8,8 +8,8 @@ const int BOARD_SIZE = BOARD_DIM * BOARD_DIM; struct Board { signed char board[BOARD_SIZE]; - bool is_valid(); - signed char hole(); + bool is_valid() const; + signed char hole() const; }; std::istream& operator>>(std::istream& is, Board& board); -- 2.44.1