diff liboctave/Array.cc @ 9201:472f0e22aa60

guard against implicit instantiation
author Jaroslav Hajek <highegg@gmail.com>
date Fri, 15 May 2009 13:24:38 +0200
parents bb62bc406ea7
children 7bd406e12e4d
line wrap: on
line diff
--- a/liboctave/Array.cc
+++ b/liboctave/Array.cc
@@ -2688,7 +2688,16 @@
   //     << prefix << "cols: " << cols () << "\n";
 }
 
+template <class T>
+void Array<T>::instantiation_guard ()
+{
+  // This guards against accidental implicit instantiations.
+  // Array<T> instances should always be explicit and use INSTANTIATE_ARRAY.
+  T::__xXxXx__();
+}
+
 #define INSTANTIATE_ARRAY(T, API) \
+  template <> void Array<T>::instantiation_guard () { } \
   template class API Array<T>
 
 /*