|
32 | 32 | #include <string>
|
33 | 33 | #include <string_view>
|
34 | 34 | #include <thread>
|
| 35 | +#include <type_traits> |
35 | 36 | #include <vector>
|
36 | 37 |
|
37 | 38 | #include "hexify.h"
|
@@ -151,17 +152,16 @@ using SocketTimestampOld =
|
151 | 152 |
|
152 | 153 | #ifdef SO_TIMESTAMP
|
153 | 154 | // linux + freebsd
|
154 |
| -using SocketTimestamp = SocketTimestampBase<SOL_SOCKET, SO_TIMESTAMP, |
| 155 | +using SocketTimestamp = |
| 156 | + SocketTimestampBase<SOL_SOCKET, SO_TIMESTAMP, |
155 | 157 | #ifdef SO_TIMESTAMP_NEW
|
156 |
| -#if SO_TIMESTAMP == SO_TIMESTAMP_NEW |
157 |
| - SocketTimestampNew::value_type |
| 158 | + std::conditional_t<SO_TIMESTAMP == SO_TIMESTAMP_NEW, |
| 159 | + SocketTimestampNew::value_type, |
| 160 | + SocketTimestampOld::value_type> |
158 | 161 | #else
|
159 |
| - SocketTimestampOld::value_type |
| 162 | + timeval |
160 | 163 | #endif
|
161 |
| -#else |
162 |
| - timeval |
163 |
| -#endif |
164 |
| - >; |
| 164 | + >; |
165 | 165 | #endif
|
166 | 166 |
|
167 | 167 | template <int Lvl, int Type, class V>
|
@@ -205,18 +205,16 @@ using SocketTimestampNanosecondOld =
|
205 | 205 | #endif
|
206 | 206 |
|
207 | 207 | #ifdef SO_TIMESTAMPNS
|
208 |
| -using SocketTimestampNanosecond = |
209 |
| - SocketTimestampNanosecondBase<SOL_SOCKET, SO_TIMESTAMPNS, |
| 208 | +using SocketTimestampNanosecond = SocketTimestampNanosecondBase< |
| 209 | + SOL_SOCKET, SO_TIMESTAMPNS, |
210 | 210 | #ifdef SO_TIMESTAMPNS_NEW
|
211 |
| -#if SO_TIMESTAMPNS == SO_TIMESTAMPNS_NEW |
212 |
| - SocketTimestampNanosecondNew::value_type |
213 |
| -#else |
214 |
| - SocketTimestampNanosecondOld::value_type |
215 |
| -#endif |
| 211 | + std::conditional_t<SO_TIMESTAMPNS == SO_TIMESTAMPNS_NEW, |
| 212 | + SocketTimestampNanosecondNew::value_type, |
| 213 | + SocketTimestampNanosecondOld::value_type> |
216 | 214 | #else
|
217 |
| - timespec |
| 215 | + timespec |
218 | 216 | #endif
|
219 |
| - >; |
| 217 | + >; |
220 | 218 | #endif
|
221 | 219 |
|
222 | 220 | template <int Lvl, int Type, class V>
|
@@ -290,20 +288,17 @@ using SocketTimestampingOld =
|
290 | 288 | #endif
|
291 | 289 |
|
292 | 290 | #ifdef SO_TIMESTAMPING
|
293 |
| -using SocketTimestamping = |
294 |
| - SocketTimestampingBase<SOL_SOCKET, SO_TIMESTAMPING, |
| 291 | +using SocketTimestamping = SocketTimestampingBase< |
| 292 | + SOL_SOCKET, SO_TIMESTAMPING, |
295 | 293 | #ifdef SO_TIMESTAMPING_NEW
|
296 |
| -#if SO_TIMESTAMPING == SO_TIMESTAMPING_NEW |
297 |
| - SocketTimestampingNew::value_type |
298 |
| -#else |
299 |
| - SocketTimestampingOld::value_type |
300 |
| -#endif |
| 294 | + std::conditional_t<SO_TIMESTAMPING == SO_TIMESTAMPING_NEW, |
| 295 | + SocketTimestampingNew::value_type, |
| 296 | + SocketTimestampingOld::value_type> |
301 | 297 | #else
|
302 |
| - std::conditional_t< |
303 |
| - is_type_complete_v<struct scm_timestamping>, |
304 |
| - scm_timestamping, fallback::scm_timestamping> |
| 298 | + std::conditional_t<is_type_complete_v<struct scm_timestamping>, |
| 299 | + scm_timestamping, fallback::scm_timestamping> |
305 | 300 | #endif
|
306 |
| - >; |
| 301 | + >; |
307 | 302 | #endif
|
308 | 303 |
|
309 | 304 | // if they are defined, check they have the expected value.
|
|
0 commit comments