3445 Tor Didriksen 2011-10-17
WL#5825 Using C++ Standard Library with MySQL code
Figure out how to use std::hash_map<> and variants.
modified:
unittest/gunit/stdcxx-t.cc
3444 Tor Didriksen 2011-10-17
Remove -icc- build files
removed:
BUILD/compile-pentium-icc
BUILD/compile-pentium-icc-valgrind-max
BUILD/compile-pentium-icc-yassl
=== modified file 'unittest/gunit/stdcxx-t.cc'
--- a/unittest/gunit/stdcxx-t.cc 2011-10-11 04:27:52 +0000
+++ b/unittest/gunit/stdcxx-t.cc 2011-10-17 12:50:40 +0000
@@ -20,6 +20,43 @@
#include "my_config.h"
#include <gtest/gtest.h>
+#if defined(__GNUC__)
+#include <tr1/unordered_map>
+#elif defined(__WIN__)
+#include <hash_map>
+#elif defined(__SUNPRO_CC)
+#include <hash_map>
+#else
+#error "Don't know how to implement hash_map"
+#endif
+
+
+template<typename K, typename T>
+struct MyHashMap
+{
+#if defined(__GNUC__)
+ typedef std::tr1::unordered_map<K, T> Type;
+#elif defined(__WIN__)
+ typedef stdext::hash_map<K, T> Type;
+#elif defined(__SUNPRO_CC)
+ typedef std::hash_map<K, T> Type;
+#endif
+};
+
+
+TEST(STDfeatures, HashMap)
+{
+ MyHashMap<int, int>::Type intmap;
+ for (int ix= 0; ix < 10; ++ix)
+ {
+ intmap[ix]= ix * ix;
+ }
+ int t= intmap[0];
+ EXPECT_EQ(0, t);
+ EXPECT_TRUE(0 == intmap.count(42));
+ EXPECT_TRUE(intmap.end() == intmap.find(42));
+}
+
#if defined(TARGET_OS_LINUX)
#include <malloc.h>
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-wl5825-stl branch (tor.didriksen:3444 to 3445)WL#5825 | Tor Didriksen | 17 Oct |