This example uses the date library without any using namespace
:
#include <iostream>
#include <date/date.h>
//using namespace std;
//using namespace date;
int main() {
date::year_month_day startDate = 2018_y / 1 / 6;
std::cout << startDate << '\n';
return 0;
}
but does not compile, error: unable to find numeric literal operator 'operator""_y'
How to use this library without using namespace
?
UPDATE:
I changed the code as follows, but there are still many errors.
#include <iostream>
#include <date/date.h>
int main() {
date::sys_time<std::chrono::nanoseconds> tp;
std::istringstream in1{"2018-12-21 01:15:31"};
in1 >> date::parse("%F %T", td);
std::cout << tp << '\n';
return 0;
}
error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream'} and 'date::sys_time ...