#ifndef BOOST_BIND_PROTECT_HPP_INCLUDED #define BOOST_BIND_PROTECT_HPP_INCLUDED // // protect.hpp // // Copyright 2002, 2020 Peter Dimov // Copyright 2009 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // #include namespace boost { namespace _bi { template struct protect_make_void { typedef void type; }; template struct protect_result_type { }; template struct protect_result_type< F, typename protect_make_void::type > { typedef typename F::result_type result_type; }; template class protected_bind_t: public protect_result_type { private: F f_; public: explicit protected_bind_t( F f ): f_( f ) { } template auto operator()( A&&... a ) -> decltype( f_( std::forward(a)... ) ) { return f_( std::forward(a)... ); } template auto operator()( A&&... a ) const -> decltype( f_( std::forward(a)... ) ) { return f_( std::forward(a)... ); } }; } // namespace _bi template _bi::protected_bind_t protect(F f) { return _bi::protected_bind_t(f); } } // namespace boost #endif // #ifndef BOOST_BIND_PROTECT_HPP_INCLUDED