1 #ifndef BOOST_SYSTEM_ERROR_CODE_HPP_INCLUDED
2 #define BOOST_SYSTEM_ERROR_CODE_HPP_INCLUDED
4 // Copyright Beman Dawes 2006, 2007
5 // Copyright Christoper Kohlhoff 2007
6 // Copyright Peter Dimov 2017, 2018
8 // Distributed under the Boost Software License, Version 1.0. (See accompanying
9 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 // See library home page at http://www.boost.org/libs/system
13 #include <boost/system/api_config.hpp>
14 #include <boost/system/detail/config.hpp>
15 #include <boost/cstdint.hpp>
16 #include <boost/config.hpp>
22 // TODO: undef these macros if not already defined
23 #include <boost/cerrno.hpp>
25 #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
26 # include <system_error>
29 #if !defined(BOOST_POSIX_API) && !defined(BOOST_WINDOWS_API)
30 # error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined
39 class error_code; // values defined by the operating system
40 class error_condition; // portable generic values defined below, but ultimately
41 // based on the POSIX standard
45 template<class T> struct is_error_code_enum
47 static const bool value = false;
50 template<class T> struct is_error_condition_enum
52 static const bool value = false;
55 // Generic error_conditions
63 address_family_not_supported = EAFNOSUPPORT,
64 address_in_use = EADDRINUSE,
65 address_not_available = EADDRNOTAVAIL,
66 already_connected = EISCONN,
67 argument_list_too_long = E2BIG,
68 argument_out_of_domain = EDOM,
70 bad_file_descriptor = EBADF,
71 bad_message = EBADMSG,
73 connection_aborted = ECONNABORTED,
74 connection_already_in_progress = EALREADY,
75 connection_refused = ECONNREFUSED,
76 connection_reset = ECONNRESET,
77 cross_device_link = EXDEV,
78 destination_address_required = EDESTADDRREQ,
79 device_or_resource_busy = EBUSY,
80 directory_not_empty = ENOTEMPTY,
81 executable_format_error = ENOEXEC,
83 file_too_large = EFBIG,
84 filename_too_long = ENAMETOOLONG,
85 function_not_supported = ENOSYS,
86 host_unreachable = EHOSTUNREACH,
87 identifier_removed = EIDRM,
88 illegal_byte_sequence = EILSEQ,
89 inappropriate_io_control_operation = ENOTTY,
91 invalid_argument = EINVAL,
92 invalid_seek = ESPIPE,
94 is_a_directory = EISDIR,
95 message_size = EMSGSIZE,
96 network_down = ENETDOWN,
97 network_reset = ENETRESET,
98 network_unreachable = ENETUNREACH,
99 no_buffer_space = ENOBUFS,
100 no_child_process = ECHILD,
102 no_lock_available = ENOLCK,
103 no_message_available = ENODATA,
105 no_protocol_option = ENOPROTOOPT,
106 no_space_on_device = ENOSPC,
107 no_stream_resources = ENOSR,
108 no_such_device_or_address = ENXIO,
109 no_such_device = ENODEV,
110 no_such_file_or_directory = ENOENT,
111 no_such_process = ESRCH,
112 not_a_directory = ENOTDIR,
113 not_a_socket = ENOTSOCK,
114 not_a_stream = ENOSTR,
115 not_connected = ENOTCONN,
116 not_enough_memory = ENOMEM,
117 not_supported = ENOTSUP,
118 operation_canceled = ECANCELED,
119 operation_in_progress = EINPROGRESS,
120 operation_not_permitted = EPERM,
121 operation_not_supported = EOPNOTSUPP,
122 operation_would_block = EWOULDBLOCK,
123 owner_dead = EOWNERDEAD,
124 permission_denied = EACCES,
125 protocol_error = EPROTO,
126 protocol_not_supported = EPROTONOSUPPORT,
127 read_only_file_system = EROFS,
128 resource_deadlock_would_occur = EDEADLK,
129 resource_unavailable_try_again = EAGAIN,
130 result_out_of_range = ERANGE,
131 state_not_recoverable = ENOTRECOVERABLE,
132 stream_timeout = ETIME,
133 text_file_busy = ETXTBSY,
134 timed_out = ETIMEDOUT,
135 too_many_files_open_in_system = ENFILE,
136 too_many_files_open = EMFILE,
137 too_many_links = EMLINK,
138 too_many_symbolic_link_levels = ELOOP,
139 value_too_large = EOVERFLOW,
140 wrong_protocol_type = EPROTOTYPE
145 #ifdef BOOST_SYSTEM_ENABLE_DEPRECATED
147 namespace posix = errc;
148 namespace posix_error = errc;
152 template<> struct is_error_condition_enum<errc::errc_t>
154 static const bool value = true;
157 // class error_category
158 #if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG )
159 #pragma GCC diagnostic push
160 #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
164 #pragma warning( push )
165 // 'this' : used in base member initializer list
166 #pragma warning( disable: 4355 )
169 std::size_t hash_value( error_code const & ec );
171 class BOOST_SYMBOL_VISIBLE error_category
175 friend std::size_t hash_value( error_code const & ec );
177 #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
180 error_category( error_category const & ) = delete;
181 error_category& operator=( error_category const & ) = delete;
186 error_category( error_category const & );
187 error_category& operator=( error_category const & );
193 boost::ulong_long_type id_;
197 #if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS)
199 ~error_category() = default;
203 // We'd like to make the destructor protected, to make code that deletes
204 // an error_category* not compile; unfortunately, doing the below makes
205 // the destructor user-provided and hence breaks use after main, as the
206 // categories may get destroyed before code that uses them
208 // ~error_category() {}
212 BOOST_SYSTEM_CONSTEXPR error_category() BOOST_NOEXCEPT: id_( 0 )
216 explicit BOOST_SYSTEM_CONSTEXPR error_category( boost::ulong_long_type id ) BOOST_NOEXCEPT: id_( id )
222 virtual const char * name() const BOOST_NOEXCEPT = 0;
224 virtual error_condition default_error_condition( int ev ) const BOOST_NOEXCEPT;
225 virtual bool equivalent( int code, const error_condition & condition ) const BOOST_NOEXCEPT;
226 virtual bool equivalent( const error_code & code, int condition ) const BOOST_NOEXCEPT;
228 virtual std::string message( int ev ) const = 0;
229 virtual char const * message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT;
231 virtual bool failed( int ev ) const BOOST_NOEXCEPT;
233 BOOST_SYSTEM_CONSTEXPR bool operator==( const error_category & rhs ) const BOOST_NOEXCEPT
235 return rhs.id_ == 0? this == &rhs: id_ == rhs.id_;
238 BOOST_SYSTEM_CONSTEXPR bool operator!=( const error_category & rhs ) const BOOST_NOEXCEPT
240 return !( *this == rhs );
243 BOOST_SYSTEM_CONSTEXPR bool operator<( const error_category & rhs ) const BOOST_NOEXCEPT
257 return false; // equal
260 return std::less<error_category const *>()( this, &rhs );
263 #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
265 operator std::error_category const & () const;
271 #pragma warning( pop )
274 // predefined error categories
279 class BOOST_SYMBOL_VISIBLE generic_error_category: public error_category
283 // clang++ 3.8 and below: initialization of const object
284 // requires a user-provided default constructor
285 BOOST_SYSTEM_CONSTEXPR generic_error_category() BOOST_NOEXCEPT:
286 error_category( ( boost::ulong_long_type( 0xB2AB117A ) << 32 ) + 0x257EDF0D )
290 const char * name() const BOOST_NOEXCEPT
295 std::string message( int ev ) const;
296 char const * message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT;
299 class BOOST_SYMBOL_VISIBLE system_error_category: public error_category
303 BOOST_SYSTEM_CONSTEXPR system_error_category() BOOST_NOEXCEPT:
304 error_category( ( boost::ulong_long_type( 0x8FAFD21E ) << 32 ) + 0x25C5E09B )
308 const char * name() const BOOST_NOEXCEPT
313 error_condition default_error_condition( int ev ) const BOOST_NOEXCEPT;
315 std::string message( int ev ) const;
316 char const * message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT;
319 } // namespace detail
321 #if ( defined( BOOST_GCC ) && BOOST_GCC >= 40600 ) || defined( BOOST_CLANG )
322 #pragma GCC diagnostic pop
325 // generic_category(), system_category()
327 #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
332 template<class T> struct BOOST_SYMBOL_VISIBLE cat_holder
334 static constexpr system_error_category system_category_instance{};
335 static constexpr generic_error_category generic_category_instance{};
338 // Before C++17 it was mandatory to redeclare all static constexpr
339 #if defined(BOOST_NO_CXX17_INLINE_VARIABLES)
340 template<class T> constexpr system_error_category cat_holder<T>::system_category_instance;
341 template<class T> constexpr generic_error_category cat_holder<T>::generic_category_instance;
344 } // namespace detail
346 constexpr error_category const & system_category() BOOST_NOEXCEPT
348 return detail::cat_holder<void>::system_category_instance;
351 constexpr error_category const & generic_category() BOOST_NOEXCEPT
353 return detail::cat_holder<void>::generic_category_instance;
356 #else // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
358 #if !defined(__SUNPRO_CC) // trailing __global is not supported
359 inline error_category const & system_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE;
360 inline error_category const & generic_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE;
363 inline error_category const & system_category() BOOST_NOEXCEPT
365 static const detail::system_error_category system_category_instance;
366 return system_category_instance;
369 inline error_category const & generic_category() BOOST_NOEXCEPT
371 static const detail::generic_error_category generic_category_instance;
372 return generic_category_instance;
375 #endif // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
377 // deprecated synonyms
379 #ifdef BOOST_SYSTEM_ENABLE_DEPRECATED
381 inline const error_category & get_system_category() { return system_category(); }
382 inline const error_category & get_generic_category() { return generic_category(); }
383 inline const error_category & get_posix_category() { return generic_category(); }
384 static const error_category & posix_category BOOST_ATTRIBUTE_UNUSED = generic_category();
385 static const error_category & errno_ecat BOOST_ATTRIBUTE_UNUSED = generic_category();
386 static const error_category & native_ecat BOOST_ATTRIBUTE_UNUSED = system_category();
395 template<bool C, class T = void> struct enable_if
400 template<class T> struct enable_if<false, T>
406 #if !defined(BOOST_SYSTEM_HAS_CONSTEXPR)
408 inline bool failed_impl( int ev, error_category const & cat )
410 return cat.failed( ev );
415 BOOST_SYSTEM_CONSTEXPR inline bool failed_impl( int ev, error_category const & cat )
417 if( cat == system_category() || cat == generic_category() )
423 return cat.failed( ev );
429 } // namespace detail
431 // class error_condition
433 // error_conditions are portable, error_codes are system or library specific
435 class error_condition
441 error_category const * cat_;
447 BOOST_SYSTEM_CONSTEXPR error_condition() BOOST_NOEXCEPT:
448 val_( 0 ), failed_( false ), cat_( &generic_category() )
452 BOOST_SYSTEM_CONSTEXPR error_condition( int val, const error_category & cat ) BOOST_NOEXCEPT:
453 val_( val ), failed_( detail::failed_impl( val, cat ) ), cat_( &cat )
457 template<class ErrorConditionEnum> BOOST_SYSTEM_CONSTEXPR error_condition( ErrorConditionEnum e,
458 typename detail::enable_if<is_error_condition_enum<ErrorConditionEnum>::value>::type* = 0) BOOST_NOEXCEPT
460 *this = make_error_condition( e );
465 BOOST_SYSTEM_CONSTEXPR void assign( int val, const error_category & cat ) BOOST_NOEXCEPT
468 failed_ = detail::failed_impl( val, cat );
472 template<typename ErrorConditionEnum>
473 BOOST_SYSTEM_CONSTEXPR typename detail::enable_if<is_error_condition_enum<ErrorConditionEnum>::value, error_condition>::type &
474 operator=( ErrorConditionEnum val ) BOOST_NOEXCEPT
476 *this = make_error_condition( val );
480 BOOST_SYSTEM_CONSTEXPR void clear() BOOST_NOEXCEPT
484 cat_ = &generic_category();
489 BOOST_SYSTEM_CONSTEXPR int value() const BOOST_NOEXCEPT
494 BOOST_SYSTEM_CONSTEXPR const error_category & category() const BOOST_NOEXCEPT
499 std::string message() const
501 return cat_->message( value() );
504 char const * message( char * buffer, std::size_t len ) const BOOST_NOEXCEPT
506 return cat_->message( value(), buffer, len );
509 BOOST_SYSTEM_CONSTEXPR bool failed() const BOOST_NOEXCEPT
514 #if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
516 BOOST_SYSTEM_CONSTEXPR explicit operator bool() const BOOST_NOEXCEPT // true if error
523 typedef void (*unspecified_bool_type)();
524 static void unspecified_bool_true() {}
526 BOOST_SYSTEM_CONSTEXPR operator unspecified_bool_type() const BOOST_NOEXCEPT // true if error
528 return val_ != 0? unspecified_bool_true: 0;
531 BOOST_SYSTEM_CONSTEXPR bool operator!() const BOOST_NOEXCEPT // true if no error
539 // the more symmetrical non-member syntax allows enum
540 // conversions work for both rhs and lhs.
542 BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( const error_condition & lhs, const error_condition & rhs ) BOOST_NOEXCEPT
544 return lhs.val_ == rhs.val_ && *lhs.cat_ == *rhs.cat_;
547 BOOST_SYSTEM_CONSTEXPR inline friend bool operator<( const error_condition & lhs, const error_condition & rhs ) BOOST_NOEXCEPT
549 return *lhs.cat_ < *rhs.cat_ || ( *lhs.cat_ == *rhs.cat_ && lhs.val_ < rhs.val_ );
552 #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
554 operator std::error_condition () const
556 return std::error_condition( value(), category() );
564 // We want error_code to be a value type that can be copied without slicing
565 // and without requiring heap allocation, but we also want it to have
566 // polymorphic behavior based on the error category. This is achieved by
567 // abstract base class error_category supplying the polymorphic behavior,
568 // and error_code containing a pointer to an object of a type derived
569 // from error_category.
577 const error_category * cat_;
583 BOOST_SYSTEM_CONSTEXPR error_code() BOOST_NOEXCEPT:
584 val_( 0 ), failed_( false ), cat_( &system_category() )
588 BOOST_SYSTEM_CONSTEXPR error_code( int val, const error_category & cat ) BOOST_NOEXCEPT:
589 val_( val ), failed_( detail::failed_impl( val, cat ) ), cat_( &cat )
593 template<class ErrorCodeEnum> BOOST_SYSTEM_CONSTEXPR error_code( ErrorCodeEnum e,
594 typename detail::enable_if<is_error_code_enum<ErrorCodeEnum>::value>::type* = 0 ) BOOST_NOEXCEPT
596 *this = make_error_code( e );
601 BOOST_SYSTEM_CONSTEXPR void assign( int val, const error_category & cat ) BOOST_NOEXCEPT
604 failed_ = detail::failed_impl( val, cat );
608 template<typename ErrorCodeEnum>
609 BOOST_SYSTEM_CONSTEXPR typename detail::enable_if<is_error_code_enum<ErrorCodeEnum>::value, error_code>::type &
610 operator=( ErrorCodeEnum val ) BOOST_NOEXCEPT
612 *this = make_error_code( val );
616 BOOST_SYSTEM_CONSTEXPR void clear() BOOST_NOEXCEPT
620 cat_ = &system_category();
625 BOOST_SYSTEM_CONSTEXPR int value() const BOOST_NOEXCEPT
630 BOOST_SYSTEM_CONSTEXPR const error_category & category() const BOOST_NOEXCEPT
635 error_condition default_error_condition() const BOOST_NOEXCEPT
637 return cat_->default_error_condition( value() );
640 std::string message() const
642 return cat_->message( value() );
645 char const * message( char * buffer, std::size_t len ) const BOOST_NOEXCEPT
647 return cat_->message( value(), buffer, len );
650 BOOST_SYSTEM_CONSTEXPR bool failed() const BOOST_NOEXCEPT
655 #if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
657 BOOST_SYSTEM_CONSTEXPR explicit operator bool() const BOOST_NOEXCEPT // true if error
664 typedef void (*unspecified_bool_type)();
665 static void unspecified_bool_true() {}
667 BOOST_SYSTEM_CONSTEXPR operator unspecified_bool_type() const BOOST_NOEXCEPT // true if error
669 return val_ != 0? unspecified_bool_true: 0;
672 BOOST_SYSTEM_CONSTEXPR bool operator!() const BOOST_NOEXCEPT // true if no error
681 // the more symmetrical non-member syntax allows enum
682 // conversions work for both rhs and lhs.
684 BOOST_SYSTEM_CONSTEXPR inline friend bool operator==( const error_code & lhs, const error_code & rhs ) BOOST_NOEXCEPT
686 return lhs.val_ == rhs.val_ && *lhs.cat_ == *rhs.cat_;
689 BOOST_SYSTEM_CONSTEXPR inline friend bool operator<( const error_code & lhs, const error_code & rhs ) BOOST_NOEXCEPT
691 return *lhs.cat_ < *rhs.cat_ || ( *lhs.cat_ == *rhs.cat_ && lhs.val_ < rhs.val_ );
694 #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
696 operator std::error_code () const
698 return std::error_code( value(), category() );
704 } // namespace system
711 // Misuse of the error_code object is turned into a noisy failure by
712 // poisoning the reference. This particular implementation doesn't
713 // produce warnings or errors from popular compilers, is very efficient
714 // (as determined by inspecting generated code), and does not suffer
715 // from order of initialization problems. In practice, it also seems
716 // cause user function error handling implementation errors to be detected
717 // very early in the development cycle.
719 inline system::error_code* throws()
721 // See github.com/boostorg/system/pull/12 by visigoth for why the return
722 // is poisoned with nonzero rather than (0). A test, test_throws_usage(),
723 // has been added to error_code_test.cpp, and as visigoth mentioned it
724 // fails on clang for release builds with a return of 0 but works fine
726 // Since the undefined behavior sanitizer (-fsanitize=undefined) does not
727 // allow a reference to be formed to the unaligned address of (1), we use
730 return reinterpret_cast<system::error_code*>(8);
733 } // namespace detail
735 inline system::error_code& throws()
737 return *detail::throws();
740 // non-member functions of error_code and error_condition
745 BOOST_SYSTEM_CONSTEXPR inline bool operator!=( const error_code & lhs, const error_code & rhs ) BOOST_NOEXCEPT
747 return !( lhs == rhs );
750 BOOST_SYSTEM_CONSTEXPR inline bool operator!=( const error_condition & lhs, const error_condition & rhs ) BOOST_NOEXCEPT
752 return !( lhs == rhs );
755 inline bool operator==( const error_code & code, const error_condition & condition ) BOOST_NOEXCEPT
757 return code.category().equivalent( code.value(), condition ) || condition.category().equivalent( code, condition.value() );
760 inline bool operator!=( const error_code & lhs, const error_condition & rhs ) BOOST_NOEXCEPT
762 return !( lhs == rhs );
765 inline bool operator==( const error_condition & condition, const error_code & code ) BOOST_NOEXCEPT
767 return code.category().equivalent( code.value(), condition ) || condition.category().equivalent( code, condition.value() );
770 inline bool operator!=( const error_condition & lhs, const error_code & rhs ) BOOST_NOEXCEPT
772 return !( lhs == rhs );
775 template <class charT, class traits>
776 inline std::basic_ostream<charT,traits>&
777 operator<< (std::basic_ostream<charT,traits>& os, error_code ec)
779 os << ec.category().name() << ':' << ec.value();
783 inline std::size_t hash_value( error_code const & ec )
785 error_category const & cat = ec.category();
787 boost::ulong_long_type id_ = cat.id_;
791 id_ = reinterpret_cast<boost::uintptr_t>( &cat );
794 boost::ulong_long_type hv = ( boost::ulong_long_type( 0xCBF29CE4 ) << 32 ) + 0x84222325;
795 boost::ulong_long_type const prime = ( boost::ulong_long_type( 0x00000100 ) << 32 ) + 0x000001B3;
804 hv ^= static_cast<unsigned>( ec.value() );
807 return static_cast<std::size_t>( hv );
810 // make_* functions for errc::errc_t
815 // explicit conversion:
816 BOOST_SYSTEM_CONSTEXPR inline error_code make_error_code( errc_t e ) BOOST_NOEXCEPT
818 return error_code( e, generic_category() );
821 // implicit conversion:
822 BOOST_SYSTEM_CONSTEXPR inline error_condition make_error_condition( errc_t e ) BOOST_NOEXCEPT
824 return error_condition( e, generic_category() );
829 // error_category default implementation
831 inline error_condition error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT
833 return error_condition( ev, *this );
836 inline bool error_category::equivalent( int code, const error_condition & condition ) const BOOST_NOEXCEPT
838 return default_error_condition( code ) == condition;
841 inline bool error_category::equivalent( const error_code & code, int condition ) const BOOST_NOEXCEPT
843 return *this == code.category() && code.value() == condition;
846 inline char const * error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
859 #if !defined(BOOST_NO_EXCEPTIONS)
863 std::string m = this->message( ev );
865 # if defined( BOOST_MSVC )
866 # pragma warning( push )
867 # pragma warning( disable: 4996 )
868 # elif defined(__clang__) && defined(__has_warning)
869 # pragma clang diagnostic push
870 # if __has_warning("-Wdeprecated-declarations")
871 # pragma clang diagnostic ignored "-Wdeprecated-declarations"
875 std::strncpy( buffer, m.c_str(), len - 1 );
878 # if defined( BOOST_MSVC )
879 # pragma warning( pop )
880 # elif defined(__clang__) && defined(__has_warning)
881 # pragma clang diagnostic pop
886 #if !defined(BOOST_NO_EXCEPTIONS)
889 return "Message text unavailable";
894 inline bool error_category::failed( int ev ) const BOOST_NOEXCEPT
899 } // namespace system
903 // generic_error_category implementation
905 #include <boost/system/detail/generic_category.hpp>
907 inline std::string boost::system::detail::generic_error_category::message( int ev ) const
909 return generic_error_category_message( ev );
912 inline char const * boost::system::detail::generic_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
914 return generic_error_category_message( ev, buffer, len );
917 // system_error_category implementation
919 #if defined(BOOST_WINDOWS_API)
921 #include <boost/system/detail/system_category_win32.hpp>
923 inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT
925 return system_category_default_error_condition_win32( ev );
928 inline std::string boost::system::detail::system_error_category::message( int ev ) const
930 return system_category_message_win32( ev );
933 inline char const * boost::system::detail::system_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
935 return system_category_message_win32( ev, buffer, len );
938 #else // #if defined(BOOST_WINDOWS_API)
940 #include <boost/system/detail/system_category_posix.hpp>
942 inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT
944 return system_category_default_error_condition_posix( ev );
947 inline std::string boost::system::detail::system_error_category::message( int ev ) const
949 return generic_error_category_message( ev );
952 inline char const * boost::system::detail::system_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
954 return generic_error_category_message( ev, buffer, len );
957 #endif // #if defined(BOOST_WINDOWS_API)
959 // interoperability with std::error_code, std::error_condition
961 #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
963 #include <boost/system/detail/std_interoperability.hpp>
965 inline boost::system::error_category::operator std::error_category const & () const
967 return boost::system::detail::to_std_category( *this );
970 #endif // #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
972 #endif // BOOST_SYSTEM_ERROR_CODE_HPP_INCLUDED