Browse Source

more comments

Kajetan Johannes Hammerle 3 years ago
parent
commit
93f27458ef
1 changed files with 6 additions and 0 deletions
  1. 6 0
      Main.cpp

+ 6 - 0
Main.cpp

@@ -2,6 +2,9 @@
 #include <iostream>
 #include <vector>
 
+// this struct is used in the automated tests at the end of the file
+// it counts all instances with different numbers to ensure each object is
+// constructed and destructed the same amount
 struct A {
     static int instances;
     int a;
@@ -59,6 +62,7 @@ public:
         for(int i = 0; i < elements; i++) {
             data[i].~T();
         }
+        // casting this pointer not back to its origin type yields a crash
         delete[] reinterpret_cast<char*>(data);
     }
 
@@ -233,6 +237,8 @@ void printError(int number) {
     std::cout << "\033[0;31mError " << number << "\033[0m\n";
 }
 
+// V is either std::vector or Vector to test for complete same behaviour in both
+// implementations
 template<typename V>
 void test() {
     {