OOC: cows, vectors, and iterators ***FIXED - CLOSED***

I'm hoping to track cows' feed consumption throughout the day by using an RFID tag and a load cell to measure difference in weight of the trough i.e. feed consumed. I use OOC (coming from Java, OOC in cpp is new to me) to create cow objects with private variables RFID and a vectorconsumption (with their total feed consumption (a float variable) push_back into the vector after each individual session i.e. time between when RFID is first detected and its absence is first detected).

The problem is that, after a feeding session, the vector consumption appears to be empty when I test it in the main loop(); but not inside my class functions. I have no idea what is going on, because I can successfully push_back to my cow object's vector consumption with a float in both the main loop() and in the class functions when I do it explicitly.

Any guidance would be much, much appreciated, I'm just banging my head on my desk at this point and am desperate for any drop of wisdom from the teats of the Arduino forum.

Serial.println(Ozwald.getConsumption().empty()); in main loop() test results in 1; whereas
Serial.println(it->getConsumption().empty()); in my class function report() test results in 0.

      total = (abs)((int)(startWeight)) - (abs)((int)(finishWeight));

What exactly is that line supposed to do? What is abs?

Returns absolute value.

Tried changing data type from float to int, still doesn't work! :confused:

uqion:
Returns absolute value.

Usually used like this

x = abs(someVariable);

Hm, well total with abs spits out the correct figure...doesn't seem to be where the problem is.

What kind of Arduino are you using? I would not imagine that your code, with all its dynamic data structures like vectors, is going to run correctly on an mcu with only 2K ram.

PaulRB:
What kind of Arduino are you using? I would not imagine that your code, with all its dynamic data structures like vectors, is going to run correctly on an mcu with only 2K ram.

Arduino Mega 2560.

What does empty() actually do? I thought empty() dumped all the data in the vector object as it's primary purpose. That it might return how much data it dumped doesn't seem to be a reason to use it.

PaulS:
What does empty() actually do? I thought empty() dumped all the data in the vector object as it's primary purpose. That it might return how much data it dumped doesn't seem to be a reason to use it.

empty() returns a boolean; checking if the vector is empty or not i.e. size zero. It does not empty its contents, I believe clear() does.