📄 _defs.h
字号:
#endif // _RWSTD_DEFINE_EXTERNS
// allows static const integral or enum class members to be initialized
// inside the class and defined (w/o being initialized) outside
// of the class (as required by 9.4.2, p4)
#if !defined(_RWSTD_NO_STATIC_CONST_MEMBER_INIT)
# define _RWSTD_STATIC_CONST(type, init) static const type init
# define _RWSTD_DEFINE_STATIC_CONST(decl) decl
#else
# define _RWSTD_STATIC_CONST(ignore, init) enum { init }
# define _RWSTD_DEFINE_STATIC_CONST(ignore)
#endif // _RWSTD_NO_STATIC_CONST_MEMBER_INIT
// Selection of vendor dependent "format" string argument to wcsftime()
#ifndef _RWSTD_NO_WCSFTIME
// 7.24.5.1 of C99 - wcsftime()'s 3rd arg is const wchar* [restrict]
// HP-UX 11 (and perhaps others) still uses const char*
# ifndef _RWSTD_NO_WCSFTIME_WCHAR_T_FMAT
# define _RWSTD_FMT_TYPE(arg) const wchar_t* arg
# define _RWSTD_FMT_ASSGN(str) L##str
# else
# define _RWSTD_FMT_TYPE(arg) const char* arg
# define _RWSTD_FMT_ASSGN(str) str
# endif
#else // if defined (_RWSTD_NO_WCSFTIME)
# define _RWSTD_FMT_TYPE(arg) const char* arg
# define _RWSTD_FMT_ASSGN(str) str
#endif // _RWSTD_NO_WCSFTIME
// _Iterator typedefs
// (note that you must use a semi-colon at the end of this macro)
#define _RWSTD_ITERATOR_TYPES(_Iterator) \
typedef _TYPENAME _Iterator::difference_type difference_type; \
typedef _TYPENAME _Iterator::value_type value_type; \
typedef _TYPENAME _Iterator::pointer pointer; \
typedef _TYPENAME _Iterator::reference reference; \
typedef _TYPENAME _Iterator::iterator_category iterator_category
// helpers making working w/o iterator_traits transparent
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
# define _RWSTD_VALUE_TYPE(iterT) \
(_TYPENAME _STD::iterator_traits< iterT >::value_type*)0
# define _RWSTD_DIFFERENCE_TYPE(iterT) \
(_TYPENAME _STD::iterator_traits< iterT >::difference_type*)0
# define _RWSTD_ITERATOR_CATEGORY(iterT, ignore) \
_TYPENAME_CTOR _STD::iterator_traits< iterT >::iterator_category ()
#else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
# define _RWSTD_VALUE_TYPE(iterT) __value_type ((iterT*)0)
// assume default ctor is defined and accessible
# define _RWSTD_DIFFERENCE_TYPE(iterT) \
_STD::__distance_type (iterT ())
// macro cannot use the default ctor to construct a temporary
// with the type of the first argument since the default ctor
// may not exist or be accessible (e.g., istream_iterator<>)
# define _RWSTD_ITERATOR_CATEGORY(ignore, iter) \
_STD::__iterator_category (iter)
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
// Use -D_RWSTDDEBUG to compile a version of the libraries to debug
// the user's code. This will perform pre- and post-condition checks
// upon entering routines, but will be larger and run more slowly.
// This option affects the binary compatibility of generated code.
#if defined(RWDEBUG) && !defined(_RWSTDDEBUG)
# define _RWSTDDEBUG 1
#endif
#if defined(_RWSTDDEBUG) && _RWSTDDEBUG
# define _RWSTD_ASSERT(expr) \
((expr) ? (void)0 : _RW::__rw_assert_fail (#expr, __MODULE__, __LINE__, \
__PRETTY_FUNCTION__))
#else // if !defined (_RWSTDDEBUG)
# define _RWSTD_ASSERT(ignore) ((void)0)
#endif // _RWSTDDEBUG
// compile-time assertion - asserts constant expressions during
// compilation with no runtime overhead; failed assertions are reported
// as compilation errors
_RWSTD_NAMESPACE_BEGIN (__rw)
template <bool __b>
struct __rw_compile_assert;
_RWSTD_SPECIALIZED_CLASS
struct __rw_compile_assert<true> { enum { _C_ok }; };
#define _RWSTD_COMPILE_ASSERT(const_expr) \
((void)_RW::__rw_compile_assert<(const_expr)>::_C_ok)
// called for failed assertions
void _RWSTD_EXPORT
__rw_assert_fail (const char *__expr,
const char *__file, int __line, const char *__func);
_RWSTD_NAMESPACE_END // __rw
# define _RWSTD_STR(x) #x
# define _RWSTD_STRSTR(x) _RWSTD_STR(x)
#if defined(_RWSTDDEBUG) && _RWSTDDEBUG
# define _RWSTD_FUNC(ignore) _RWSTD_FILE_LINE, __PRETTY_FUNCTION__
# define _RWSTD_FILE_LINE __MODULE__ ":" _RWSTD_STRSTR (__LINE__)
#else
# define _RWSTD_FUNC(ignore) _RWSTD_FILE_LINE, ""
# define _RWSTD_FILE_LINE ""
#endif
/* at least some of the _RWSTD_REQUIRES are needed for conformance */
# define _RWSTD_REQUIRES(pred, args) (pred) ? (void)0 : _RW::__rw_throw args
// function exception specification
#if !defined (_RWSTD_NO_EXCEPTIONS) \
&& !defined (_RWSTD_NO_EXCEPTION_SPECIFICATION)
// type_id_list is a possibly empty parenthesized list
//of comma-separated type-id's
# define _THROWS(type_id_list) throw type_id_list
#else // if _RWSTD_NO_EXCEPTIONS || _RWSTD_NO_EXCEPTION_SPECIFICATION
# define _THROWS(ignore)
#endif // !_RWSTD_NO_EXCEPTIONS && !_RWSTD_NO_EXCEPTION_SPECIFICATION
// for convenience
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
# define _DISTANCE(first, last, ignore) _STD_RW::distance (first, last)
#else
# define _DISTANCE(first, last, type) _RW::__rw_distance (first, last, type())
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
_RWSTD_NAMESPACE_BEGIN (__rw)
// pointers to the incomplete types declared below are used
// to disambiguate calls to template member functions
// bodies provided only to work around an HP aCC 3.14.10 bug
template <bool __b>
struct __rw_select { };
_RWSTD_SPECIALIZED_CLASS
struct __rw_select<true> { };
#define _RWSTD_DISPATCH_INT(yes) const _RW::__rw_select < yes >*
#define _RWSTD_DISPATCH(iter) \
((_RW::__rw_select<numeric_limits< iter >::is_integer>*)0)
_RWSTD_NAMESPACE_END // __rw
#if defined (__IBMCPP__) && __IBMCPP <= 500
// working around an xlC 5.0 bug
_USING (__rw::__rw_select);
#endif
// select appropriate C multibyte conversion function based on
// whether "restartable" functions are available.
#ifndef _RWSTD_NO_MBRTOWC
// reentrant versions return size_t - see 7.24.6.3.2 of C99
# define _RWSTD_MBTOWC(to, from, size, state) mbrtowc (to, from, size, state)
#elif !defined (_RWSTD_NO_MBTOWC)
// non-reentrant versions return int - see 7.20.7.2 of C99
# define _RWSTD_MBTOWC(to, from, size, ignore_state) \
_RWSTD_C::size_t (mbtowc(to, from, size))
#else
// mbtowc not supported
# define _RWSTD_MBTOWC(ign1, ign2, ign3, ign4) _RWSTD_C::size_t (-1)
#endif // _RWSTD_NO_MBRTOWC
#ifndef _RWSTD_NO_WCRTOMB
# define _RWSTD_WCTOMB(to, from, state) wcrtomb (to, from, state)
#else // if defined (_RWSTD_NO_WCRTOMB)
# define _RWSTD_WCTOMB(to, from, ignore_state) \
_RWSTD_C::size_t (wctomb (to, from))
#endif // _RWSTD_NO_WCRTOMB
// unsafe when underlying libc doesn't support mbsinit
// as described in 7.24.6.3.1 of C99
#ifndef _RWSTD_NO_MBSINIT
# if defined(SNI) && defined(_RWSTD_STRICT_ANSI)
# define _MBSINIT(ps) __SNI::mbsinit (ps)
# else
# define _MBSINIT(ps) mbsinit (ps)
# endif
#else // if defined (_RWSTD_NO_MBSINIT)
# define _MBSINIT(ps) (0 == (ps))
#endif // _RWSTD_NO_MBSINIT
// enable only in debug mode and only id partial class specialization
// is supported; prevent multiple definition of _RWSTD_NO_DEBUG_ITER
#if defined(_RWSTDDEBUG) && !defined (_RWSTD_NO_CLASS_PARTIAL_SPEC) \
&& !defined (_RWSTD_NO_DEBUG_ITER) && !defined (SNI)
# define _RWSTD_ASSERT_RANGE(first, last) \
_RWSTD_ASSERT (_RW::__rw_valid_range (first, last))
# define _RWSTD_ASSERT_IN_RANGE(it, first, last) \
_RWSTD_ASSERT (_RW::__rw_in_range (it, first, last))
# define _RWSTD_ASSERT_DEREF(it) \
_RWSTD_ASSERT (_RW::__rw_dereferenceable (it))
#else
# ifndef _RWSTD_NO_DEBUG_ITER
# define _RWSTD_NO_DEBUG_ITER
# endif // _RWSTD_NO_DEBUG_ITER
# define _RWSTD_ASSERT_RANGE(ign1, ign2) ((void)0)
# define _RWSTD_ASSERT_IN_RANGE(ign1, ign2, ign3) ((void)0)
# define _RWSTD_ASSERT_DEREF(ignore) ((void)0)
#endif // _RWSTDDEBUG && !_RWSTD_NO_CLASS_PARTIAL_SPEC
// convenience macro to get the "real" iterator embedded in __rw_debug_iter<>
#ifndef _RWSTD_NO_DEBUG_ITER
# define _ITER_BASE(it) ((it).base ())
#else // if defined (_RWSTD_NO_DEBUG_ITER)
# define _ITER_BASE(it) (it)
#endif // _RWSTD_NO_DEBUG_ITER
// will use the deduced native type rather than the typedef to prevent
// conflicts caused by inconsistent definition of wint_t (gcc 2.95.2/AIX)
#ifndef _RWSTD_WINT_T
// hardcode if wint_t is not available in <wchar.h>
// used by std::traits and std::basic_[i|o]stream
# define _RWSTD_WINT_T int
#endif // _RWSTD_WINT_T
// used by std::traits and std::basic_[i|o]stream,
// required to be int by 21.1.3.1, p2
#define _RWSTD_INT_T int
// ssize_t is defined by POSIX.1
#ifndef _RWSTD_SSIZE_T
# ifdef _WIN64
# define _RWSTD_SSIZE_T SSIZE_T
# else
# define _RWSTD_SSIZE_T long
# endif
#endif
#if defined(SNI)
# define _RWSTD_USING_SNI(name) _USING(__SNI::name)
# if defined(_RWSTD_STRICT_ANSI)
# define fileno(p) (int) ((p)->_file)
# endif
#else
# define _RWSTD_USING_SNI(ignore) typedef void __rw_unused_typedef
#endif
#ifndef _RWSTD_TMPBUF_SIZE
# define _RWSTD_TMPBUF_SIZE 4096
#endif
#ifndef _RWSTD_NO_STRTOLL
# define _STRTOLL strtoll
#else
// libc has no strtoll, use strtol instead
# define _STRTOLL (_RWSTD_LONG_LONG)strtol
#endif // _RWSTD_NO_STRTOLL
#ifndef _RWSTD_NO_STRTOULL
# define _STRTOULL strtoull
#else
// libc has no strtoull, use strtoul instead
# define _STRTOULL (unsigned _RWSTD_LONG_LONG)strtoul
#endif // _RWSTD_NO_STRTOULL
#if defined (_RWSTD_INSTANTIATE_TEMPLATES) \
&& !defined (_RWSTD_NO_EXPLICIT_INSTANTIATION) \
&& !defined (_RWSTD_NO_INSTANTIATE)
# define _RWSTD_INSTANTIATE_1(arg) template arg
# define _RWSTD_INSTANTIATE_2(a1, a2) template a1, a2
# define _RWSTD_INSTANTIATE_3(a1, a2, a3) template a1, a2, a3
#else
# if defined (_MSC_VER) \
&& !defined (_RWSTD_NO_EXPLICIT_INSTANTIATION) \
&& !defined (_RWSTD_NO_INSTANTIATE)
// disable warning C4231: nonstandard extension used :
// 'extern' before template explicit instantiation
# pragma warning (disable: 4231)
# define _RWSTD_INSTANTIATE_1(arg) extern template arg
# define _RWSTD_INSTANTIATE_2(a1, a2) extern template a1, a2
# define _RWSTD_INSTANTIATE_3(a1, a2, a3) extern template a1, a2, a3
# else
# define _RWSTD_INSTANTIATE_1(ignore) \
typedef void __rw_unused_typedef
# define _RWSTD_INSTANTIATE_2(ign1, ign2) \
typedef void __rw_unused_typedef
# define _RWSTD_INSTANTIATE_3(ign1, ign2, ign3) \
typedef void __rw_unused_typedef
# endif
#endif // _RWSTD_INSTANTIATE_TEMPLATES
#ifndef _RWSTD_NO_UNCAUGHT_EXCEPTION
# define _UNCAUGHT_EXCEPTION() uncaught_exception()
#else // if defined (_RWSTD_NO_UNCAUGHT_EXCEPTION)
# define _UNCAUGHT_EXCEPTION() true
#endif // _RWSTD_NO_UNCAUGHT_EXCEPTION
// allows for efficient compilation without implicit inclusion; only
// specializations explicitly instantiated in the library are available
#if defined _RWSTD_COMPILE_INSTANTIATE \
&& ( !defined (_RWSTD_NO_TEMPLATE_DEFINITIONS) \
|| defined (_RWSTD_NO_EXPLICIT_INSTANTIATION) \
|| defined (_RWSTD_NO_IMPLICIT_INSTANTIATION) \
|| defined (_RWSTD_NO_INSTANTIATE))
# define _RWSTD_DEFINE_TEMPLATE(name) !(_RWSTD_NO_ ## name ## _DEFINITION)
#else
# define _RWSTD_DEFINE_TEMPLATE(ignore) 0
#endif
// introduce namespace std so that "using namespace std;" always works
_RWSTD_NAMESPACE_BEGIN (std)
_RWSTD_NAMESPACE_END // std
#ifndef _RWSTD_NO_NAMESPACE
#ifdef __EDG_IMPLICIT_USING_STD
/* Implicitly include a using directive for the STD namespace when this */
/* preprocessing flag is TRUE. */
using namespace ::std;
#endif /* ifdef __EDG_IMPLICIT_USING_STD */
#endif /* _RWSTD_NO_NAMESPACE */
#endif // _RWSTD_DEFS_H_INCLUDED
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -