From f4d714d690973479d8d508d3a51ecac341075d8f Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Wed, 27 Apr 2016 21:43:37 +0200 Subject: [PATCH] remove util::array std::array or boost::array can be used instead. --- src/array.hpp | 74 --------------------------------------- src/attack_prediction.cpp | 6 ++-- 2 files changed, 3 insertions(+), 77 deletions(-) delete mode 100644 src/array.hpp diff --git a/src/array.hpp b/src/array.hpp deleted file mode 100644 index afcc9bc618d..00000000000 --- a/src/array.hpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (C) 2003 - 2016 by David White - Part of the Battle for Wesnoth Project http://www.wesnoth.org/ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY. - - See the COPYING file for more details. -*/ - -/** - * @file - * Template for arrays. - */ - -#ifndef ARRAY_HPP_INCLUDED -#define ARRAY_HPP_INCLUDED - -#include - -namespace util -{ - -template -class array -{ -public: - typedef T value_type; - typedef T* iterator; - typedef const T* const_iterator; - typedef T& reference; - typedef const T& const_reference; - typedef size_t size_type; - - array() {} - array(const T& o) - { - std::fill(begin(),end(),o); - } - - iterator begin() { return a; } - iterator end() { return a + N; } - - const_iterator begin() const { return a; } - const_iterator end() const { return a + N; } - - reference operator[](size_type n) { return a[n]; } - const_reference operator[](size_type n) const { return a[n]; } - - reference front() { return a[0]; } - reference back() { return a[N-1]; } - - const_reference front() const { return a[0]; } - const_reference back() const { return a[N-1]; } - - size_type size() const { return N; } - - bool empty() const { return size() == 0; } - - T* data() { return a; } - const T* data() const { return a; } - -private: - T a[N]; -}; - -} // end namespace util - -#endif - diff --git a/src/attack_prediction.cpp b/src/attack_prediction.cpp index 4fd84dce40d..755beeef832 100644 --- a/src/attack_prediction.cpp +++ b/src/attack_prediction.cpp @@ -37,8 +37,8 @@ #include "attack_prediction.hpp" #include "actions/attack.hpp" -#include "array.hpp" #include "game_config.hpp" +#include #if defined(BENCHMARK) || defined(CHECK) #include @@ -207,11 +207,11 @@ private: private: // data const unsigned int rows_, cols_; - util::array plane_; + std::array plane_; // For optimization, we keep track of the rows and columns with data. // (The matrices are likely going to be rather sparse, with data on a grid.) - util::array, NUM_PLANES> used_rows_, used_cols_; + std::array, NUM_PLANES> used_rows_, used_cols_; };