We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent da58076 commit 62df0dfCopy full SHA for 62df0df
example.cpp
@@ -0,0 +1,28 @@
1
+#include <iostream>
2
+#include "dynvars.hpp"
3
+
4
+int main(){
5
6
+ // Make an object to hold your data
7
+ DynVars myData;
8
9
+ // Create a new variable i
10
+ myData.newVariable("i");
11
12
+ // Assign a value to the new variable
13
+ myData.writeVariable("i", 5);
14
15
+ // Print the value of our variable to the screen
16
+ std::cout << myData.readVariable<int>("i") << std::endl;
17
18
+ // Why not use a pointer to make changes to our variable?
19
+ int* i = myData.getPointer<int>("i");
20
21
+ // Change the value of our variable using the pointer
22
+ *i = 10;
23
24
+ // Both results are the same
25
+ std::cout << *i << " = " << myData.readVariable<int>("i") << std::endl;
26
27
+ return 0;
28
+}
0 commit comments