|
From: Lasse Kärkkäi. <tr...@us...> - 2012-07-03 23:40:37
|
Author: Lasse Kärkkäinen <tronic+ndrm at trn.iki.fi> Date: Tue Nov 29 11:24:11 2011 +0200 Use std::list for fs Paths instead of std::vector. --- game/fs.cc | 3 +-- game/fs.hh | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/game/fs.cc b/game/fs.cc index cb59487..718d630 100644 --- a/game/fs.cc +++ b/game/fs.cc @@ -214,8 +214,7 @@ Paths const& getPaths(bool refresh) { paths.clear(); std::remove_copy_if(dirs.begin(), dirs.end(), std::inserter(paths, paths.end()), pathNotExist); // Assure that each path appears only once - Paths::iterator it = std::unique(paths.begin(), paths.end()); - paths.resize(it - paths.begin()); + paths.erase(std::unique(paths.begin(), paths.end()), paths.end()); } return paths; } diff --git a/game/fs.hh b/game/fs.hh index a77265a..241d110 100644 --- a/game/fs.hh +++ b/game/fs.hh @@ -1,7 +1,7 @@ #pragma once #include <boost/filesystem.hpp> -#include <vector> +#include <list> // Define this useful alias for the overlong namespace name (yes, for everyone who includes this header) namespace fs = boost::filesystem; @@ -42,7 +42,7 @@ std::string getPath(fs::path const& filename); /** Get full path to a default conguration file **/ fs::path getDefaultConfig(fs::path const &configFile); -typedef std::vector<fs::path> Paths; +typedef std::list<fs::path> Paths; /** Get all shared data paths in preference order **/ Paths const& getPaths(bool refresh = false); |