1 |
/* |
/* |
2 |
* Copyright (c) 2014 Christian Schoenebeck |
* Copyright (c) 2014 - 2020 Christian Schoenebeck |
3 |
* |
* |
4 |
* http://www.linuxsampler.org |
* http://www.linuxsampler.org |
5 |
* |
* |
12 |
|
|
13 |
#include <set> |
#include <set> |
14 |
#include <stdio.h> |
#include <stdio.h> |
15 |
|
#if __cplusplus >= 201103L && !CONFIG_NO_CPP11STL |
16 |
|
# include <type_traits> // for std::enable_if and std::is_same |
17 |
|
#endif |
18 |
|
|
19 |
// You may enable this while developing or at least when you encounter any kind |
// You may enable this while developing or at least when you encounter any kind |
20 |
// of crashes or other misbehaviors in conjunction with Ref class guarded code. |
// of crashes or other misbehaviors in conjunction with Ref class guarded code. |
206 |
#endif |
#endif |
207 |
} |
} |
208 |
|
|
209 |
|
#if __cplusplus >= 201103L && !CONFIG_NO_CPP11STL |
210 |
|
template<std::enable_if<!std::is_same<T_BASE, T>::value>* = NULL> // prevent compiler error if T == T_Base (due to method signature duplicate) |
211 |
|
#endif |
212 |
Ref(const T_BASE* p) : RefBaseT() { |
Ref(const T_BASE* p) : RefBaseT() { |
213 |
#if LS_REF_VERBOSE_DEBUG_MSG |
#if LS_REF_VERBOSE_DEBUG_MSG |
214 |
printf("Ref base ptr ctor Ref:0x%lx <- p:0x%lx\n", (long long)this, (long long)p); |
printf("Ref base ptr ctor Ref:0x%lx <- p:0x%lx\n", (long long)this, (long long)p); |
357 |
return *this; |
return *this; |
358 |
} |
} |
359 |
|
|
360 |
|
#if __cplusplus >= 201103L && !CONFIG_NO_CPP11STL |
361 |
|
template<std::enable_if<!std::is_same<T_BASE, T>::value>* = NULL> // prevent compiler error if T == T_Base (due to method signature duplicate) |
362 |
|
#endif |
363 |
Ref<T,T_BASE>& operator=(const T_BASE* p) { |
Ref<T,T_BASE>& operator=(const T_BASE* p) { |
364 |
#if LS_REF_VERBOSE_DEBUG_MSG |
#if LS_REF_VERBOSE_DEBUG_MSG |
365 |
printf("Ref base ptr assignment Ref:0x%lx <- p:0x%lx\n", (long long)this, p); |
printf("Ref base ptr assignment Ref:0x%lx <- p:0x%lx\n", (long long)this, p); |