diff options
author | bunnei <bunneidev@gmail.com> | 2018-08-03 05:01:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-03 05:01:19 +0200 |
commit | 291ccf7257182fc77163a6d0d215895c85c210c1 (patch) | |
tree | a311912d183e7778ca9f1571ac688cf92a43c5d0 | |
parent | Merge pull request #901 from lioncash/ref (diff) | |
parent | vfs_vector: Remove unused variable in FindAndRemoveVectorElement() (diff) | |
download | yuzu-291ccf7257182fc77163a6d0d215895c85c210c1.tar yuzu-291ccf7257182fc77163a6d0d215895c85c210c1.tar.gz yuzu-291ccf7257182fc77163a6d0d215895c85c210c1.tar.bz2 yuzu-291ccf7257182fc77163a6d0d215895c85c210c1.tar.lz yuzu-291ccf7257182fc77163a6d0d215895c85c210c1.tar.xz yuzu-291ccf7257182fc77163a6d0d215895c85c210c1.tar.zst yuzu-291ccf7257182fc77163a6d0d215895c85c210c1.zip |
-rw-r--r-- | src/core/file_sys/vfs_vector.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/file_sys/vfs_vector.cpp b/src/core/file_sys/vfs_vector.cpp index 4c6337e3a..fda603960 100644 --- a/src/core/file_sys/vfs_vector.cpp +++ b/src/core/file_sys/vfs_vector.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include <algorithm> +#include <utility> #include "core/file_sys/vfs_vector.h" namespace FileSys { @@ -31,16 +32,18 @@ bool VectorVfsDirectory::IsReadable() const { std::string VectorVfsDirectory::GetName() const { return name; } + std::shared_ptr<VfsDirectory> VectorVfsDirectory::GetParentDirectory() const { return parent; } template <typename T> static bool FindAndRemoveVectorElement(std::vector<T>& vec, std::string_view name) { - auto iter = std::find_if(vec.begin(), vec.end(), [name](T e) { return e->GetName() == name; }); + const auto iter = + std::find_if(vec.begin(), vec.end(), [name](const T& e) { return e->GetName() == name; }); if (iter == vec.end()) return false; - auto old_size = vec.size(); + vec.erase(iter); return true; } @@ -77,7 +80,7 @@ void VectorVfsDirectory::AddDirectory(VirtualDir dir) { bool VectorVfsDirectory::ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) { if (!DeleteFile(file->GetName())) return false; - dirs.emplace_back(dir); + dirs.emplace_back(std::move(dir)); return true; } } // namespace FileSys |