]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
clang/error: fix: non-type template argument refers to function ExportThunk that...
authorslipher <slipher@protonmail.com>
Sun, 5 Apr 2020 01:44:55 +0000 (03:44 +0200)
committerThomas Debesse <dev@illwieckz.net>
Sun, 5 Apr 2020 03:43:21 +0000 (05:43 +0200)
libs/property.h

index abdb32f4d4a945b84120d449c1c640c67c3ecc6e..f195ae244926adf9bdce476d6b16d6fc40f3ba16 100644 (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,35 @@ 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>>();
 }