Skip to content

Instantly share code, notes, and snippets.

@Cvetomird91
Created April 12, 2018 07:52
Show Gist options
  • Save Cvetomird91/c9b247e8d6ff0a753f4fc7ac4dd41447 to your computer and use it in GitHub Desktop.
Save Cvetomird91/c9b247e8d6ff0a753f4fc7ac4dd41447 to your computer and use it in GitHub Desktop.
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <boost/regex.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
int main (int argc, char** argv) {
std::vector<boost::gregorian::date> dates;
dates.push_back({2007, 1, 14});
dates.push_back({2008, 3, 28});
dates.push_back({2009, 3, 10});
dates.push_back({2007, 1, 28});
dates.push_back({2008, 3, 28});
std::sort(dates.begin(), dates.end());
std::cout << dates[0].day() << ' ' << dates[0].month() << ' ' << dates[0].year() << std::endl;
std::cout << dates[1].day() << ' ' << dates[1].month() << ' ' << dates[1].year() << std::endl;
std::cout << dates[2].day() << ' ' << dates[2].month() << ' ' << dates[2].year() << std::endl;
std::cout << dates[3].day() << ' ' << dates[3].month() << ' ' << dates[3].year() << std::endl;
std::cout << dates[4].day() << ' ' << dates[4].month() << ' ' << dates[4].year() << std::endl;
// std::cout << dates[1].month() << std::endl;
// std::cout << dates[2].month() << std::endl;
// std::cout << dates[3].month() << std::endl;
// std::cout << dates[4].month() << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment