Sebastiani,
Thank you. You posted your initial reply at almost the same moment that I posted my reply to Dino. My reply was not a response to your post.
Your advice was very helpful. I did not...
Type: Posts; User: mmfuller
Sebastiani,
Thank you. You posted your initial reply at almost the same moment that I posted my reply to Dino. My reply was not a response to your post.
Your advice was very helpful. I did not...
Calling rand() with the same seed will produce the same value. Perhaps I should have stated my question better: why is the value of srand not changing when I give it different values of time?
I've used the system time to seed the std random number generator in the past, but for some reason now it is not working. This is on a Mac running OS 10.6.1, compiling with gcc 4.2.1.
#include...
Yes, using (*p) fixed it. Thank you!!
Mike
whoops, data should have been C2v! Mistake in cut and paste!
Mike
I want to dereference a vector iterator that points to a vector of class objects whose members are pointers. I'm using a compound class (class 1) whose members are pointers to another class (class...
Thanks for the recommendation.
Like many in the life sciences, I've had one semester in C++ and the rest of my education has come from reading, working with other scientists, and working in the...
Have you certain books you'd like to recommend? I've been reading the following:
Effective C++, 3rd edition, by Scott Meyers (2005)
C++ Cookbook, by D.R. Stephens, C. Diggins, J. Turkanis, and J....
Okay, thanks for everyone's advice!
Mike
Okay, I see what you mean. What if data were a member of a class? Would I need to explicitly destroy it within the class destructor? For example, would I need to include a call to the vector...
I'm learning how to code with vectors. I wrote a few lines to try out the vector destructor. I thought it was simple enough, but the code generates a runtime error that refers to memory allocation....
Ahhh, I see now! Thank you. I just joined this group. It seems very active and helpful! :)
Good idea! I'm just learning to use the STL. One thing I don't understand: why do I need to pass a vector of pointers by reference, but I don't need to pass an array of pointers by reference? For...
The vector (which will actually hold class objects, not ints as in my example) must hold a large data set, which is then processed to extract a much smaller subset. Once the subset has been extracted...
Thanks for you help!
Do you mean, the function should be like this?
void fillvec(vector<int*>& v)
I'm having trouble using a function call to assign values to an empty vector of pointers. I can use a function to assign values to an ordinary array of pointers, but when I try to do the same using a...