summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/Database.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceGrid/Database.cpp')
-rw-r--r--cpp/src/IceGrid/Database.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp
index 9e270c2ff40..8a62f3c0ef0 100644
--- a/cpp/src/IceGrid/Database.cpp
+++ b/cpp/src/IceGrid/Database.cpp
@@ -26,6 +26,7 @@ using namespace IceGrid;
const string Database::_descriptorDbName = "applications";
const string Database::_adapterDbName = "adapters";
const string Database::_objectDbName = "objects";
+pointer_to_unary_function<int, int> Database::_rand(IceUtil::random);
namespace IceGrid
{
@@ -766,11 +767,7 @@ Database::getAdapters(const string& id, bool allRegistered, int& endpointCount)
adpts.push_back(make_pair(p->first, adpt));
++p;
}
-#ifdef _MSC_VER
- random_shuffle(adpts.begin(), adpts.end(), ptr_fun(IceUtil::random));
-#else
- random_shuffle(adpts.begin(), adpts.end(), IceUtil::random);
-#endif
+ random_shuffle(adpts.begin(), adpts.end(), _rand);
endpointCount = static_cast<int>(adpts.size());
return adpts;
}
@@ -939,11 +936,7 @@ Ice::ObjectPrx
Database::getObjectByTypeOnLeastLoadedNode(const string& type, LoadSample sample)
{
Ice::ObjectProxySeq objs = getObjectsByType(type);
-#ifdef _MSC_VER
- random_shuffle(objs.begin(), objs.end(), ptr_fun(IceUtil::random));
-#else
- random_shuffle(objs.begin(), objs.end(), IceUtil::random);
-#endif
+ random_shuffle(objs.begin(), objs.end(), _rand);
vector<pair<Ice::ObjectPrx, float> > objectsWithLoad;
objectsWithLoad.reserve(objs.size());
for(Ice::ObjectProxySeq::const_iterator p = objs.begin(); p != objs.end(); ++p)