Limit concat to non pointer types to avoid hard to track problems
This commit is contained in:
parent
0a6ed5f2ba
commit
4bcfbf1f19
|
@ -71,6 +71,23 @@ namespace JabyEngine {
|
||||||
|
|
||||||
// #############################################
|
// #############################################
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct is_pointer : false_type {};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct is_pointer<T*> : true_type {};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct is_pointer<T* const> : true_type {};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct is_pointer<T* volatile> : true_type {};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct is_pointer<T* const volatile> : true_type {};
|
||||||
|
|
||||||
|
// #############################################
|
||||||
|
|
||||||
template<typename T, typename... Ts>
|
template<typename T, typename... Ts>
|
||||||
using variadic_force_same = enable_if<conjunction<is_same<T, Ts>...>::value>::type;
|
using variadic_force_same = enable_if<conjunction<is_same<T, Ts>...>::value>::type;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "../../Auxiliary/bits.hpp"
|
#include "../../Auxiliary/bits.hpp"
|
||||||
|
#include "../../Auxiliary/type_traits.hpp"
|
||||||
|
|
||||||
namespace JabyEngine {
|
namespace JabyEngine {
|
||||||
namespace GPU {
|
namespace GPU {
|
||||||
|
@ -37,13 +38,13 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T& concat(T& obj) {
|
enable_if<!is_pointer<T>::value, T&>::type concat(T& obj) {
|
||||||
Link::set_adr(&obj);
|
Link::set_adr(&obj);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
const T& concat(const T& obj) {
|
enable_if<!is_pointer<T>::value, const T&>::type concat(const T& obj) {
|
||||||
return concat(const_cast<T&>(obj));
|
return concat(const_cast<T&>(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue