diff options
Diffstat (limited to 'cpp/test/Freeze/dbmap/Client.cpp')
-rw-r--r-- | cpp/test/Freeze/dbmap/Client.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/cpp/test/Freeze/dbmap/Client.cpp b/cpp/test/Freeze/dbmap/Client.cpp index aca2d3a08ee..99c0c8a0ba5 100644 --- a/cpp/test/Freeze/dbmap/Client.cpp +++ b/cpp/test/Freeze/dbmap/Client.cpp @@ -27,19 +27,21 @@ using namespace Freeze; static Byte alphabetChars[] = "abcdefghijklmnopqrstuvwxyz"; vector<Byte> alphabet; -static void -ForEachTest(const pair<Byte, Int>&) +// The extern in the following function is due to a Sun C++ template bug +// +extern void +ForEachTest(const pair<const Byte, const Int>&) { } -static bool -FindIfTest(const pair<Byte, Int>& p) +extern bool +FindIfTest(const pair<const Byte, const Int>& p) { return p.first == 'b'; } -static bool -FindFirstOfTest(const pair<Byte, Int>& p, Byte q) +extern bool +FindFirstOfTest(const pair<const Byte, const Int>& p, Byte q) { return p.first == q; } @@ -52,7 +54,11 @@ populateDB(MAP& m) for(vector<Byte>::const_iterator j = alphabet.begin(); j != alphabet.end(); ++j) { - m.insert(make_pair(*j, j-alphabet.begin())); +#ifdef _MSC_VER + m.insert(MAP::value_type(*j, j-alphabet.begin())); +#else + m.insert(typename MAP::value_type(*j, j-alphabet.begin())); +#endif } } @@ -207,7 +213,7 @@ run(int argc, char* argv[], MAP& m) // Verify cloned cursors are independent // test(p->first != 'n' && p->second != 13); - pair<Byte, Int> data = *p; + pair<const Byte, const Int> data = *p; ++p; test(p->first != data.first && p->second != data.second); @@ -295,13 +301,13 @@ run(int argc, char* argv[], MAP& m) // j = find(alphabet.begin(), alphabet.end(), 'n'); map<Byte, const Int> pairs; - pairs.insert(make_pair(*j, j - alphabet.begin())); + pairs.insert(pair<const Byte, const Int>(*j, j - alphabet.begin())); ++j; - pairs.insert(make_pair(*j, j - alphabet.begin())); + pairs.insert(pair<const Byte, const Int>(*j, j - alphabet.begin())); ++j; - pairs.insert(make_pair(*j, j - alphabet.begin())); + pairs.insert(pair<const Byte, const Int>(*j, j - alphabet.begin())); ++j; - pairs.insert(make_pair(*j, j - alphabet.begin())); + pairs.insert(pair<const Byte, const Int>(*j, j - alphabet.begin())); p = find_first_of(m.begin(), m.end(), pairs.begin(), pairs.end()); test(p != m.end()); @@ -315,7 +321,7 @@ run(int argc, char* argv[], MAP& m) pairs.clear(); for(p = m.begin(); p != m.end(); ++p) { - pairs.insert(make_pair(p->first, p->second)); + pairs.insert(pair<const Byte, const Int>(p->first, p->second)); } test(pairs.size() == m.size()); |