Skip to content

Commit 4cb915b

Browse files
committed
Better readme
1 parent bd9615e commit 4cb915b

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,30 @@
11
# poly-var-cpp
22
Just-for-fun implementation of polymorphic variables in C/C++
33

4+
```c++
5+
#include <var>
6+
#include <var_math>
7+
#include <var_test>
8+
using namespace variable;
9+
10+
int main(void) {
11+
12+
/* Constructing a polymorphic-type tree */
13+
var hmap = var::Hashmap;
14+
hmap["foo"] = "bar";
15+
16+
var a = hmap.ref();
17+
var ref = {a.ref(), 42};
18+
var ref2 = {ref.ref(), 69, 25};
19+
var tree = { {{}, 12, {}}, "ala", {{}, 69, {}} };
20+
21+
vardbg(tree);
22+
23+
return 0;
24+
}
25+
26+
```
27+
428
## Usage
529
630
Clone the repository, go to the directory where it's placed

0 commit comments

Comments
 (0)