Title
Confusing typo in specification for get_time
Status
c++11
Section
[ext.manip]
Submitter
Alisdair Meredith

Created on 2009-12-25.00:00:00 last changed 161 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change [ext.manip] p8:

template <class charT, class traits>
void f(basic_ios<charT, traits>& str, struct tm* tmb, const charT* fmt) {
   typedef istreambuf_iterator<charT, traits> Iter;
   typedef time_get<charT, Iter> TimeGet;

   ios_base::iostate err = ios_base::goodbit;
   const TimeGet& tg = use_facet<TimeGet>(str.getloc());

   tgm.get(Iter(str.rdbuf()), Iter(), str, err, tmb, fmt, fmt + traits::length(fmt));

   if (err != ios_base::goodbit)
       str.setstate(err):
}
Date: 2010-01-14.00:00:00

[ 2010-01-14 Moved to Tentatively Ready after 5 positive votes on c++std-lib. ]

Date: 2009-12-25.00:00:00

Extended Manipulators [ext.manip] p8 defines the semantics of get_time in terms of a function f.

template <class charT, class traits>
void f(basic_ios<charT, traits>& str, struct tm* tmb, const charT* fmt) {
   typedef istreambuf_iterator<charT, traits> Iter;
   typedef time_get<charT, Iter> TimeGet;

   ios_base::iostate err = ios_base::goodbit;
   const TimeGet& tg = use_facet<TimeGet>(str.getloc());

   tm.get(Iter(str.rdbuf()), Iter(), str, err, tmb, fmt, fmt + traits::length(fmt));

   if (err != ios_base::goodbit)
       str.setstate(err):
}

Note the call to tm.get. This is clearly an error, as tm is a type and not an object. I believe this should be tg.get, rather than tm, but this is not my area of expertise.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg1496
2010-10-21 18:28:33adminsetmessages: + msg1495
2009-12-25 00:00:00admincreate