Thanks for your replies.
I have just finished watching a video regarding regex, which is the following, for reference: http://www.youtube.com/watch?v=mUZL-PRWMeg
I feel it helped greatly in acquiring some footing in this confusing domain of grammar scanning and manipulation, however I don't know the exact syntax in detail so your regex is still a bit hazy for me, would appreciate if you could explain your regex logic.
It appears this whole regex thing is rather otherworldly especially with the replace or format. One cool thing I find useful is the to_int(results[n]);. It takes the whole option to a whole other level. I can not only rewrite them in a neater, and more compact format but also work directly with them.
I apologize for the rather foggy examples of mine. In truth I don't really want to separate the times in multiple sections (that was just my way of calculating data which falls within 2 separate work days)
Essentially your program calculated the full circle. What I didn't mention which is to come later is that the times calculated must persist to a work day (7:45 to 17:15) and anything outside that duration is omitted. Additionally a holiday is never calculated, which is something I will have to provide the program with myself since holidays in my country are not set in stone, year by year.
So essentially, retaking:
Mon 26-Nov-2012 12:50 Tue 27-Nov-2012 15:29
I have to calculate mon 12:50 to 17:15 and Tue 7:45 to 15:29 and add them up together ( I may have made a mistake in my original calculation btw ).
These times will eventually also become variable, based on some parameters entered by the user in the initial line of '=====' but that's for later.
Right now I need to be able to read and calculate times within the 7:45 to 17:15 range during weekdays only (not weekends, nor holidays [although we can omit that for now as you mentioned]).
Your program sample appears to work, although once again I don't really want to print the whole instance thing and such, I was rather hoping to insert the times in the same text file, or clone it to a new one while updating the data.
I'd rather avoid Console output except for debugging purposes. I would prefer to make the user use only text files which can be easily used as evidence for results as opposed to a program (for security reasons).
Most importantly however, could you please explain the following lines in your code:
void print_results(std::vector<bpt::time_duration>& durs, unsigned int instance) // What's the intention of each argument?
std::accumulate(durs.begin(), durs.end(), bpt::time_duration()) // No idea what's happening here
bpt::time_facet // What's the use of time_facet? What does it do, roughly?
std::cout.imbue(std::locale(std::cout.getloc(), df)); // Once again no idea what cout.imbue does
bpt::ptime t1, t2; // Is this a variable declaration or not? Since directly below it:
if(buf >> t1 >> t2) // You used what appear to be 2 freshly declared variables in an if condition.
Sorry for not being able to fully follow what happened in there, a lot of these things I've never heard of, and I've never worked with Boost either.
Regardless, you've all been extremely helpful thus far, I genuinely appreciate your support and effort with writing code to explain this task better!