Fix ambigous template arguments.

This commit is contained in:
Marco Cawthorne 2021-01-16 16:46:35 +01:00
parent 79b2c431b2
commit f55bf7f4bd
5 changed files with 56 additions and 49 deletions

View File

@ -14,7 +14,7 @@ endif ()
# CMake 3.0+ would allow this in project()
set(WorldSpawn_VERSION_MAJOR 1)
set(WorldSpawn_VERSION_MINOR 0)
set(WorldSpawn_VERSION_MINOR 1)
set(WorldSpawn_VERSION_PATCH 0)
set(WorldSpawn_VERSION "${WorldSpawn_VERSION_MAJOR}.${WorldSpawn_VERSION_MINOR}.${WorldSpawn_VERSION_PATCH}")

View File

@ -101,7 +101,7 @@ namespace detail {
// pointer
template<class T>
template<class T, class U = typename std::enable_if<!std::is_function<T>::value>::type>
inline const void *convertToOpaque(const T *t) {
return t;
}
@ -113,7 +113,7 @@ namespace detail {
}
};
template<class T>
template<class T, class U = typename std::enable_if<!std::is_function<T>::value>::type>
inline void *convertToOpaque(T *t) {
return t;
}

View File

@ -102,6 +102,23 @@ Property<T> make_property(Self &self) {
// chain
template<typename DST, typename SRC, typename X, typename A>
struct make_property_chain_I_1 {
static void ExportThunk(const Callback<void(DST)> &self, SRC value) {
PropertyImpl<SRC, DST>::Export(value, self);
}
static void Export(const X &self, const Callback<void(DST)> &returnz) {
A::Get::thunk_(self, ConstReferenceCaller<Callback<void(DST)>, void(SRC), ExportThunk>(returnz));
}
static void Import(X &self, DST value) {
SRC out;
PropertyImpl<SRC, DST>::Import(out, value);
A::Set::thunk_(self, out);
}
};
template<class I_Outer, class I_Inner>
Property<detail::propertyimpl_other<I_Outer>> make_property_chain(detail::propertyimpl_self<I_Inner> &it) {
using DST = detail::propertyimpl_other<I_Outer>;
@ -109,45 +126,34 @@ Property<detail::propertyimpl_other<I_Outer>> make_property_chain(detail::proper
using X = detail::propertyimpl_self<I_Inner>;
using A = property_impl<I_Inner>;
struct I {
static void ExportThunk(const Callback<void(DST)> &self, SRC value) {
PropertyImpl<SRC, DST>::Export(value, self);
}
static void Export(const X &self, const Callback<void(DST)> &returnz) {
A::Get::thunk_(self, ConstReferenceCaller<Callback<void(DST)>, void(SRC), ExportThunk>(returnz));
}
static void Import(X &self, DST value) {
SRC out;
PropertyImpl<SRC, DST>::Import(out, value);
A::Set::thunk_(self, out);
}
};
using I = make_property_chain_I_1<DST, SRC, X, A>;
return make_property<PropertyAdaptor<X, DST, I>>(it);
}
template<typename DST, typename SRC, typename A>
struct make_property_chain_I_2 {
static void ExportThunk(const Callback<void(DST)> &self, SRC value) {
PropertyImpl<SRC, DST>::Export(value, self);
}
static void Export(const Callback<void(DST)> &returnz) {
A::Get::thunk_(nullptr, ConstReferenceCaller<Callback<void(DST)>, void(SRC), ExportThunk>(returnz));
}
static void Import(DST value) {
SRC out;
PropertyImpl<SRC, DST>::Import(out, value);
A::Set::thunk_(nullptr, out);
}
};
template<class I_Outer, class I_Inner>
Property<detail::propertyimpl_other<I_Outer>> make_property_chain() {
using DST = detail::propertyimpl_other<I_Outer>;
using SRC = detail::propertyimpl_self<I_Outer>;
using A = property_impl_free<I_Inner>;
struct I {
static void ExportThunk(const Callback<void(DST)> &self, SRC value) {
PropertyImpl<SRC, DST>::Export(value, self);
}
static void Export(const Callback<void(DST)> &returnz) {
A::Get::thunk_(nullptr, ConstReferenceCaller<Callback<void(DST)>, void(SRC), ExportThunk>(returnz));
}
static void Import(DST value) {
SRC out;
PropertyImpl<SRC, DST>::Import(out, value);
A::Set::thunk_(nullptr, out);
}
};
using I = make_property_chain_I_2<DST, SRC, A>;
return make_property<PropertyAdaptorFree<DST, I>>();
}

View File

@ -284,27 +284,28 @@ public:
}
};
template<class Widget, class Self, class T, class native>
struct AddDataCustom_Wrapper {
static void Export(const native &self, const Callback<void(T)> &returnz) {
native *p = &const_cast<native &>(self);
auto widget = Self::from(p);
Widget::Get::thunk_(widget, returnz);
}
static void Import(native &self, T value) {
native *p = &self;
auto widget = Self::from(p);
Widget::Set::thunk_(widget, value);
}
};
template<class Widget>
void AddDataCustom(DialogDataList &self, typename Widget::Type widget, Property<typename Widget::Other> const &property)
{
using Self = typename Widget::Type;
using T = typename Widget::Other;
using native = typename std::remove_pointer<typename Self::native>::type;
struct Wrapper {
static void Export(const native &self, const Callback<void(T)> &returnz)
{
native *p = &const_cast<native &>(self);
auto widget = Self::from(p);
Widget::Get::thunk_(widget, returnz);
}
static void Import(native &self, T value)
{
native *p = &self;
auto widget = Self::from(p);
Widget::Set::thunk_(widget, value);
}
};
using Wrapper = AddDataCustom_Wrapper<Widget, Self, T, native>;
self.push_back(new CallbackDialogData<typename Widget::Other>(
make_property<PropertyAdaptor<native, T, Wrapper>>(*static_cast<native *>(widget)),
property

View File

@ -186,7 +186,7 @@
{ "dust", 0, 0, Q_SURF_DUST, 0, 0, 0 },
/* nodraw2 is seen by the engine but NOT handled by the compiler tools, and thus never stripped */
{ "nodraw2", 0, 0, Q_SURF_NODRAW, 0, 0, 0 },
{ "nodraw2", Q_CONT_STRUCTURAL, 0, 0, 0, C_STRUCTURAL, 0 },
/* q2/hlish-style ladder volumes */
{ "laddervolume", FTE_CONT_LADDER, Q_CONT_SOLID, 0, 0, 0, 0 },
/* trisoup uses mesh collisions, instead of being non-solid */