Skip to content

Commit 3db67cc

Browse files
committed
refactor: add C++17 compatibility
1 parent df04ef2 commit 3db67cc

File tree

6 files changed

+565
-342
lines changed

6 files changed

+565
-342
lines changed

include/plugify/any.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#pragma once
22

3-
#include <plugify/numerics.hpp>
4-
#include <plugify/string.hpp>
5-
#include <plugify/variant.hpp>
6-
#include <plugify/vector.hpp>
3+
#include "numerics.hpp"
4+
#include "string.hpp"
5+
#include "variant.hpp"
6+
#include "vector.hpp"
77

88
namespace plg {
99
struct invalid {}; //!< Represents an invalid type.

include/plugify/macro.hpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,26 @@
125125
#else
126126
# define PLUGIFY_RESTRICT
127127
#endif
128+
129+
#if __cplusplus >= 202002L
130+
// Include it in your implimentation
131+
// # include <concepts>
132+
// # include <memory>
133+
134+
# define PLUGIFY_INPUT_ITERATOR std::input_iterator
135+
# define PLUGIFY_CONSTRUCT_AT(ptr, ...) std::construct_at(ptr, __VA_ARGS__)
136+
#else // !(__cplusplus >= 202002L)
137+
# define PLUGIFY_INPUT_ITERATOR typename
138+
# define PLUGIFY_CONSTRUCT_AT(ptr, ...) new (ptr) std::remove_reference_t<decltype(*ptr)>(__VA_ARGS__)
139+
#endif // __cplusplus >= 202002L
140+
141+
#ifndef __cpp_char8_t
142+
enum char8_t : unsigned char {};
143+
#endif // __cpp_char8_t
144+
145+
#ifdef __cpp_lib_is_nothrow_convertible
146+
# define PLUGIFY_NOTTHROW_CONVERTIBLE(T, S) std::is_nothrow_convertible_v<T, S>
147+
#else // !__cpp_lib_is_nothrow_convertible
148+
# define PLUGIFY_NOTTHROW_CONVERTIBLE(T, S) 0
149+
#endif // __cpp_lib_is_nothrow_convertible
150+

0 commit comments

Comments
 (0)