mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-03 17:35:51 +00:00
beast, beast::asio improvements and fixes:
* New maybe_const_t alias for maybe_const * New asio::enable_wait_for_async for safe cleanup * New asio::memory_buffer, a managed boost::asio compatible buffer * shared_handler improvements: - Can be 'empty' (no stored handler). - Default constructible as 'empty'. - Safe evaluation in bool contexts, false==empty * Fix is_call_possible metafunction: - Works on empty argument lists - Works with reference types * Replace SafeBool idiom with C++11 explicit operator bool * Move IPAddress function definitions to the header * Move cyclic_iterator to container/ * Remove unused BufferType * Remove obsolete classes: - NamedPipe - ReadWriteLock - ScopedReadLock - ScopedWriteLock - LockGuard
This commit is contained in:
@@ -30,19 +30,20 @@ template <typename ScopedType, typename Context, typename Handler>
|
||||
class ScopedWrapper
|
||||
{
|
||||
public:
|
||||
ScopedWrapper (Context const& context, Handler const& handler)
|
||||
ScopedWrapper (Context& context, Handler const& handler)
|
||||
: m_context (context)
|
||||
, m_handler (handler)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
void operator() ()
|
||||
{
|
||||
ScopedType const scope (m_context);
|
||||
ScopedType scope (m_context);
|
||||
m_handler();
|
||||
}
|
||||
|
||||
private:
|
||||
Context const& m_context;
|
||||
Context& m_context;
|
||||
Handler m_handler;
|
||||
};
|
||||
|
||||
@@ -55,17 +56,19 @@ template <typename Context, typename ScopedType>
|
||||
class ScopedWrapperContext
|
||||
{
|
||||
public:
|
||||
typedef Context context_type;
|
||||
typedef ScopedType scoped_type;
|
||||
typedef Context context_type;
|
||||
typedef ScopedType scoped_type;
|
||||
|
||||
class Scope
|
||||
{
|
||||
public:
|
||||
explicit Scope (ScopedWrapperContext const& owner)
|
||||
: m_scope (owner.m_context)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
scoped_type m_scope;
|
||||
scoped_type mutable m_scope;
|
||||
};
|
||||
|
||||
ScopedWrapperContext ()
|
||||
@@ -74,7 +77,8 @@ public:
|
||||
template <typename Arg>
|
||||
explicit ScopedWrapperContext (Arg& arg)
|
||||
: m_context (arg)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
template <typename Handler>
|
||||
detail::ScopedWrapper <ScopedType, Context, Handler> wrap (
|
||||
@@ -85,7 +89,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
Context m_context;
|
||||
Context mutable m_context;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user