diff options
Diffstat (limited to 'cpp/src/Ice')
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 14 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.h | 2 |
2 files changed, 6 insertions, 10 deletions
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index 77275bd8648..29280b2e5b3 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -34,6 +34,8 @@ using namespace IceInternal; void IceInternal::incRef(IceInternal::Reference* p) { p->__incRef(); } void IceInternal::decRef(IceInternal::Reference* p) { p->__decRef(); } +pointer_to_unary_function<int, int> Reference::_rand(IceUtil::random); + CommunicatorPtr IceInternal::Reference::getCommunicator() const { @@ -636,11 +638,7 @@ IceInternal::FixedReference::filterConnections(const vector<ConnectionIPtr>& all // // Randomize the order of connections. // -#ifdef _MSC_VER - random_shuffle(connections.begin(), connections.end(), ptr_fun(IceUtil::random)); -#else - random_shuffle(connections.begin(), connections.end(), IceUtil::random); -#endif + random_shuffle(connections.begin(), connections.end(), _rand); // // If a secure connection is requested, remove all non-secure @@ -936,11 +934,7 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all { case Random: { -#ifdef _MSC_VER - random_shuffle(endpoints.begin(), endpoints.end(), ptr_fun(IceUtil::random)); -#else - random_shuffle(endpoints.begin(), endpoints.end(), IceUtil::random); -#endif + random_shuffle(endpoints.begin(), endpoints.end(), _rand); break; } case Ordered: diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h index 988cfa83bc8..a014666fe10 100644 --- a/cpp/src/Ice/Reference.h +++ b/cpp/src/Ice/Reference.h @@ -116,6 +116,8 @@ protected: mutable Ice::Int _hashValue; mutable bool _hashInitialized; + static std::pointer_to_unary_function<int, int> _rand; + private: const InstancePtr _instance; |