1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 03:09:57 +01:00

Use tr1 for mac compatibility

This commit is contained in:
John Maguire 2012-11-26 10:10:20 +01:00
parent 11f664083a
commit c294098aef
4 changed files with 10 additions and 7 deletions

View File

@ -33,7 +33,7 @@ ClosureBase::~ClosureBase() {
CallbackClosure::CallbackClosure(
QObject* sender,
const char* signal,
std::function<void()> callback)
std::tr1::function<void()> callback)
: ClosureBase(new ObjectHelper(sender, signal, this)),
callback_(callback) {
}
@ -67,7 +67,7 @@ void Unpack(QList<QGenericArgument>*) {}
_detail::ClosureBase* NewClosure(
QObject* sender,
const char* signal,
std::function<void()> callback) {
std::tr1::function<void()> callback) {
return new _detail::CallbackClosure(
sender, signal, callback);
}

View File

@ -18,6 +18,8 @@
#ifndef CLOSURE_H
#define CLOSURE_H
#include <tr1/functional>
#include <QMetaMethod>
#include <QObject>
#include <QSharedPointer>
@ -155,12 +157,12 @@ class CallbackClosure : public ClosureBase {
CallbackClosure(
QObject* sender,
const char* signal,
std::function<void()> callback);
std::tr1::function<void()> callback);
virtual void Invoke();
private:
std::function<void()> callback_;
std::tr1::function<void()> callback_;
};
} // namespace _detail
@ -191,7 +193,7 @@ _detail::ClosureBase* NewClosure(
_detail::ClosureBase* NewClosure(
QObject* sender,
const char* signal,
std::function<void()> callback);
std::tr1::function<void()> callback);
void DoAfter(QObject* receiver, const char* slot, int msec);

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 2.6)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -fpermissive -U__STRICT_ANSI__")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -fpermissive -Wno-c++11-narrowing -U__STRICT_ANSI__")
if(USE_SYSTEM_GMOCK)
include_directories(${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS})

View File

@ -1,6 +1,7 @@
#include "gtest/gtest.h"
#include <functional>
#include <tr1/functional>
#include <QEventLoop>
#include <QFutureWatcher>
@ -143,7 +144,7 @@ TEST(ConcurrentRunTest, ConcurrentRunVoidBindFunctionStart) {
A a;
int nb = 10;
QFuture<void> future = ConcurrentRun::Run<void>(&threadpool, std::bind(&A::f, &a, &nb));
QFuture<void> future = ConcurrentRun::Run<void>(&threadpool, std::tr1::bind(&A::f, &a, &nb));
QFutureWatcher<void> watcher;
watcher.setFuture(future);
QEventLoop loop;