Issue 352: missing fpos requirements (original) (raw)
This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.
352. missing fpos requirements
Section: 27.2.3 [char.traits.typedefs] Status: CD1 Submitter: Martin Sebor Opened: 2001-12-02 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [char.traits.typedefs].
View all issues with CD1 status.
Discussion:
_(1)_There are no requirements on the stateT template parameter offpos listed in 27.4.3. The interface appears to require that the type be at least Assignable and CopyConstructible (27.4.3.1, p1), and I think also DefaultConstructible (to implement the operations in Table 88).
21.1.2, p3, however, only requires thatchar_traits<charT>::state_type meet the requirements of CopyConstructible types.
_(2)_Additionally, the stateT template argument has no corresponding typedef in fpos which might make it difficult to use in generic code.
Proposed resolution:
Modify 21.1.2, p4 from
Requires: state_type shall meet the requirements of CopyConstructible types (20.1.3).
Requires: state_type shall meet the requirements of Assignable (23.1, p4), CopyConstructible (20.1.3), and DefaultConstructible (20.1.4) types.
Rationale:
The LWG feels this is two issues, as indicated above. The first is a defect---std::basic_fstream is unimplementable without these additional requirements---and the proposed resolution fixes it. The second is questionable; who would use that typedef? The class template fpos is used only in a very few places, all of which know the state type already. Unless motivation is provided, the second should be considered NAD.