summaryrefslogtreecommitdiff
path: root/euler/include/std
diff options
context:
space:
mode:
Diffstat (limited to 'euler/include/std')
-rw-r--r--euler/include/std/condition-variable.hpp13
-rw-r--r--euler/include/std/list.hpp19
-rw-r--r--euler/include/std/unique-lock.hpp (renamed from euler/include/std/unique_lock.hpp)0
-rw-r--r--euler/include/std/vector.hpp18
4 files changed, 42 insertions, 8 deletions
diff --git a/euler/include/std/condition-variable.hpp b/euler/include/std/condition-variable.hpp
new file mode 100644
index 0000000..0568373
--- /dev/null
+++ b/euler/include/std/condition-variable.hpp
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <mutex>
+
+namespace std {
+
+ class condition_variable {
+
+ //TODO
+
+ };
+
+}
diff --git a/euler/include/std/list.hpp b/euler/include/std/list.hpp
index 77eaaec..c0d6e21 100644
--- a/euler/include/std/list.hpp
+++ b/euler/include/std/list.hpp
@@ -19,11 +19,11 @@ namespace std {
node *the_node;
- bool operator ==(const generic_iterator &other) {
+ bool operator ==(const generic_iterator &other) const {
return the_node == other.the_node;
}
- bool operator !=(const generic_iterator &other) {
+ bool operator !=(const generic_iterator &other) const {
return the_node != other.the_node;
}
@@ -82,13 +82,14 @@ namespace std {
return iterator { .the_node = r };
}
- iterator begin() const noexcept {
- return iterator { .the_node = first_node };
- }
+ iterator begin() noexcept { return iterator { .the_node = first_node }; }
+ iterator end() noexcept { return iterator { .the_node = 0 }; }
- iterator end() const noexcept {
- return iterator { .the_node = 0 };
- }
+ const_iterator begin() const noexcept { return iterator { .the_node = first_node }; }
+ const_iterator end() const noexcept { return iterator { .the_node = 0 }; }
+
+ const_iterator cbegin() const noexcept { return iterator { .the_node = first_node }; }
+ const_iterator cend() const noexcept { return iterator { .the_node = 0 }; }
size_t remove(const T &value) {
size_t removed = 0;
@@ -140,6 +141,7 @@ namespace std {
clear();
for (node *n = other.first_node; n; n = n->next)
push_back(n->value);
+ return *this;
}
list &operator =(list &&other) {
@@ -150,6 +152,7 @@ namespace std {
other.first_node = 0;
other.last_node = 0;
other.count = 0;
+ return *this;
}
};
diff --git a/euler/include/std/unique_lock.hpp b/euler/include/std/unique-lock.hpp
index 14b3645..14b3645 100644
--- a/euler/include/std/unique_lock.hpp
+++ b/euler/include/std/unique-lock.hpp
diff --git a/euler/include/std/vector.hpp b/euler/include/std/vector.hpp
index 1c35d9d..8cd02b4 100644
--- a/euler/include/std/vector.hpp
+++ b/euler/include/std/vector.hpp
@@ -131,6 +131,12 @@ namespace std {
}
+ void clear() {
+ for (size_type i = 0; i < _size; ++i)
+ std::destroy_at(_data + i);
+ _size = 0;
+ }
+
constexpr size_type size() const noexcept {
return _size;
}
@@ -188,6 +194,18 @@ namespace std {
++_size;
}
+ using iterator = T *;
+ using const_iterator = const T *;
+
+ iterator begin() noexcept { return _data; }
+ iterator end() noexcept { return _data + _size; }
+
+ const_iterator begin() const noexcept { return _data; }
+ const_iterator end() const noexcept { return _data + _size; }
+
+ const_iterator cbegin() const noexcept { return _data; }
+ const_iterator cend() const noexcept { return _data + _size; }
+
};
}