// iomanip standard header #pragma once #ifndef _IOMANIP_ #define _IOMANIP_ #include #pragma pack(push,8) #pragma warning(push,3) _STD_BEGIN // TEMPLATE STRUCT _Fillobj template struct _Fillobj { // store fill character _Fillobj(_Elem _Ch) : _Fill(_Ch) { // construct from fill character } _Elem _Fill; // the fill character }; // TEMPLATE FUNCTION setfill template inline _Fillobj<_Elem> __cdecl setfill(_Elem _Ch) { // return a _Fillobj manipulator return (_Fillobj<_Elem>(_Ch)); } template inline basic_istream<_Elem, _Traits>& __cdecl operator>>(basic_istream<_Elem, _Traits>& _Istr, const _Fillobj<_Elem>& _Manip) { // set fill character in input stream _Istr.fill(_Manip._Fill); return (_Istr); } template inline basic_ostream<_Elem, _Traits>& __cdecl operator<<(basic_ostream<_Elem, _Traits>& _Ostr, const _Fillobj<_Elem>& _Manip) { // set fill character in output stream _Ostr.fill(_Manip._Fill); return (_Ostr); } // TEMPLATE STRUCT _Smanip template struct _Smanip { // store function pointer and argument value _Smanip(void (__cdecl *_Left)(ios_base&, _Arg), _Arg _Val) : _Pfun(_Left), _Manarg(_Val) { // construct from function pointer and argument value } void (__cdecl *_Pfun)(ios_base&, _Arg); // the function pointer _Arg _Manarg; // the argument value }; template inline basic_istream<_Elem, _Traits>& __cdecl operator>>( basic_istream<_Elem, _Traits>& _Istr, const _Smanip<_Arg>& _Manip) { // extract by calling function with input stream and argument (*_Manip._Pfun)(_Istr, _Manip._Manarg); return (_Istr); } template inline basic_ostream<_Elem, _Traits>& __cdecl operator<<( basic_ostream<_Elem, _Traits>& _Ostr, const _Smanip<_Arg>& _Manip) { // insert by calling function with output stream and argument (*_Manip._Pfun)(_Ostr, _Manip._Manarg); return (_Ostr); } // INSTANTIATIONS _CRTIMP2 _Smanip __cdecl resetiosflags(ios_base::fmtflags); _CRTIMP2 _Smanip __cdecl setiosflags(ios_base::fmtflags); _CRTIMP2 _Smanip __cdecl setbase(int); _CRTIMP2 _Smanip __cdecl setprecision(streamsize); _CRTIMP2 _Smanip __cdecl setw(streamsize); _STD_END #pragma warning(pop) #pragma pack(pop) #endif /* _IOMANIP_ */ /* * Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED. * Consult your license regarding permissions and restrictions. V3.10:0009 */