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-2023 Amebis
4
*/
5
6
#pragma once
7
8
#include <assert.h>
9
#include <stddef.h>
10
#ifdef _WIN32
11
#include "windows.h"
12
#include <sal.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_params_
65
#define _Printf_format_string_params_(n)
66
#endif
67
68
#ifndef _Inout_
69
#define _Inout_
70
#endif
71
#ifndef _Inout_opt_
72
#define _Inout_opt_
73
#endif
74
#ifndef _Inout_z_
75
#define _Inout_z_
76
#endif
77
#ifndef _Inout_cap_
78
#define _Inout_cap_(p)
79
#endif
80
#ifndef _Inout_count_
81
#define _Inout_count_(p)
82
#endif
83
#ifndef _Inout_updates_z_
84
#define _Inout_updates_z_(p)
85
#endif
86
87
#ifndef _Use_decl_annotations_
88
#define _Use_decl_annotations_
89
#endif
90
91
#ifndef _Out_
92
#define _Out_
93
#endif
94
#ifndef _Out_opt_
95
#define _Out_opt_
96
#endif
97
#ifndef _Out_z_cap_
98
#define _Out_z_cap_(p)
99
#endif
100
#ifndef _Out_writes_
101
#define _Out_writes_(p)
102
#endif
103
#ifndef _Out_writes_opt_
104
#define _Out_writes_opt_(p)
105
#endif
106
#ifndef _Out_writes_opt_z_
107
#define _Out_writes_opt_z_(p)
108
#endif
109
#ifndef _Out_writes_bytes_
110
#define _Out_writes_bytes_(p)
111
#endif
112
#ifndef _Out_writes_to_
113
#define _Out_writes_to_(p, q)
114
#endif
115
#ifndef _Out_writes_all_
116
#define _Out_writes_all_(p)
117
#endif
118
#ifndef _Out_writes_z_
119
#define _Out_writes_z_(p)
120
#endif
121
#ifndef _Out_writes_bytes_to_opt_
122
#define _Out_writes_bytes_to_opt_(p, q)
123
#endif
124
125
#ifndef _Success_
126
#define _Success_(p)
127
#endif
128
#ifndef _Ret_maybenull_
129
#define _Ret_maybenull_
130
#endif
131
#ifndef _Ret_maybenull_z_
132
#define _Ret_maybenull_z_
133
#endif
134
#ifndef _Ret_notnull_
135
#define _Ret_notnull_
136
#endif
137
#ifndef _Ret_z_
138
#define _Ret_z_
139
#endif
140
#ifndef _Must_inspect_result_
141
#define _Must_inspect_result_
142
#endif
143
#ifndef _Check_return_
144
#define _Check_return_
145
#endif
146
#ifndef _Post_maybez_
147
#define _Post_maybez_
148
#endif
149
#ifndef _Null_terminated_
150
#define _Null_terminated_
151
#endif
152
153
#ifndef _Likely_
154
#if _HAS_CXX20
155
#define _Likely_ [[likely]]
156
#else
157
#define _Likely_
158
#endif
159
#endif
160
161
#ifndef _Unlikely_
162
#if _HAS_CXX20
163
#define _Unlikely_ [[unlikely]]
164
#else
165
#define _Unlikely_
166
#endif
167
#endif
168
169
#if _HAS_CXX17
170
#define _Constexpr_ constexpr
171
#else
172
#define _Constexpr_
173
#endif
174
175
#ifdef _MSC_VER
176
#define _Deprecated_(message) __declspec(deprecated(message))
177
#else
178
#define _Deprecated_(message) [[deprecated(message)]]
179
#endif
180
181
#ifdef _WIN32
182
#define _Unreferenced_(x) UNREFERENCED_PARAMETER(x)
183
#else
184
#define _Unreferenced_(x)
185
#endif
186
187
#ifndef _WIN32
188
template
<
typename
T,
size_t
N>
189
size_t
_countof(T (&arr)[N])
190
{
191
return
std::extent<T[N]>::value;
192
}
193
#endif
194
195
#ifndef _Analysis_assume_
196
#define _Analysis_assume_(p)
197
#endif
198
#ifdef NDEBUG
199
#define _Assume_(p) _Analysis_assume_(p)
200
#else
201
#define _Assume_(p) assert(p)
202
#endif
203
204
#ifdef __APPLE__
205
#define off64_t off_t
206
#define lseek64 lseek
207
#define lockf64 lockf
208
#define ftruncate64 ftruncate
209
#endif
210
Generated on Mon Nov 6 2023 14:43:47 for stdex by
1.9.8