Add default construction and isNull for Call handlers

This commit is contained in:
Vinnie Falco
2013-08-16 04:29:50 -07:00
parent d22b236d2d
commit 7cf0ce22b1
3 changed files with 27 additions and 0 deletions

View File

@@ -30,6 +30,10 @@ class CompletionCall
public:
typedef void result_type;
CompletionCall () noexcept
{
}
// Construction from Handler with zero arguments
//
template <typename Handler>
@@ -63,6 +67,11 @@ public:
{
}
bool isNull () const noexcept
{
return m_call == nullptr;
}
void operator() ()
{
(*m_call) ();

View File

@@ -39,6 +39,10 @@ class ErrorCall
public:
typedef void result_type;
ErrorCall () noexcept
{
}
template <class Handler>
ErrorCall (BOOST_ASIO_MOVE_ARG(Handler) handler)
: m_call (new CallType <Handler> (BOOST_ASIO_MOVE_CAST(Handler)(handler)))
@@ -50,6 +54,11 @@ public:
{
}
bool isNull () const noexcept
{
return m_call == nullptr;
}
void operator() (boost::system::error_code const& ec)
{
(*m_call) (ec);

View File

@@ -36,6 +36,10 @@ class TransferCall
public:
typedef void result_type;
TransferCall () noexcept
{
}
template <class Handler>
TransferCall (BOOST_ASIO_MOVE_ARG(Handler) handler)
: m_call (new CallType <Handler> (BOOST_ASIO_MOVE_CAST(Handler)(handler)))
@@ -47,6 +51,11 @@ public:
{
}
bool isNull () const noexcept
{
return m_call == nullptr;
}
void operator() (boost::system::error_code const& ec, std::size_t bytes_transferred)
{
(*m_call) (ec, bytes_transferred);