003 File Manager
Current Path:
/usr/include/c++/v1/tr1
usr
/
include
/
c++
/
v1
/
tr1
/
📁
..
📄
__bit_reference
(51.94 KB)
📄
__bsd_locale_defaults.h
(2.06 KB)
📄
__bsd_locale_fallbacks.h
(3.94 KB)
📄
__config
(51.99 KB)
📄
__debug
(7.77 KB)
📄
__errc
(9.13 KB)
📄
__functional_03
(43.5 KB)
📄
__functional_base
(17.4 KB)
📄
__functional_base_03
(6.38 KB)
📄
__hash_table
(101.98 KB)
📄
__libcpp_version
(6 B)
📄
__locale
(48.08 KB)
📄
__mutex_base
(16.04 KB)
📄
__node_handle
(5.93 KB)
📄
__nullptr
(1.69 KB)
📄
__split_buffer
(21.9 KB)
📄
__sso_allocator
(2.49 KB)
📄
__std_stream
(10.32 KB)
📄
__string
(46.11 KB)
📄
__threading_support
(20.64 KB)
📄
__tree
(102.38 KB)
📄
__tuple
(20.19 KB)
📄
__undef_macros
(1.02 KB)
📄
algorithm
(199 KB)
📄
any
(18.58 KB)
📄
array
(20.44 KB)
📄
atomic
(96.81 KB)
📄
barrier
(9.98 KB)
📄
bit
(14.13 KB)
📄
bitset
(33 KB)
📄
cassert
(559 B)
📄
ccomplex
(640 B)
📄
cctype
(1.72 KB)
📄
cerrno
(669 B)
📄
cfenv
(1.56 KB)
📄
cfloat
(1.39 KB)
📄
charconv
(17.95 KB)
📄
chrono
(113.59 KB)
📄
cinttypes
(3.44 KB)
📄
ciso646
(595 B)
📄
climits
(907 B)
📄
clocale
(998 B)
📄
cmath
(16.71 KB)
📄
codecvt
(20.12 KB)
📄
compare
(30.14 KB)
📄
complex
(45.51 KB)
📄
complex.h
(739 B)
📄
concepts
(4.63 KB)
📄
condition_variable
(7.43 KB)
📄
csetjmp
(813 B)
📄
csignal
(964 B)
📄
cstdarg
(903 B)
📄
cstdbool
(721 B)
📄
cstddef
(5.29 KB)
📄
cstdint
(2.73 KB)
📄
cstdio
(4.31 KB)
📄
cstdlib
(4.69 KB)
📄
cstring
(2.49 KB)
📄
ctgmath
(650 B)
📄
ctime
(1.67 KB)
📄
ctype.h
(1.12 KB)
📄
cwchar
(6.14 KB)
📄
cwctype
(1.65 KB)
📄
deque
(106.34 KB)
📄
errno.h
(6.19 KB)
📄
exception
(9.25 KB)
📄
execution
(595 B)
📄
fenv.h
(1.82 KB)
📄
filesystem
(80.17 KB)
📄
float.h
(1.58 KB)
📄
forward_list
(61.11 KB)
📄
fstream
(53.05 KB)
📄
functional
(99.54 KB)
📄
future
(70.91 KB)
📄
initializer_list
(2.78 KB)
📄
inttypes.h
(3.8 KB)
📄
iomanip
(17.85 KB)
📄
ios
(24.99 KB)
📄
iosfwd
(8.27 KB)
📄
iostream
(1.36 KB)
📄
istream
(46.73 KB)
📄
iterator
(70.11 KB)
📄
latch
(2.35 KB)
📄
limits
(39.71 KB)
📄
limits.h
(1.44 KB)
📄
list
(78.48 KB)
📄
locale
(150.64 KB)
📄
locale.h
(776 B)
📄
map
(82.59 KB)
📄
math.h
(48.03 KB)
📄
memory
(160.89 KB)
📄
mutex
(17.25 KB)
📄
new
(13.79 KB)
📄
numbers
(6.74 KB)
📄
numeric
(20.08 KB)
📄
optional
(41.59 KB)
📄
ostream
(32.02 KB)
📄
queue
(27.47 KB)
📄
random
(221.29 KB)
📄
ratio
(16.04 KB)
📄
regex
(219.62 KB)
📄
scoped_allocator
(25.14 KB)
📄
semaphore
(6.52 KB)
📄
set
(55.98 KB)
📄
setjmp.h
(802 B)
📄
shared_mutex
(14.75 KB)
📄
span
(22.41 KB)
📄
sstream
(32.59 KB)
📄
stack
(9.86 KB)
📄
stdbool.h
(815 B)
📄
stddef.h
(1.08 KB)
📄
stdexcept
(7.66 KB)
📄
stdint.h
(2.27 KB)
📄
stdio.h
(3.44 KB)
📄
stdlib.h
(5.1 KB)
📄
streambuf
(14.18 KB)
📄
string
(163.38 KB)
📄
string.h
(4.58 KB)
📄
string_view
(33.74 KB)
📄
strstream
(10.88 KB)
📄
system_error
(13.88 KB)
📄
tgmath.h
(732 B)
📄
thread
(11.13 KB)
📄
tuple
(55.25 KB)
📄
type_traits
(147.84 KB)
📄
typeindex
(2.76 KB)
📄
typeinfo
(11.27 KB)
📄
unordered_map
(97.16 KB)
📄
unordered_set
(67.79 KB)
📄
utility
(48.28 KB)
📄
valarray
(131.97 KB)
📄
variant
(60.89 KB)
📄
vector
(109.43 KB)
📄
version
(14.98 KB)
📄
wchar.h
(8.24 KB)
📄
wctype.h
(1.52 KB)
Editing: new
// -*- C++ -*- //===----------------------------- new ------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef _LIBCPP_NEW #define _LIBCPP_NEW /* new synopsis namespace std { class bad_alloc : public exception { public: bad_alloc() noexcept; bad_alloc(const bad_alloc&) noexcept; bad_alloc& operator=(const bad_alloc&) noexcept; virtual const char* what() const noexcept; }; class bad_array_new_length : public bad_alloc // C++14 { public: bad_array_new_length() noexcept; }; enum class align_val_t : size_t {}; // C++17 struct destroying_delete_t { // C++20 explicit destroying_delete_t() = default; }; inline constexpr destroying_delete_t destroying_delete{}; // C++20 struct nothrow_t { explicit nothrow_t() = default; }; extern const nothrow_t nothrow; typedef void (*new_handler)(); new_handler set_new_handler(new_handler new_p) noexcept; new_handler get_new_handler() noexcept; // 21.6.4, pointer optimization barrier template <class T> constexpr T* launder(T* p) noexcept; // C++17 } // std void* operator new(std::size_t size); // replaceable, nodiscard in C++2a void* operator new(std::size_t size, std::align_val_t alignment); // replaceable, C++17, nodiscard in C++2a void* operator new(std::size_t size, const std::nothrow_t&) noexcept; // replaceable, nodiscard in C++2a void* operator new(std::size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept; // replaceable, C++17, nodiscard in C++2a void operator delete(void* ptr) noexcept; // replaceable void operator delete(void* ptr, std::size_t size) noexcept; // replaceable, C++14 void operator delete(void* ptr, std::align_val_t alignment) noexcept; // replaceable, C++17 void operator delete(void* ptr, std::size_t size, std::align_val_t alignment) noexcept; // replaceable, C++17 void operator delete(void* ptr, const std::nothrow_t&) noexcept; // replaceable void operator delete(void* ptr, std:align_val_t alignment, const std::nothrow_t&) noexcept; // replaceable, C++17 void* operator new[](std::size_t size); // replaceable, nodiscard in C++2a void* operator new[](std::size_t size, std::align_val_t alignment) noexcept; // replaceable, C++17, nodiscard in C++2a void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable, nodiscard in C++2a void* operator new[](std::size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept; // replaceable, C++17, nodiscard in C++2a void operator delete[](void* ptr) noexcept; // replaceable void operator delete[](void* ptr, std::size_t size) noexcept; // replaceable, C++14 void operator delete[](void* ptr, std::align_val_t alignment) noexcept; // replaceable, C++17 void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept; // replaceable, C++17 void operator delete[](void* ptr, const std::nothrow_t&) noexcept; // replaceable void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept; // replaceable, C++17 void* operator new (std::size_t size, void* ptr) noexcept; // nodiscard in C++2a void* operator new[](std::size_t size, void* ptr) noexcept; // nodiscard in C++2a void operator delete (void* ptr, void*) noexcept; void operator delete[](void* ptr, void*) noexcept; */ #include <__config> #include <exception> #include <type_traits> #include <cstddef> #include <version> #ifdef _LIBCPP_NO_EXCEPTIONS #include <cstdlib> #endif #if defined(_LIBCPP_ABI_VCRUNTIME) #include <new.h> #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif #if !defined(__cpp_sized_deallocation) || __cpp_sized_deallocation < 201309L #define _LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION #endif #if !defined(_LIBCPP_BUILDING_LIBRARY) && _LIBCPP_STD_VER < 14 && \ defined(_LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION) # define _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION #endif #if defined(_LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION) || \ defined(_LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION) # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION #endif #if !__has_builtin(__builtin_operator_new) || \ __has_builtin(__builtin_operator_new) < 201802L #define _LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE #endif namespace std // purposefully not using versioning namespace { #if !defined(_LIBCPP_ABI_VCRUNTIME) struct _LIBCPP_TYPE_VIS nothrow_t { explicit nothrow_t() = default; }; extern _LIBCPP_FUNC_VIS const nothrow_t nothrow; class _LIBCPP_EXCEPTION_ABI bad_alloc : public exception { public: bad_alloc() _NOEXCEPT; virtual ~bad_alloc() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; class _LIBCPP_EXCEPTION_ABI bad_array_new_length : public bad_alloc { public: bad_array_new_length() _NOEXCEPT; virtual ~bad_array_new_length() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; typedef void (*new_handler)(); _LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT; _LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT; #endif // !_LIBCPP_ABI_VCRUNTIME _LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec #if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) && \ !defined(_LIBCPP_ABI_VCRUNTIME) #ifndef _LIBCPP_CXX03_LANG enum class _LIBCPP_ENUM_VIS align_val_t : size_t { }; #else enum align_val_t { __zero = 0, __max = (size_t)-1 }; #endif #endif #if _LIBCPP_STD_VER > 17 // Enable the declaration even if the compiler doesn't support the language // feature. struct destroying_delete_t { explicit destroying_delete_t() = default; }; _LIBCPP_INLINE_VAR constexpr destroying_delete_t destroying_delete{}; #endif // _LIBCPP_STD_VER > 17 } // std #if defined(_LIBCPP_CXX03_LANG) #define _THROW_BAD_ALLOC throw(std::bad_alloc) #else #define _THROW_BAD_ALLOC #endif #if !defined(_LIBCPP_ABI_VCRUNTIME) _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC; _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT; #endif _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC; _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT; #endif #ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; #endif _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT; _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT; #ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; #endif #endif _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;} _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;} inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {} inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {} #endif // !_LIBCPP_ABI_VCRUNTIME _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_CONSTEXPR inline _LIBCPP_INLINE_VISIBILITY bool __is_overaligned_for_new(size_t __align) _NOEXCEPT { #ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__ return __align > __STDCPP_DEFAULT_NEW_ALIGNMENT__; #else return __align > alignment_of<max_align_t>::value; #endif } inline _LIBCPP_INLINE_VISIBILITY void *__libcpp_allocate(size_t __size, size_t __align) { #ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION if (__is_overaligned_for_new(__align)) { const align_val_t __align_val = static_cast<align_val_t>(__align); # ifdef _LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE return ::operator new(__size, __align_val); # else return __builtin_operator_new(__size, __align_val); # endif } #else ((void)__align); #endif #ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE return ::operator new(__size); #else return __builtin_operator_new(__size); #endif } struct _DeallocateCaller { static inline _LIBCPP_INLINE_VISIBILITY void __do_deallocate_handle_size_align(void *__ptr, size_t __size, size_t __align) { #if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) ((void)__align); return __do_deallocate_handle_size(__ptr, __size); #else if (__is_overaligned_for_new(__align)) { const align_val_t __align_val = static_cast<align_val_t>(__align); return __do_deallocate_handle_size(__ptr, __size, __align_val); } else { return __do_deallocate_handle_size(__ptr, __size); } #endif } static inline _LIBCPP_INLINE_VISIBILITY void __do_deallocate_handle_align(void *__ptr, size_t __align) { #if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) ((void)__align); return __do_call(__ptr); #else if (__is_overaligned_for_new(__align)) { const align_val_t __align_val = static_cast<align_val_t>(__align); return __do_call(__ptr, __align_val); } else { return __do_call(__ptr); } #endif } private: static inline void __do_deallocate_handle_size(void *__ptr, size_t __size) { #ifdef _LIBCPP_HAS_NO_SIZED_DEALLOCATION ((void)__size); return __do_call(__ptr); #else return __do_call(__ptr, __size); #endif } #ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION static inline void __do_deallocate_handle_size(void *__ptr, size_t __size, align_val_t __align) { #ifdef _LIBCPP_HAS_NO_SIZED_DEALLOCATION ((void)__size); return __do_call(__ptr, __align); #else return __do_call(__ptr, __size, __align); #endif } #endif private: template <class _A1, class _A2> static inline void __do_call(void *__ptr, _A1 __a1, _A2 __a2) { #if defined(_LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE) || \ defined(_LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE) return ::operator delete(__ptr, __a1, __a2); #else return __builtin_operator_delete(__ptr, __a1, __a2); #endif } template <class _A1> static inline void __do_call(void *__ptr, _A1 __a1) { #if defined(_LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE) || \ defined(_LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE) return ::operator delete(__ptr, __a1); #else return __builtin_operator_delete(__ptr, __a1); #endif } static inline void __do_call(void *__ptr) { #ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE return ::operator delete(__ptr); #else return __builtin_operator_delete(__ptr); #endif } }; inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void* __ptr, size_t __size, size_t __align) { _DeallocateCaller::__do_deallocate_handle_size_align(__ptr, __size, __align); } inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate_unsized(void* __ptr, size_t __align) { _DeallocateCaller::__do_deallocate_handle_align(__ptr, __align); } template <class _Tp> _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT { static_assert (!(is_function<_Tp>::value), "can't launder functions" ); static_assert (!(is_same<void, typename remove_cv<_Tp>::type>::value), "can't launder cv-void" ); #ifdef _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER return __builtin_launder(__p); #else return __p; #endif } #if _LIBCPP_STD_VER > 14 template <class _Tp> _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY constexpr _Tp* launder(_Tp* __p) noexcept { return _VSTD::__launder(__p); } #endif _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_NEW
Upload File
Create Folder