Przeglądaj źródła

feat(string): pop(), back() etc.

greatbridf 2 lat temu
rodzic
commit
7f67c01d7e
1 zmienionych plików z 20 dodań i 0 usunięć
  1. 20 0
      include/types/string.hpp

+ 20 - 0
include/types/string.hpp

@@ -74,6 +74,26 @@ public:
         inner_vector_type::clear();
         this->push_back(0x00);
     }
+    char pop(void)
+    {
+        this->pop_back();
+        auto iter = inner_vector_type::back();
+        char c = *iter;
+        *iter = 0x00;
+        return c;
+    }
+    typename inner_vector_type::iterator_type back(void)
+    {
+        return --inner_vector_type::back();
+    }
+    typename inner_vector_type::const_iterator_type back(void) const
+    {
+        return --inner_vector_type::back();
+    }
+    typename inner_vector_type::const_iterator_type cback(void) const
+    {
+        return --inner_vector_type::cback();
+    }
 };
 } // namespace types