Hi Galik,i have one problem.You may remember the problem we were discussing here. I am pasting the code again here as you have written it.I have changed it a bit in get_example() function.
Oh my goodness. I thought you'd forgotten about this crazy scheme ;o)
Well you changed the get_example() function to return a vector of examples rather than just examples. So you need to dereference each element of that vector to get to your example:
No it stills there ;)
I am modifying it a bit further to replicate exactly what i am facing
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
template<typename Data_T>
class test
{
public:
void test_func_1(const Data_T &var)
{
std::cout << "test_func_1: " << var << std::endl;
}
void do_stuff()
{
std::vector<example<int> > test_vec_i = get_example(int());
//now here i want to access the test_func_1 function,means i want to execute it here,not directly calling it but through the vector
}
};
int main()
{
test<int> a;
a.do_stuff();
}
Would you mind saying again what exactly you want to do? I read the previous posts but didn't quite understand... :/ It would be great if you posted some pseudo-code showing how you would like things to work ideally.
You are trying to call a member function. You can only do that from an object. So either it has to be from this-> or it has to be from a variable of the right class.
Galik,i got the point . actually i wanted to declare these functions as static so that ot to make all these functions to make part of every object. But the isseu is that if i make these static i have to make lots of member variables static which doesn't make sense.
If the functions need to access the member variables then there is no benefit to making them static because you will still have to pass in an object as a parameter.