From 27c30ca06344cc686130155aad10095ad009d7d7 Mon Sep 17 00:00:00 2001 From: Lenny Maiorani Date: Wed, 16 Feb 2022 11:44:57 -0700 Subject: Games: Use default constructors/destructors https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler." --- Userland/Games/GameOfLife/Board.cpp | 5 +---- Userland/Games/GameOfLife/Board.h | 3 ++- Userland/Games/GameOfLife/Pattern.cpp | 5 +---- Userland/Games/GameOfLife/Pattern.h | 4 ++-- 4 files changed, 6 insertions(+), 11 deletions(-) (limited to 'Userland/Games/GameOfLife') diff --git a/Userland/Games/GameOfLife/Board.cpp b/Userland/Games/GameOfLife/Board.cpp index 897f30c340..1e693809c6 100644 --- a/Userland/Games/GameOfLife/Board.cpp +++ b/Userland/Games/GameOfLife/Board.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2021, Andres Crucitti * Copyright (c) 2021, Linus Groh + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -14,10 +15,6 @@ Board::Board(size_t rows, size_t columns) resize(rows, columns); } -Board::~Board() -{ -} - void Board::run_generation() { m_stalled = true; diff --git a/Userland/Games/GameOfLife/Board.h b/Userland/Games/GameOfLife/Board.h index bcd3425e99..227311c1bb 100644 --- a/Userland/Games/GameOfLife/Board.h +++ b/Userland/Games/GameOfLife/Board.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2021, Andres Crucitti * Copyright (c) 2021, Linus Groh + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -14,7 +15,7 @@ class Board { public: Board(size_t rows, size_t columns); - ~Board(); + ~Board() = default; size_t columns() const { return m_columns; } size_t rows() const { return m_rows; } diff --git a/Userland/Games/GameOfLife/Pattern.cpp b/Userland/Games/GameOfLife/Pattern.cpp index 35376c6375..5c26c6dc84 100644 --- a/Userland/Games/GameOfLife/Pattern.cpp +++ b/Userland/Games/GameOfLife/Pattern.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2021, Ryan Wilson + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -16,10 +17,6 @@ Pattern::Pattern(Vector pattern) m_pattern = move(pattern); } -Pattern::~Pattern() -{ -} - void Pattern::set_action(GUI::Action* action) { m_action = action; diff --git a/Userland/Games/GameOfLife/Pattern.h b/Userland/Games/GameOfLife/Pattern.h index 9fa3ce1c8b..c7b1514963 100644 --- a/Userland/Games/GameOfLife/Pattern.h +++ b/Userland/Games/GameOfLife/Pattern.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2021, Ryan Wilson + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -11,10 +12,9 @@ #include #include -class Pattern { +class Pattern final { public: Pattern(Vector); - virtual ~Pattern(); Vector pattern() { return m_pattern; }; GUI::Action* action() { return m_action; } void set_action(GUI::Action*); -- cgit v1.2.3