| 678 | } |
| 679 | |
| 680 | class 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 | |
| 692 | public: |
| 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 | { |