mqtt_cpp
include
mqtt
shared_scope_guard.hpp
Go to the documentation of this file.
1
// Copyright Takatoshi Kondo 2018
2
//
3
// Distributed under the Boost Software License, Version 1.0.
4
// (See accompanying file LICENSE_1_0.txt or copy at
5
// http://www.boost.org/LICENSE_1_0.txt)
6
7
#if !defined(MQTT_SHARED_SCOPE_GUARD_HPP)
8
#define MQTT_SHARED_SCOPE_GUARD_HPP
9
10
#include <memory>
11
#include <utility>
12
#include <
mqtt/namespace.hpp
>
13
14
namespace
MQTT_NS
{
15
16
template
<
typename
Proc>
17
inline
auto
shared_scope_guard
(Proc&& proc) {
18
auto
deleter = [proc = std::forward<Proc>(proc)](
void
*)
mutable
{ std::forward<Proc>(proc)(); };
19
return
std::shared_ptr<void>(
nullptr
, std::move(deleter));
20
}
21
22
}
// namespace MQTT_NS
23
24
#endif
// MQTT_SHARED_SCOPE_GUARD_HPP
MQTT_NS
Definition:
any.hpp:27
MQTT_NS::shared_scope_guard
auto shared_scope_guard(Proc &&proc)
Definition:
shared_scope_guard.hpp:17
namespace.hpp
Generated by
1.9.1