Skip to content

Commit 98e6cdd

Browse files
committed
pusher::template push fix
1 parent f9615b8 commit 98e6cdd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

include/peacalm/luaw.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3071,9 +3071,10 @@ struct luaw::pusher<luaw::class_tag> {
30713071

30723072
// Construct TargetT by Y at the moment of creating userdata.
30733073
template <typename TargetT, typename Y>
3074-
static std::enable_if_t<!std::is_same<TargetT, Y>::value &&
3075-
!std::is_reference<TargetT>::value,
3076-
int>
3074+
static std::enable_if_t<
3075+
!std::is_same<TargetT, Y>::value &&
3076+
!std::is_same<std::decay_t<TargetT>, luaw::class_tag>::value,
3077+
int>
30773078
push(luaw& l, Y&& v) {
30783079
static_assert(std::is_class<std::remove_pointer_t<TargetT>>::value,
30793080
"Only class or it's pointer");
@@ -3114,10 +3115,11 @@ struct luaw::pusher {
31143115

31153116
static const size_t size = 1;
31163117

3118+
// DecayY must be same as T
31173119
template <typename Y>
31183120
static int push(luaw& l, Y&& v) {
31193121
static_assert(std::is_same<std::decay_t<Y>, T>::value,
3120-
"DecayY should same to T");
3122+
"Decayed Y should be same type as T");
31213123
using SolidY = std::remove_reference_t<Y>;
31223124

31233125
// Guess whether it may be a lambda object, if it is, then push as a
@@ -3128,10 +3130,8 @@ struct luaw::pusher {
31283130

31293131
// Construct TargetT by Y at the moment of creating userdata.
31303132
template <typename TargetT, typename Y>
3131-
static std::enable_if_t<!std::is_same<TargetT, Y>::value &&
3132-
!std::is_reference<TargetT>::value,
3133-
int>
3134-
push(luaw& l, Y&& v) {
3133+
static std::enable_if_t<!std::is_same<TargetT, Y>::value, int> push(luaw& l,
3134+
Y&& v) {
31353135
static_assert(std::is_class<TargetT>::value &&
31363136
std::is_same<std::remove_cv_t<TargetT>, T>::value,
31373137
"TargetT should be class T or cv- qualified T");

0 commit comments

Comments
 (0)