Click here to Skip to main content
15,916,019 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: open txt file form web or ftp ? Pin
Hristo-Bojilov23-May-10 4:59
Hristo-Bojilov23-May-10 4:59 
QuestionRelease IGraphBuilder interface in directshow problem Pin
raj157622-May-10 0:25
raj157622-May-10 0:25 
AnswerRe: Release IGraphBuilder interface in directshow problem Pin
norish22-May-10 9:09
norish22-May-10 9:09 
QuestionChange Event of excel Pin
trioum21-May-10 23:55
trioum21-May-10 23:55 
GeneralRe: Change Event of excel Pin
norish22-May-10 9:14
norish22-May-10 9:14 
QuestionGDI+ JPEG to binary Pin
hxhl9521-May-10 17:30
hxhl9521-May-10 17:30 
AnswerRe: GDI+ JPEG to binary Pin
hxhl9521-May-10 18:27
hxhl9521-May-10 18:27 
GeneralRe: GDI+ JPEG to binary Pin
Alain Rist21-May-10 20:21
Alain Rist21-May-10 20:21 
GeneralRe: GDI+ JPEG to binary [modified] Pin
hxhl9522-May-10 6:34
hxhl9522-May-10 6:34 
QuestionAbout loadlibrary problem. [modified] Pin
wangningyu21-May-10 16:25
wangningyu21-May-10 16:25 
AnswerRe: About loadlibrary problem. Pin
Aescleal21-May-10 19:33
Aescleal21-May-10 19:33 
AnswerRe: About loadlibrary problem. Pin
Richard MacCutchan21-May-10 21:35
mveRichard MacCutchan21-May-10 21:35 
AnswerRe: About loadlibrary problem. Pin
norish21-May-10 23:21
norish21-May-10 23:21 
QuestionHow to check if 2 network shares are the same folder. Pin
Green Fuze21-May-10 11:57
Green Fuze21-May-10 11:57 
QuestionRe: How to check if 2 network shares are the same folder. Pin
David Crow21-May-10 17:28
David Crow21-May-10 17:28 
AnswerRe: How to check if 2 network shares are the same folder. Pin
Green Fuze22-May-10 2:39
Green Fuze22-May-10 2:39 
QuestionPage layout in word Pin
mamcp21-May-10 10:08
mamcp21-May-10 10:08 
QuestionStatusBar? [modified] Pin
Software200721-May-10 9:34
Software200721-May-10 9:34 
AnswerRe: StatusBar? Pin
Richard MacCutchan21-May-10 21:39
mveRichard MacCutchan21-May-10 21:39 
QuestionIterator gives error Pin
b-rad31121-May-10 9:28
b-rad31121-May-10 9:28 
AnswerRe: Iterator gives error Pin
Nemanja Trifunovic21-May-10 9:53
Nemanja Trifunovic21-May-10 9:53 
GeneralRe: Iterator gives error Pin
b-rad31121-May-10 9:55
b-rad31121-May-10 9:55 
Questioneliminate zeros in vector of vectors [modified] Pin
b-rad31121-May-10 6:37
b-rad31121-May-10 6:37 
Hi everyone,

I'm using a vector of vectors to mimic a matrix using the following:
vector < vector <long double> > data_matrix;


I then add "rows" using the following:
for (int z=0;z<13;z++)
   data_matrix.push_back(vector <long double>());


Next, I load the appropriate values (from an input file) into the vector of vectors (some the values will be zeroes).

What I'd like to do, is to search a particular "column" for zeroes and eliminate them in that column as well as the corresponding entries in the adjacent columns (so in effect, eliminate an entire row). I've figured out how to delete zeros from any given vector in the vector of vectors using:

bool IsEven (double d)  
{  
  return (d) == 0;  
} 

data_matrix[0].erase(std::remove_if(data_matrix[0].begin(),data_matrix[0].end(),IsEven), data_matrix[0].end());  


Does anyone know how to do this Confused | :confused:

The number of entries in each of the columns are the same.

Thanks!

modified on Friday, May 21, 2010 12:43 PM

GeneralRe: eliminate zeros in vector of vectors Pin
Aescleal21-May-10 7:35
Aescleal21-May-10 7:35 
GeneralRe: eliminate zeros in vector of vectors Pin
b-rad31121-May-10 7:48
b-rad31121-May-10 7:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.