Skip to content

Commit abc9338

Browse files
committed
Add standard-version ifdefs in rules
1 parent 63cf100 commit abc9338

4 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎rules/cstddef/src.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
#include <cstddef>
55
#include <sys/types.h>
66

7+
#if __cplusplus >= 201703L
78
using t1 = std::byte;
9+
#endif
810

911
typedef size_t t2;
1012
typedef size_t *t3;
@@ -14,10 +16,12 @@ typedef ssize_t t6;
1416
typedef ssize_t *t7;
1517
typedef const ssize_t *t8;
1618

19+
#if __cplusplus >= 201703L
1720
std::byte f1(const std::byte &a0, unsigned a1) { return operator<<(a0, a1); }
1821

1922
std::byte f2(const std::byte &a0, unsigned a1) { return operator>>(a0, a1); }
2023

2124
std::byte f3(std::byte &a0, unsigned a1) { return operator<<=(a0, a1); }
2225

2326
std::byte f4(std::byte &a0, unsigned a1) { return operator>>=(a0, a1); }
27+
#endif

‎rules/new/src.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ void *f3(std::size_t a0) { return ::operator new[](a0); }
1111

1212
void f4(void *a0) { return ::operator delete[](a0); }
1313

14+
#if __cplusplus >= 201703L
1415
template <typename T1> T1 *f5(T1 *a0) { return std::launder(a0); }
16+
#endif

‎rules/string/src.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ std::string &f4(std::string &s, const char *p, std::size_t n) {
2323

2424
const char *f5(const std::string &s) { return s.c_str(); }
2525

26+
#if __cplusplus >= 201703L
2627
char *f6(std::string &s) { return s.data(); }
28+
#endif
2729

2830
std::string f7(const char *s, std::size_t n) { return std::string(s, n); }
2931

‎rules/unique_ptr/src.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ template <typename T, typename A> using Init = A;
99
template <typename T1> using t1 = std::unique_ptr<T1>;
1010
template <typename T1> using t2 = std::unique_ptr<T1[]>;
1111

12+
#if __cplusplus >= 201402L
1213
template <typename T2, typename T1> std::unique_ptr<T1[]> f1(std::size_t n) {
1314
return std::make_unique<T1[]>(n);
1415
}
16+
#endif
1517

1618
template <typename T1> T1 *f2(std::unique_ptr<T1> &o) { return o.get(); }
1719

@@ -33,10 +35,12 @@ template <typename T1> void f6(std::unique_ptr<T1[]> &o, T1 *p) {
3335

3436
template <typename T1> T1 *f7(std::unique_ptr<T1[]> &o) { return o.get(); }
3537

38+
#if __cplusplus >= 201402L
3639
template <typename T1, typename... Args>
3740
std::unique_ptr<T1> f8(Init<T1, Args> &&...args) {
3841
return std::make_unique<T1>(std::forward<Args>(args)...);
3942
}
43+
#endif
4044

4145
template <typename T1> void f9(std::unique_ptr<T1[]> &o) {
4246
return o.reset(nullptr);

0 commit comments

Comments
 (0)