11 #include <type_traits> 22 void dismiss() noexcept {
34 static const T& asConst(
const T& t) noexcept {
41 template <
typename FunctionType>
45 std::is_nothrow_copy_constructible<FunctionType>::value)
48 makeFailsafe(std::is_nothrow_copy_constructible<FunctionType>{},
52 std::is_nothrow_copy_constructible<FunctionType>::value)
55 makeFailsafe(std::is_nothrow_copy_constructible<FunctionType>{},
59 std::is_nothrow_move_constructible<FunctionType>::value)
61 std::move_if_noexcept(fn),
62 makeFailsafe(std::is_nothrow_move_constructible<FunctionType>{},
66 std::is_nothrow_move_constructible<FunctionType>::value)
67 : function_(std::move_if_noexcept(other.function_)) {
73 dismissed_ = other.dismissed_;
74 other.dismissed_ =
true;
85 return makeEmptyScopeGuard();
88 template <
typename Fn>
89 static auto makeFailsafe(std::false_type, Fn* fn) noexcept
94 template <
typename Fn>
100 void*
operator new(std::size_t) =
delete;
102 void execute() noexcept { function_(); }
104 FunctionType function_;
107 template <
typename F>
152 template <
typename F>
154 noexcept(
detail::ScopeGuardImplDecay<F>(static_cast<F&&>(f)))) {
detail::ScopeGuardImplDecay< F > MakeGuard(F &&f) noexcept(noexcept(detail::ScopeGuardImplDecay< F >(static_cast< F && >(f))))
ScopeGuard is a general implementation of the "Initialization is Resource Acquisition" idiom...
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...