I follow the example of an ASIO server with a timeout , and the line with the function shown here was changed from deadline_timer :: traits_type :: now () to be std :: chrono :: stable_clock :: now (), because I wanted to use standalone ASIO without boost. ASIO can use standalone with C ++ 11.
void check_deadline(deadline_timer* deadline)
{
if (stopped())
return;
if (deadline->expires_at() <= deadline_timer::traits_type::now()) {
stop();
} else {
deadline->async_wait(
std::bind(&TCP_Session::check_deadline, shared_from_this(), deadline));
}
}
Problem
In VS2015, the compiler works, but in Eclipse g ++ 4.9.2 it complains about
no match for 'operator<=' (operand types are
'asio::basic_waitable_timer<std::chrono::_V2::system_clock>::time_point
aka
std::chrono::time_point<std::chrono::_V2::system_clock, std::chrono::duration<long long int, std::ratio<1ll, 1000000000ll> > >}'
and
'std::chrono::_V2::steady_clock::time_point {aka std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long long int, std::ratio<1ll, 1000000000ll> > >}') TCPSession.h line 284 C/C++ Problem
Question:
I found that I can only use C ++ 11, not C ++ 14. So, how to fix this in C ++ 11 (without boost or classic unix C)?
source
share