Skip to content

Commit

Permalink
remove operator>> for istream >> setfill(c) (#3725)
Browse files Browse the repository at this point in the history
Co-authored-by: Stephan T. Lavavej <[email protected]>
  • Loading branch information
fsb4000 and StephanTLavavej authored May 30, 2023
1 parent 29fccab commit 349279f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
9 changes: 0 additions & 9 deletions stl/inc/iomanip
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ template <class _Elem>
struct _Fillobj { // store fill character
_Fillobj(_Elem _Ch) : _Fill(_Ch) {}

template <class _Elem2, class _Traits>
friend basic_istream<_Elem2, _Traits>& operator>>(basic_istream<_Elem2, _Traits>& _Istr, const _Fillobj& _Manip) {
// set fill character in input stream
static_assert(is_same_v<_Elem, _Elem2>, "wrong character type for setfill");

_Istr.fill(_Manip._Fill);
return _Istr;
}

template <class _Elem2, class _Traits>
friend basic_ostream<_Elem2, _Traits>& operator<<(basic_ostream<_Elem2, _Traits>& _Ostr, const _Fillobj& _Manip) {
// set fill character in output stream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,18 +571,24 @@ void future_test() {
}
#endif // _M_CEE_PURE

template <typename IoManipIn, typename IoManipOut>
void iomanip_test_impl(IoManipIn in, IoManipOut out) {
template <typename IoManipOut, typename IoManipIn>
void iomanip_test_impl(IoManipOut out, IoManipIn in) {
stringstream ss{};
ss << in;
ss >> out;
ss << out;
ss >> in;
}

template <typename IoManip>
void iomanip_test_impl(IoManip iom) {
iomanip_test_impl(iom, iom);
}

template <typename IoManip>
void iomanip_test_impl_for_setfill(IoManip out) {
stringstream ss{};
ss << out;
}

void iomanip_test() {
auto sf = setfill('*');
long double money = 123.45;
Expand All @@ -591,7 +597,7 @@ void iomanip_test() {
localtime_s(&time, &t);
string str = "string with \" quotes ";

iomanip_test_impl(sf);
iomanip_test_impl_for_setfill(sf);
iomanip_test_impl(put_money(money), get_money(money));
iomanip_test_impl(put_time(&time, "%c %Z"), get_time(&time, "%c %Z"));
iomanip_test_impl(quoted(str.c_str()), quoted(str));
Expand Down

0 comments on commit 349279f

Please sign in to comment.