[Scummvm-git-logs] scummvm master -> 901b9dcc5747a013b7b11c675954c708a6da690c
grisenti
noreply at scummvm.org
Fri Feb 24 17:36:42 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
901b9dcc57 HPL1: implement copy and move for Hpl1::Std::Tree
Commit: 901b9dcc5747a013b7b11c675954c708a6da690c
https://github.com/scummvm/scummvm/commit/901b9dcc5747a013b7b11c675954c708a6da690c
Author: grisenti (emanuele at grisenti.net)
Date: 2023-02-24T18:36:30+01:00
Commit Message:
HPL1: implement copy and move for Hpl1::Std::Tree
Changed paths:
engines/hpl1/std/tree.h
diff --git a/engines/hpl1/std/tree.h b/engines/hpl1/std/tree.h
index 6df7495750e..19c54b1f012 100644
--- a/engines/hpl1/std/tree.h
+++ b/engines/hpl1/std/tree.h
@@ -23,6 +23,7 @@
#define HPL1_TREE_H
#include "common/func.h"
+#include "common/util.h"
#include "hpl1/std/pair.h"
namespace Hpl1 {
@@ -91,6 +92,34 @@ public:
using BasicIterator = Iterator<ValueType &, ValueType *>;
using ConstIterator = Iterator<const ValueType &, const ValueType *>;
+ Tree(KeyComp comp = {}) : _comp(Common::move(comp)) {
+ }
+
+ Tree(const Tree &other) : _comp(other._comp) {
+ for (const auto &val : other)
+ insert(val);
+ }
+
+ Tree(Tree &&other) : _root(other._root), _leftmost(other._leftmost), _size(other._size), _comp(Common::move(other._comp)) {
+ }
+
+ Tree &operator=(const Tree &rhs) {
+ *this = Tree(rhs);
+ return *this;
+ }
+
+ Tree &operator=(Tree &&rhs) {
+ clear();
+ _root = rhs._root;
+ _leftmost = rhs._leftmost;
+ _size = rhs._size;
+ _comp = Common::move(rhs._comp);
+ rhs._root = nullptr;
+ rhs._leftmost = nullptr;
+ rhs._size = 0;
+ return *this;
+ }
+
void clear() {
erase(begin(), end());
_size = 0;
More information about the Scummvm-git-logs
mailing list