MCPcopy Create free account
hub / github.com/boostorg/leaf / error_id

Class error_id

include/boost/leaf/error.hpp:680–792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

678}
679
680class error_id
681{
682 friend error_id BOOST_LEAF_CONSTEXPR detail::make_error_id(int) noexcept;
683
684 int value_;
685
686 BOOST_LEAF_CONSTEXPR explicit error_id( int value ) noexcept:
687 value_(value)
688 {
689 BOOST_LEAF_ASSERT(value_ == 0 || ((value_&3) == 1));
690 }
691
692public:
693
694 BOOST_LEAF_CONSTEXPR error_id() noexcept:
695 value_(0)
696 {
697 }
698
699#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
700 explicit error_id( std::error_code const & ec ) noexcept(!BOOST_LEAF_CFG_CAPTURE):
701 value_(detail::import_error_code(std::error_code(ec)))
702 {
703 BOOST_LEAF_ASSERT(!value_ || ((value_&3) == 1));
704 }
705
706 template <class Enum>
707 error_id( Enum e, typename std::enable_if<std::is_error_code_enum<Enum>::value, int>::type = 0 ) noexcept(!BOOST_LEAF_CFG_CAPTURE):
708 value_(detail::import_error_code(e))
709 {
710 }
711
712 template <class T, typename std::enable_if<std::is_constructible<T, std::error_code>::value, int>::type = 0>
713 operator T() const noexcept
714 {
715 return std::error_code(value_, detail::get_leaf_error_category<>::cat);
716 }
717#endif // #if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
718
719 BOOST_LEAF_CONSTEXPR error_id load() const noexcept
720 {
721 return *this;
722 }
723
724 template <class Item>
725 BOOST_LEAF_CONSTEXPR error_id load(Item && item) const
726 {
727 if (int err_id = value())
728 {
729 int const unused[] = { 42, detail::load_item<Item>::load_(err_id, std::forward<Item>(item)) };
730 (void)unused;
731 }
732 return *this;
733 }
734
735 template <class... Item>
736 BOOST_LEAF_CONSTEXPR error_id load( Item && ... item ) const
737 {

Callers 10

try_handle_someFunction · 0.70
type try_handle_someMethod · 0.70
try_capture_all_Method · 0.70
make_error_idFunction · 0.70
error_resultClass · 0.70
resultFunction · 0.70
loadFunction · 0.70
gFunction · 0.50
gFunction · 0.50
mainFunction · 0.50

Calls 1

error_codeEnum · 0.50

Tested by 3

gFunction · 0.40
gFunction · 0.40
mainFunction · 0.40