summaryrefslogtreecommitdiff
path: root/AK/Vector.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-13 01:36:31 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-13 01:36:31 +0100
commit97c799576a478d3881bfff1196f0fa829d736994 (patch)
treefb9d43820e7e65318c2f0e3d9f67932aee3a78ae /AK/Vector.h
parent19b9401487e87dcbb43b52c6fe194e3b0e49f842 (diff)
downloadserenity-97c799576a478d3881bfff1196f0fa829d736994.zip
Add close-on-exec flag for file descriptors.
I was surprised to find that dup()'ed fds don't share the close-on-exec flag. That means it has to be stored separately from the FileDescriptor object.
Diffstat (limited to 'AK/Vector.h')
-rw-r--r--AK/Vector.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/AK/Vector.h b/AK/Vector.h
index 0c0a7c3e30..8824e10a46 100644
--- a/AK/Vector.h
+++ b/AK/Vector.h
@@ -142,6 +142,17 @@ public:
m_impl->remove(index);
}
+ Vector& operator=(const Vector<T>& other)
+ {
+ if (this != &other) {
+ clear();
+ ensureCapacity(other.size());
+ for (const auto& v : other)
+ unchecked_append(v);
+ }
+ return *this;
+ }
+
void append(Vector<T>&& other)
{
Vector<T> tmp = move(other);