From 148c288942ec912f1533cf1ba3148ca62f819e8d Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:22:21 +0100 Subject: [PATCH] Add extract char operator to istream --- include/opp/iostream.cpp | 7 +++++++ include/opp/iostream.h | 1 + 2 files changed, 8 insertions(+) diff --git a/include/opp/iostream.cpp b/include/opp/iostream.cpp index d853de8..ea12be1 100644 --- a/include/opp/iostream.cpp +++ b/include/opp/iostream.cpp @@ -952,6 +952,13 @@ istream & istream::operator>>(float & val) return *this; } +istream & istream::operator>>(char & val) +{ + doskipws(); + val = get(); + return *this; +} + istream & istream::operator>>(char * p) { doskipws(); diff --git a/include/opp/iostream.h b/include/opp/iostream.h index f42d1e5..9dc3639 100644 --- a/include/opp/iostream.h +++ b/include/opp/iostream.h @@ -124,6 +124,7 @@ public: istream & putback(char c); istream & unget(void); + istream & operator>>(char & val); istream & operator>>(bool & val); istream & operator>>(int & val); istream & operator>>(unsigned & val);