summaryrefslogtreecommitdiff
path: root/c,cc
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-08-16 21:29:51 +0100
committerPatrick Simianer <p@simianer.de>2014-08-16 21:29:51 +0100
commit4c0b43133a1bbe728c404d3b27e34b97b2f82b3b (patch)
tree36587f46e234047d05aa888e704710e1c9697aec /c,cc
parentad6fdf99c86150a0e72c5094d1379b39b83a148d (diff)
c++: derive from templated class
Diffstat (limited to 'c,cc')
-rw-r--r--c,cc/derive_from_templated_class.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/c,cc/derive_from_templated_class.cc b/c,cc/derive_from_templated_class.cc
new file mode 100644
index 0000000..3e292c8
--- /dev/null
+++ b/c,cc/derive_from_templated_class.cc
@@ -0,0 +1,31 @@
+#include <vector>
+#include <iostream>
+
+using namespace std;
+
+
+template<class T>
+class A {
+ T m_;
+};
+
+template<class T>
+class B : public A<T> {
+ T n_;
+};
+
+template<class T>
+void f(vector<B<T>*> v)
+{
+ for (typename vector<B<T>*>::iterator it = v.begin(); it != v.end(); it++) {
+ // do sth
+ }
+}
+
+
+
+int main(void)
+{
+ vector<B<int>* > v;
+}
+