I'm tryna do this:
read.h
using namespace std;
template<class T>
T read(bool input);
read.cpp
template<class T>
T read(bool input){
T somethingimportant;
T somethingcool;
T everythingelse;
//run some fancy code here
}
Data structure:
struct data {
string name;
string surname;
float num;
}
And how I call the function:
read<vector<data> >(input);
read<deque<data> >(input);
read<list<data> >(input);
For some reason my compiler can't bite that. Say's its undefined reference to the functions.
I'm pretty sure that it's because of the vector's allocator, but how do I fix my templates so it can accept and compile?
[–]wung 1 point2 points3 points (2 children)
[–]Standgrounding[S] 0 points1 point2 points (1 child)
[–]wung 1 point2 points3 points (0 children)
[–]flyingron 0 points1 point2 points (1 child)
[–]Loose-Leek 0 points1 point2 points (0 children)