I have a member function of class SparceMatrixStruct which should return a vector.

I have a member function of class SparceMatrixStruct which should return a vector.
std::vector<size_t>SparceMatrixStruct::col_ind(VecVecIdx_t &refined_node_connec)
{
for (int i = 0; i < refined_node_connec.size(); i++)
{

Ncol_ind_ += refined_node_connec[i].size();

}

std::vector<size_t>col_ind_;

for (int i = 0; i < refined_node_connec.size(); i++) {

for (int j = 0; j < refined_node_connec[i].size(); j++) {

col_ind_.push_back(refined_node_connec[i][j]);
}
}

for (int i = 0; i < Ncol_ind_; i++)
{
//std::cout << col_ind_[i] << "\n";
}

return col_ind_;
}

in the main I define,
VecIdx_t col_ind;
SparceMatrixStruct object;
col_ind=object.col_ind_;

and I am getting nothing. I really have problem in accessing data member. Even when I want to print the size of col_ind I get zero. but if in the class constructor I put print command everything is fine. This member function will be called in the constructor and refined_node_connec will be obtained in the constructor. any help would be appreciated.
> col_ind=object.col_ind_;
1. Make your member variables private, so you know you're doing it wrong.

2. Call the function, not examine the interval variable.
 
col_ind=object.col_ind(someSuitableParameterOfTypeVecVecIdx_t);

Topic archived. No new replies allowed.