From: slipher Date: Sun, 5 Apr 2020 02:13:48 +0000 (+0200) Subject: clang/error: fix: non-type template argument refers to function Export that does... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2ad753ece42b6208ff530b857c3fe53f87d594ab;p=xonotic%2Fnetradiant.git clang/error: fix: non-type template argument refers to function Export that does not have linkage --- diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index 1c628ff1..66f2d998 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -256,24 +256,28 @@ public: } }; +template +struct AddDataCustom_Wrapper { + static void Export(const native &self, const Callback &returnz) { + native *p = &const_cast(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 void AddDataCustom(DialogDataList &self, typename Widget::Type widget, Property const &property) { using Self = typename Widget::Type; using T = typename Widget::Other; using native = typename std::remove_pointer::type; - struct Wrapper { - static void Export(const native &self, const Callback &returnz) { - native *p = &const_cast(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; + self.push_back(new CallbackDialogData( make_property>(*static_cast(widget)), property