Unfortunately your post was edited in such a way as to hide the fact that you are not interested in a C++20 solution. The reason that this is relevant is that C++20 has a very elegant and easy to use solution. And, for pre-C++20, there exists a free, open-source, header-only preview of this part of C++20 which will work with C++11/14/17.
Here is what the solution looks like with this preview:
#include "date/date.h"
#include <iostream>
#include <vector>
int
main()
{
using namespace date;
using namespace std;
vector<sys_days> v;
for (sys_days d = 2021_y/12/12; d <= sys_days{2022_y/05/13}; d += days{1})
v.push_back(d);
for (auto d : v)
cout << d << '\n';
}
Output:
2021-12-12
2021-12-13
2021-12-14
...
2022-05-11
2022-05-12
2022-05-13
sys_days
is a std::chrono::time_point
based on system_clock
but with a precision of days. Under the hood this is nothing more than a count of days since 1970-01-01. And there exists easy conversions between this date data structure and a {year, month, day}
data structure. And there are nice printing facilities.