1299. Confusing typo in specification for get_time

Section: 30.7.7 [ext.manip] Status: C++11 Submitter: Alisdair Meredith Opened: 2009-12-25 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [ext.manip].

View all issues with C++11 status.

Discussion:

Extended Manipulators 30.7.7 [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.

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

Proposed resolution:

Change 30.7.7 [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):
}