relaxed some code for pre-c++11 compilers

This commit is contained in:
hyung-hwan 2018-01-26 15:03:40 +00:00
parent 4af515c970
commit 5a3586232f
2 changed files with 21 additions and 3 deletions

View File

@ -31,7 +31,7 @@
#include <qse/Uncopyable.hpp> #include <qse/Uncopyable.hpp>
#include <qse/cmn/Mmged.hpp> #include <qse/cmn/Mmged.hpp>
//#include <functional> #include <functional>
QSE_BEGIN_NAMESPACE(QSE) QSE_BEGIN_NAMESPACE(QSE)
@ -81,7 +81,25 @@ public:
this->x_func = std::bind(f); this->x_func = std::bind(f);
return qse_thr_start (this, (qse_thr_rtn_t)Thread::call_lambda, flags); return qse_thr_start (this, (qse_thr_rtn_t)Thread::call_lambda, flags);
} }
std::function<int(QSE::Thread*)> x_func;
#endif
#if (__cplusplus >= 201103L) || (defined(_MSC_VER) && _MSC_VER >= 1900) //C++11 or later
using lfunc_t = std::function<int(QSE::Thread*thr)>;
static int call_lambda (QSE::Thread* thr)
{
return thr->x_func (thr);
}
int start (lfunc_t f, int flags)
{
this->x_func = std::move(f);
return qse_thr_start (this, (qse_thr_rtn_t)Thread::call_lambda, flags);
}
//std::function<int(QSE::Thread*)> x_func;
lfunc_t x_func;
#endif #endif
virtual int start (int flags = 0) QSE_CPP_NOEXCEPT; virtual int start (int flags = 0) QSE_CPP_NOEXCEPT;

View File

@ -40,7 +40,7 @@ QSE_BEGIN_NAMESPACE(QSE)
///////////////////////////////// /////////////////////////////////
#include "../cmn/syserr.h" #include "../cmn/syserr.h"
IMPLEMENT_SYSERR_TO_ERRNUM (Socket::ErrorCode, Socket::ErrorCode::) IMPLEMENT_SYSERR_TO_ERRNUM (Socket::ErrorCode, Socket::)
Socket::Socket () QSE_CPP_NOEXCEPT: handle(QSE_INVALID_SCKHND), errcode(E_ENOERR) Socket::Socket () QSE_CPP_NOEXCEPT: handle(QSE_INVALID_SCKHND), errcode(E_ENOERR)
{ {