#include <ios>
#include <ostream>
+#if __cplusplus > 202302L
+#include <concepts>
+#endif
+
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
* is extracted); note that this condition will never occur if
* @a __delim equals @c traits::eof().
*
- * NB: Provide three overloads, instead of the single function
+ * NB: Provide four overloads, instead of the single function
* (with defaults) mandated by the Standard: this leads to a
* better performing implementation, while still conforming to
* the Standard.
__istream_type&
ignore();
+#if __cplusplus > 202302L
+ __istream_type&
+ ignore(streamsize __n, char __delim) requires same_as<_CharT, char>
+ { return ignore(__n, traits_type::to_int_type(__delim)); }
+#endif
+
/**
* @brief Looking ahead in the stream
* @return The next character, or eof().
--- /dev/null
+// { dg-do run { target c++26 } }
+
+#include <istream>
+#include <sstream>
+#include <string>
+#include <testsuite_hooks.h>
+
+void test01() {
+ std::istringstream in("\xF0\x9F\xA4\xA1 Clown Face");
+ in.ignore(100, '\xA1');
+ VERIFY(in.gcount() == 4);
+ VERIFY(in.peek() == ' ');
+
+ std::string str;
+ in >> str;
+ VERIFY(str == "Clown");
+}
+
+int main() {
+ test01();
+ return 0;
+}
VERIFY( in.gcount() == 3 );
VERIFY( ! in.eof() );
- // This only works if char is unsigned.
+ // Prior to C++26 (P3223R2), this only works if char is unsigned.
in.ignore(100, '\xfe');
- if (std::numeric_limits<char>::is_signed)
+ if (std::numeric_limits<char>::is_signed && __cplusplus <= 202302L)
{
// When char is signed, '\xfe' != traits_type::to_int_type('\xfe')
// so the delimiter does not match the character in the input sequence,
VERIFY( in.gcount() == 3 );
VERIFY( ! in.eof() );
- // This only works if char is unsigned.
+ // Prior to C++26 (P3223R2), this only works if char is unsigned.
in.ignore(100, '\xfe');
- if (std::numeric_limits<char>::is_signed)
+ if (std::numeric_limits<char>::is_signed && __cplusplus <= 202302L)
{
// When char is signed, '\xfe' != traits_type::to_int_type('\xfe')
// so the delimiter does not match the character in the input sequence,