📄 xmemory
字号:
// xmemory internal header (from <memory>)#if _MSC_VER > 1000#pragma once#endif/* This file is for use only in conjunction with a valid license forMicrosoft Visual C++ V5.0. Microsoft Corporation is in no way involvedwith the production or release of this file. The file is offered on an``as is'' basis.DINKUMWARE, LTD. AND P.J. PLAUGER MAKE NO REPRESENTATIONS OR WARRANTIESABOUT THE SUITABILITY OF THIS FILE, EITHER EXPRESS OR IMPLIED,INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. DINKUMWARE, LTD.AND P.J. PLAUGER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BYLICENSEE AS A RESULT OF USING THIS FILE.For additional information, contact Dinkumware, Ltd. (+1-888-4DINKUM orsupport@dinkumware.com). */#ifndef _XMEMORY_#define _XMEMORY_#include <cstdlib>#include <new>#ifdef _MSC_VER#pragma pack(push,8)#endif /* _MSC_VER */ #include <utility>#ifndef _FARQ /* specify standard memory model */ #define _FARQ #define _PDFT ptrdiff_t #define _SIZT size_t#endif #define _POINTER_X(T, A) T _FARQ * #define _REFERENCE_X(T, A) T _FARQ &_STD_BEGIN // TEMPLATE FUNCTION _Allocatetemplate<class _Ty> inline _Ty _FARQ *_Allocate(_PDFT _N, _Ty _FARQ *) {if (_N < 0) _N = 0; return ((_Ty _FARQ *)operator new( (_SIZT)_N * sizeof (_Ty))); } // TEMPLATE FUNCTION _Constructtemplate<class _T1, class _T2> inline void _Construct(_T1 _FARQ *_P, const _T2& _V) {new ((void _FARQ *)_P) _T1(_V); } // TEMPLATE FUNCTION _Destroytemplate<class _Xyzzy> inline void _Destroy(_Xyzzy _FARQ *_P) {_DESTRUCTOR(_Xyzzy, _P); }inline void _Destroy(char _FARQ *_P) {}inline void _Destroy(wchar_t _FARQ *_P) {} // TEMPLATE CLASS allocatortemplate<class _Ty> class allocator {public: typedef _SIZT size_type; typedef _PDFT difference_type; typedef _Ty _FARQ *pointer; typedef const _Ty _FARQ *const_pointer; typedef _Ty _FARQ& reference; typedef const _Ty _FARQ& const_reference; typedef _Ty value_type; pointer address(reference _X) const {return (&_X); } const_pointer address(const_reference _X) const {return (&_X); } pointer allocate(size_type _N, const void *) {return (_Allocate((difference_type)_N, (pointer)0)); } char _FARQ *_Charalloc(size_type _N) {return (_Allocate((difference_type)_N, (char _FARQ *)0)); } void deallocate(void _FARQ *_P, size_type) {operator delete(_P); } void construct(pointer _P, const _Ty& _V) {_Construct(_P, _V); } void destroy(pointer _P) {_Destroy(_P); } _SIZT max_size() const {_SIZT _N = (_SIZT)(-1) / sizeof (_Ty); return (0 < _N ? _N : 1); } };template<class _Ty, class _U> inline bool operator==(const allocator<_Ty>&, const allocator<_U>&) {return (true); }template<class _Ty, class _U> inline bool operator!=(const allocator<_Ty>&, const allocator<_U>&) {return (false); } // CLASS allocator<void>template<> class _CRTIMP allocator<void> {public: typedef void _Ty; typedef _Ty _FARQ *pointer; typedef const _Ty _FARQ *const_pointer; typedef _Ty value_type; };_STD_END#ifdef _MSC_VER#pragma pack(pop)#endif /* _MSC_VER */#endif /* _XMEMORY_ *//* * Copyright (c) 1995 by P.J. Plauger. ALL RIGHTS RESERVED. * Consult your license regarding permissions and restrictions. *//* * This file is derived from software bearing the following * restrictions: * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this * software and its documentation for any purpose is hereby * granted without fee, provided that the above copyright notice * appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation. * Hewlett-Packard Company makes no representations about the * suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -