Skip to content

LWG-1203 More useful rvalue stream insertion #538

@StephanTLavavej

Description

@StephanTLavavej

LWG-1203 More useful rvalue stream insertion

This was mostly implemented in VS 2017 15.8. However, we used is_base_of which doesn't match the "publicly and unambiguously derived" wording in LWG-1203. (See [meta.rel]: "[Note: Base classes that are private, protected, or ambiguous are, nonetheless, base classes.—end note]")

STL/stl/inc/istream

Lines 879 to 886 in e034296

template <class _Istr, class _Ty,
enable_if_t<conjunction_v< // avoid infinite recursion
negation<is_lvalue_reference<_Istr>>, is_base_of<ios_base, _Istr>, _Can_stream_in<_Istr, _Ty>>,
int> = 0>
_Istr&& operator>>(_Istr&& _Is, _Ty&& _Val) { // extract from rvalue stream
_Is >> _STD forward<_Ty>(_Val);
return _STD move(_Is);
}

STL/stl/inc/ostream

Lines 969 to 976 in e034296

template <class _Ostr, class _Ty,
enable_if_t<conjunction_v< // prevent infinite recursion
negation<is_lvalue_reference<_Ostr>>, is_base_of<ios_base, _Ostr>, _Can_stream_out<_Ostr, _Ty>>,
int> = 0>
_Ostr&& operator<<(_Ostr&& _Os, const _Ty& _Val) { // insert to rvalue stream
_Os << _Val;
return _STD move(_Os);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    LWGLibrary Working Group issuefixedSomething works now, yay!

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions