Skip to content

Commit d974641

Browse files
committed
for vs2015 error C3256
1 parent 455c0b4 commit d974641

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/libipc/utility/pimpl.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <new>
44
#include <utility>
55

6+
#include "libipc/platform/detail.h"
67
#include "libipc/utility/concept.h"
78
#include "libipc/pool_alloc.h"
89

@@ -17,49 +18,45 @@ template <typename T, typename R = T*>
1718
using IsImplUncomfortable = ipc::require<(sizeof(T) > sizeof(T*)), R>;
1819

1920
template <typename T, typename... P>
20-
constexpr auto make_impl(P&&... params) -> IsImplComfortable<T> {
21+
IPC_CONSTEXPR_ auto make_impl(P&&... params) -> IsImplComfortable<T> {
2122
T* buf {};
2223
::new (&buf) T { std::forward<P>(params)... };
2324
return buf;
2425
}
2526

2627
template <typename T>
27-
constexpr auto impl(T* const (& p)) -> IsImplComfortable<T> {
28+
IPC_CONSTEXPR_ auto impl(T* const (& p)) -> IsImplComfortable<T> {
2829
return reinterpret_cast<T*>(&const_cast<char &>(reinterpret_cast<char const &>(p)));
2930
}
3031

3132
template <typename T>
32-
constexpr auto clear_impl(T* p) -> IsImplComfortable<T, void> {
33+
IPC_CONSTEXPR_ auto clear_impl(T* p) -> IsImplComfortable<T, void> {
3334
if (p != nullptr) impl(p)->~T();
3435
}
3536

3637
template <typename T, typename... P>
37-
constexpr auto make_impl(P&&... params) -> IsImplUncomfortable<T> {
38+
IPC_CONSTEXPR_ auto make_impl(P&&... params) -> IsImplUncomfortable<T> {
3839
return mem::alloc<T>(std::forward<P>(params)...);
3940
}
4041

4142
template <typename T>
42-
constexpr auto clear_impl(T* p) -> IsImplUncomfortable<T, void> {
43+
IPC_CONSTEXPR_ auto clear_impl(T* p) -> IsImplUncomfortable<T, void> {
4344
mem::free(p);
4445
}
4546

4647
template <typename T>
47-
constexpr auto impl(T* const (& p)) -> IsImplUncomfortable<T> {
48+
IPC_CONSTEXPR_ auto impl(T* const (& p)) -> IsImplUncomfortable<T> {
4849
return p;
4950
}
5051

5152
template <typename T>
5253
struct pimpl {
5354
template <typename... P>
54-
constexpr static T* make(P&&... params) {
55+
IPC_CONSTEXPR_ static T* make(P&&... params) {
5556
return make_impl<T>(std::forward<P>(params)...);
5657
}
5758

58-
#if __cplusplus >= 201703L
59-
constexpr void clear() {
60-
#else /*__cplusplus < 201703L*/
61-
void clear() {
62-
#endif/*__cplusplus < 201703L*/
59+
IPC_CONSTEXPR_ void clear() {
6360
clear_impl(static_cast<T*>(const_cast<pimpl*>(this)));
6461
}
6562
};

0 commit comments

Comments
 (0)