Ole лет назад: 9
Родитель
Сommit
495daa119d
2 измененных файлов с 24 добавлено и 1 удалено
  1. 1 1
      Makefile
  2. 23 0
      examples/tables.cpp

+ 1 - 1
Makefile

@@ -12,7 +12,7 @@ TEST_OBJS       := $(TEST_SRCS:%.cpp=$(TEST_DIR)/%.o)
 
 # Example artifacts
 EXAMPLE_DIR     := examples
-EXAMPLE_SRCS    := types.cpp stack.cpp functions.cpp usertypes.cpp state.cpp
+EXAMPLE_SRCS    := types.cpp stack.cpp functions.cpp usertypes.cpp state.cpp tables.cpp
 EXAMPLE_DEPS    := $(EXAMPLE_SRCS:%.cpp=$(EXAMPLE_DIR)/%.d)
 EXAMPLE_OBJS    := $(EXAMPLE_SRCS:%.cpp=$(EXAMPLE_DIR)/%.out)
 

+ 23 - 0
examples/tables.cpp

@@ -0,0 +1,23 @@
+#include <luwra.hpp>
+
+#include <string>
+#include <iostream>
+
+using namespace luwra;
+
+int main() {
+	StateWrapper state;
+
+	state["t1"] = FieldVector {};
+
+	for (int i = 0; i < 10000; i++) {
+		state["t1"]["value"] = i;
+		int j = state["t1"]["value"];
+
+		if (j != i) {
+			return 1;
+		}
+	}
+
+	return 0;
+}