Getting current date from clock
-
03-06-2021 - |
Domanda
I am doing this
boost::gregorian::date current_date(boost::date_time::day_clock::local_day());
and I get the following error
‘template<class date_type> class boost::date_time::day_clock’ used without template parameters
Anything that I have to do different ?
reference http://www.boost.org/doc/libs/1_47_0/doc/html/date_time/gregorian.html#date_construct_from_clock
Soluzione
You're using the wrong day_clock
– use this instead:
boost::gregorian::date current_date(boost::gregorian::day_clock::local_day());
day_clock
in boost::date_time
is a generic interface (template in this case) meant to be used with an externally supplied 'date' type, and you're not supplying that type. day_clock
in boost::gregorian
is a typedef of said interface using boost::gregorian::date
as the supplied 'date' type.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow