stdex
Additional custom or not Standard C++ covered algorithms
Loading...
Searching...
No Matches
include
stdex
compat.hpp
1
/*
2
SPDX-License-Identifier: MIT
3
Copyright © 2022-2024 Amebis
4
*/
5
6
#pragma once
7
8
#include <stddef.h>
9
#ifdef _WIN32
10
#include "windows.h"
11
#include <sal.h>
12
#include <tchar.h>
13
#endif
14
#include <type_traits>
15
16
#ifndef _In_
17
#define _In_
18
#endif
19
#ifndef _In_bytecount_
20
#define _In_bytecount_(p)
21
#endif
22
#ifndef _In_count_
23
#define _In_count_(p)
24
#endif
25
#ifndef _In_opt_
26
#define _In_opt_
27
#endif
28
#ifndef _In_opt_count_
29
#define _In_opt_count_(p)
30
#endif
31
#ifndef _In_opt_z_count_
32
#define _In_opt_z_count_(p)
33
#endif
34
#ifndef _In_z_
35
#define _In_z_
36
#endif
37
#ifndef _In_opt_z_
38
#define _In_opt_z_
39
#endif
40
#ifndef _In_z_count_
41
#define _In_z_count_(p)
42
#endif
43
#ifndef _In_reads_
44
#define _In_reads_(p)
45
#endif
46
#ifndef _In_reads_z_
47
#define _In_reads_z_(p)
48
#endif
49
#ifndef _In_reads_opt_
50
#define _In_reads_opt_(p)
51
#endif
52
#ifndef _In_reads_opt_z_
53
#define _In_reads_opt_z_(p)
54
#endif
55
#ifndef _In_reads_or_z_
56
#define _In_reads_or_z_(p)
57
#endif
58
#ifndef _In_reads_or_z_opt_
59
#define _In_reads_or_z_opt_(p)
60
#endif
61
#ifndef _In_reads_bytes_opt_
62
#define _In_reads_bytes_opt_(p)
63
#endif
64
#ifndef _Printf_format_string_
65
#define _Printf_format_string_
66
#endif
67
#ifndef _Printf_format_string_params_
68
#define _Printf_format_string_params_(n)
69
#endif
70
71
#ifndef _Inout_
72
#define _Inout_
73
#endif
74
#ifndef _Inout_opt_
75
#define _Inout_opt_
76
#endif
77
#ifndef _Inout_z_
78
#define _Inout_z_
79
#endif
80
#ifndef _Inout_z_count_
81
#define _Inout_z_count_(p)
82
#endif
83
#ifndef _Inout_cap_
84
#define _Inout_cap_(p)
85
#endif
86
#ifndef _Inout_count_
87
#define _Inout_count_(p)
88
#endif
89
#ifndef _Inout_updates_z_
90
#define _Inout_updates_z_(p)
91
#endif
92
93
#ifndef _Use_decl_annotations_
94
#define _Use_decl_annotations_
95
#endif
96
97
#ifndef _Out_
98
#define _Out_
99
#endif
100
#ifndef _Out_opt_
101
#define _Out_opt_
102
#endif
103
#ifndef _Out_z_cap_
104
#define _Out_z_cap_(p)
105
#endif
106
#ifndef _Out_writes_
107
#define _Out_writes_(p)
108
#endif
109
#ifndef _Out_writes_opt_
110
#define _Out_writes_opt_(p)
111
#endif
112
#ifndef _Out_writes_all_opt_
113
#define _Out_writes_all_opt_(p)
114
#endif
115
#ifndef _Out_writes_opt_z_
116
#define _Out_writes_opt_z_(p)
117
#endif
118
#ifndef _Out_writes_bytes_
119
#define _Out_writes_bytes_(p)
120
#endif
121
#ifndef _Out_writes_to_
122
#define _Out_writes_to_(p, q)
123
#endif
124
#ifndef _Out_writes_all_
125
#define _Out_writes_all_(p)
126
#endif
127
#ifndef _Out_writes_z_
128
#define _Out_writes_z_(p)
129
#endif
130
#ifndef _Out_writes_bytes_to_opt_
131
#define _Out_writes_bytes_to_opt_(p, q)
132
#endif
133
134
#ifndef _Success_
135
#define _Success_(p)
136
#endif
137
#ifndef _Ret_maybenull_
138
#define _Ret_maybenull_
139
#endif
140
#ifndef _Ret_maybenull_z_
141
#define _Ret_maybenull_z_
142
#endif
143
#ifndef _Ret_notnull_
144
#define _Ret_notnull_
145
#endif
146
#ifndef _Ret_z_
147
#define _Ret_z_
148
#endif
149
#ifndef _Must_inspect_result_
150
#define _Must_inspect_result_
151
#endif
152
#ifndef _Check_return_
153
#define _Check_return_
154
#endif
155
#ifndef _Post_maybez_
156
#define _Post_maybez_
157
#endif
158
#ifndef _Null_terminated_
159
#define _Null_terminated_
160
#endif
161
162
#ifndef _L
163
#define __L(x) L ## x
164
#define _L(x) __L(x)
165
#endif
166
#ifndef _T
167
#define _T(x) x
168
#endif
169
170
#ifndef _Likely_
171
#if _HAS_CXX20
172
#define _Likely_ [[likely]]
173
#else
174
#define _Likely_
175
#endif
176
#endif
177
178
#ifndef _Unlikely_
179
#if _HAS_CXX20
180
#define _Unlikely_ [[unlikely]]
181
#else
182
#define _Unlikely_
183
#endif
184
#endif
185
186
#ifdef _MSC_VER
187
#define _Deprecated_(message) __declspec(deprecated(message))
188
#define _NoReturn_ __declspec(noreturn)
189
#else
190
#define _Deprecated_(message) [[deprecated(message)]]
191
#define _NoReturn_ [[noreturn]]
192
#endif
193
194
#ifdef _WIN32
195
#define _Unreferenced_(x) UNREFERENCED_PARAMETER(x)
196
#else
197
#define _Unreferenced_(x) (void)(x)
198
#endif
199
200
#ifndef _WIN32
201
template
<
class
T,
size_t
N>
202
size_t
_countof(
const
T (&arr)[N])
203
{
204
_Unreferenced_(arr);
205
return
std::extent<T[N]>::value;
206
}
207
#endif
208
209
#ifndef _Analysis_assume_
210
#define _Analysis_assume_(p)
211
#endif
212
213
#ifdef __APPLE__
214
#define off64_t off_t
215
#define lseek64 lseek
216
#define lockf64 lockf
217
#define ftruncate64 ftruncate
218
#endif
Generated on Mon Aug 19 2024 09:21:09 for stdex by
1.12.0