From: Tor Didriksen Date: October 17 2011 12:51pm Subject: bzr push into mysql-trunk-wl5825-stl branch (tor.didriksen:3444 to 3445) WL#5825 List-Archive: http://lists.mysql.com/commits/141473 Message-Id: <201110171251.p9HCpEF5029798@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 +#if defined(__GNUC__) +#include +#elif defined(__WIN__) +#include +#elif defined(__SUNPRO_CC) +#include +#else +#error "Don't know how to implement hash_map" +#endif + + +template +struct MyHashMap +{ +#if defined(__GNUC__) + typedef std::tr1::unordered_map Type; +#elif defined(__WIN__) + typedef stdext::hash_map Type; +#elif defined(__SUNPRO_CC) + typedef std::hash_map Type; +#endif +}; + + +TEST(STDfeatures, HashMap) +{ + MyHashMap::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 No bundle (reason: useless for push emails).