Last active
October 17, 2020 15:44
-
-
Save ifknot/1c33a1efbfd5b36168d472ea38dba3cd to your computer and use it in GitHub Desktop.
r-ish date type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <string> | |
#include <ctime> | |
#include <ostream> | |
namespace R { | |
/** | |
* An R-ish calender date type | |
* This is the type to use if you have only dates, but no times, in your data. | |
* Default format is "%Y-%m-%d" e.g. 2020 - 09 - 30 | |
* functions: as_dates, diffdates, +, -, etc | |
*/ | |
struct r_date { | |
std::tm tm{}; | |
std::string format{}; | |
}; | |
} | |
std::ostream& operator<<(std::ostream& os, const R::r_date& date); | |
bool operator == (const R::r_date& lhs, const R::r_date& rhs); | |
bool operator < (const R::r_date& lhs, const R::r_date& rhs); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment