Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions stl/inc/istream
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,11 @@ public:
return *this;
}

template <class _CharType = _Elem, enable_if_t<is_same_v<_CharType, char>, int> = 0>
basic_istream& ignore(const streamsize _Count, const _Elem _Delim) {
return ignore(_Count, _Traits::to_int_type(_Delim));
}

basic_istream& __CLR_OR_THIS_CALL read(_Elem* _Str, streamsize _Count) { // read up to _Count characters into buffer
ios_base::iostate _State = ios_base::goodbit;
_Chcount = 0;
Expand Down
1 change: 1 addition & 0 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
// (__cpp_lib_freestanding_algorithm and __cpp_lib_freestanding_array only)
// P2937R0 Freestanding Library: Remove strtok
// P2968R2 Make std::ignore A First-Class Object
// P3223R2 Making istream::ignore() Less Surprising
// P3323R1 Forbid atomic<cv T>, Specify atomic_ref<cv T>
// (for atomic<cv T>)

Expand Down
13 changes: 13 additions & 0 deletions tests/std/tests/VSO_0000000_nullptr_stream_out/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,17 @@ int main() {
STATIC_ASSERT(OstreamInsertable<PublicOstream, int>);
STATIC_ASSERT(OstreamInsertable<PrivateOstream&, int>);
STATIC_ASSERT(!OstreamInsertable<PrivateOstream, int>);

{ // Test P3223R2 "Making std::istream::ignore Less Surprising"
istringstream in{"\xF0\x9F\xA4\xA1 Clown Face"};
decltype(auto) ret = in.ignore(100, '\xA1');

STATIC_ASSERT(is_same_v<decltype(ret), istream&>);
assert(&ret == &static_cast<istream&>(in));
assert(in.gcount() == 4);

string s;
in >> s;
assert(s == "Clown");
}
}