diff options
Diffstat (limited to 'c,cc/derive_from_templated_class.cc')
-rw-r--r-- | c,cc/derive_from_templated_class.cc | 29 |
1 files changed, 29 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..f252981 --- /dev/null +++ b/c,cc/derive_from_templated_class.cc @@ -0,0 +1,29 @@ +#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; +} + |