Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 986 Bytes

throw.hpp.adoc

File metadata and controls

47 lines (31 loc) · 986 Bytes
#include <boost/noexcept/throw.hpp>
namespace boost { namespace noexcept_ {

    template <class T>
    struct throw_return {

        static T value() noexcept;

    }

    class throw_ {

        throw_( throw_ const & )=delete;
        throw_ & operator=( throw_ const & )=delete;

        public:

        template <class E>
        throw_( E && e ) noexcept;

        template <class E>
        throw_( E && e, char const * file, int line, char const * function ) noexcept;

        throw_() noexcept { }

        template <class T>
        operator T() noexcept;

    };

    bool has_current_error() noexcept;

} }

#define THROW_(e)\
    ::boost::noexcept::throw_(e,__FILE__,__LINE__,BOOST_CURRENT_FUNCTION)

#define BOOST_NOEXCEPT_CHECK\
    { if( ::boost::noexcept_::has_current_error() )\
        return ::boost::noexcept_::throw_(); }

#define BOOST_NOEXCEPT_CHECK_VOID\
    { if( ::boost::noexcept_::has_current_error() )\
        return; }