update btree example to demonstrate forward declaration.

This commit is contained in:
greg
2019-12-31 17:58:37 -05:00
parent 6324b34ad4
commit e867a03e00
2 changed files with 8 additions and 2 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
#include <iostream> #include <iostream>
#include <string> #include "btree_fwd.h"
#include <parallel_hashmap/btree.h> #include <parallel_hashmap/btree.h>
int main() int main()
@@ -21,7 +21,7 @@ int main()
for (auto& p: map) for (auto& p: map)
std::cout << p.first << ", " << p.second << '\n'; std::cout << p.first << ", " << p.second << '\n';
phmap::btree_map<int, std::string> map2; IntString map2; // IntString is declared in btree_fwd.h
map2.emplace(std::piecewise_construct, std::forward_as_tuple(0), std::forward_as_tuple(10, 'c')); map2.emplace(std::piecewise_construct, std::forward_as_tuple(0), std::forward_as_tuple(10, 'c'));
map2.try_emplace(1, 10, 'a'); // phmap::btree_map supports c++17 API map2.try_emplace(1, 10, 'a'); // phmap::btree_map supports c++17 API
+6
View File
@@ -0,0 +1,6 @@
#include <string>
#include <parallel_hashmap/phmap_fwd_decl.h>
using IntString = phmap::btree_map<int, std::string>;