Created
April 1, 2014 16:08
-
-
Save cheuerde/9917298 to your computer and use it in GitHub Desktop.
Template class to std::vector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
template<typename T1> | |
class test_class{ | |
T1 X; | |
}; | |
int main(){ | |
test_class<double> W; | |
test_class<int> Z; | |
vector<test_class<double> > vec; // this compiles fine, as I specify the class | |
//vector<test_class> vec; // this is impossible, as test_class is only a template | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ich braue einen Weg um die Template-Class in einen std::vector zu stecken. Dies geht so aber nicht, ich brauche
also einen Workaround. Habe im Netz gelesen, dass eine Parent-class für test_class gehen könnte, und ich einen
vector mit pointern zu dieser Klasse erstellen kann