Avoid adding a function template declaration to namespace std

Change-Id: I1368276c859d3c81f4ebfbeca47bb99e781f2fed
Reviewed-on: https://gerrit.libreoffice.org/78214
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2019-08-28 08:43:44 +02:00
parent 55402d82c5
commit 042e30a3dc

View File

@@ -45,19 +45,23 @@
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <algorithm> #include <algorithm>
#include <utility>
#include <vector> #include <vector>
using namespace ::com::sun::star; using namespace ::com::sun::star;
namespace
namespace std
{ {
// add operator== for weak_ptr, so we can use std::find over lists of them // add operator== for weak_ptr, so we can use std::find over lists of them
template<typename T> static bool operator==( weak_ptr<T> const& rLHS, struct ViewEventHandlerWeakPtrWrapper final {
weak_ptr<T> const& rRHS ) slideshow::internal::ViewEventHandlerWeakPtr ptr;
{
return rLHS.lock().get() == rRHS.lock().get(); ViewEventHandlerWeakPtrWrapper(slideshow::internal::ViewEventHandlerWeakPtr thePtr):
} ptr(std::move(thePtr)) {}
bool operator ==(ViewEventHandlerWeakPtrWrapper const & other) const
{ return ptr.lock().get() == other.ptr.lock().get(); }
};
} }
namespace slideshow { namespace slideshow {
@@ -209,8 +213,8 @@ struct EventMultiplexerImpl
PauseEventHandlerSharedPtr, PauseEventHandlerSharedPtr,
std::vector<PauseEventHandlerSharedPtr> > ImplPauseHandlers; std::vector<PauseEventHandlerSharedPtr> > ImplPauseHandlers;
typedef ThreadUnsafeListenerContainer< typedef ThreadUnsafeListenerContainer<
ViewEventHandlerWeakPtr, ViewEventHandlerWeakPtrWrapper,
std::vector<ViewEventHandlerWeakPtr> > ImplViewHandlers; std::vector<ViewEventHandlerWeakPtrWrapper> > ImplViewHandlers;
typedef ThreadUnsafeListenerContainer< typedef ThreadUnsafeListenerContainer<
ViewRepaintHandlerSharedPtr, ViewRepaintHandlerSharedPtr,
std::vector<ViewRepaintHandlerSharedPtr> > ImplRepaintHandlers; std::vector<ViewRepaintHandlerSharedPtr> > ImplRepaintHandlers;
@@ -1101,8 +1105,8 @@ void EventMultiplexer::notifyViewAdded( const UnoViewSharedPtr& rView )
mpImpl->mxListener.get() ); mpImpl->mxListener.get() );
mpImpl->maViewHandlers.applyAll( mpImpl->maViewHandlers.applyAll(
[&rView]( const ViewEventHandlerWeakPtr& pHandler ) [&rView]( const ViewEventHandlerWeakPtrWrapper& pHandler )
{ return pHandler.lock()->viewAdded( rView ); } ); { return pHandler.ptr.lock()->viewAdded( rView ); } );
} }
void EventMultiplexer::notifyViewRemoved( const UnoViewSharedPtr& rView ) void EventMultiplexer::notifyViewRemoved( const UnoViewSharedPtr& rView )
@@ -1123,15 +1127,15 @@ void EventMultiplexer::notifyViewRemoved( const UnoViewSharedPtr& rView )
mpImpl->mxListener.get() ); mpImpl->mxListener.get() );
mpImpl->maViewHandlers.applyAll( mpImpl->maViewHandlers.applyAll(
[&rView]( const ViewEventHandlerWeakPtr& pHandler ) [&rView]( const ViewEventHandlerWeakPtrWrapper& pHandler )
{ return pHandler.lock()->viewRemoved( rView ); } ); { return pHandler.ptr.lock()->viewRemoved( rView ); } );
} }
void EventMultiplexer::notifyViewChanged( const UnoViewSharedPtr& rView ) void EventMultiplexer::notifyViewChanged( const UnoViewSharedPtr& rView )
{ {
mpImpl->maViewHandlers.applyAll( mpImpl->maViewHandlers.applyAll(
[&rView]( const ViewEventHandlerWeakPtr& pHandler ) [&rView]( const ViewEventHandlerWeakPtrWrapper& pHandler )
{ return pHandler.lock()->viewChanged( rView ); } ); { return pHandler.ptr.lock()->viewChanged( rView ); } );
} }
void EventMultiplexer::notifyViewChanged( const uno::Reference<presentation::XSlideShowView>& xView ) void EventMultiplexer::notifyViewChanged( const uno::Reference<presentation::XSlideShowView>& xView )
@@ -1147,7 +1151,8 @@ void EventMultiplexer::notifyViewChanged( const uno::Reference<presentation::XSl
void EventMultiplexer::notifyViewsChanged() void EventMultiplexer::notifyViewsChanged()
{ {
mpImpl->maViewHandlers.applyAll( mpImpl->maViewHandlers.applyAll(
std::mem_fn( &ViewEventHandler::viewsChanged )); []( const ViewEventHandlerWeakPtrWrapper& pHandler )
{ return pHandler.ptr.lock()->viewsChanged(); } );
} }
void EventMultiplexer::notifyViewClobbered( void EventMultiplexer::notifyViewClobbered(