Lecture overview -- Keyboard shortcut: 'u'  Previous page: Manipulators -- Keyboard shortcut: 'p'  Next page: Logical program organization -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 2 - Page 36 : 42
Notes about C++
Basic facilities
More manipulators

Manipulators can be with or without arguments

  • Manipulators without arguments

    • The manipulator is a pointer to function

    • Handled by an operator overload of operator<< in class basis_ostream

      • basis_ostream operator<<(basis_ostream& (*f)(basis_ostream&)){return f(*this)}

  • Manipulators with arguments

    • The manipulator m(a) returns an struct that aggregates a function pointer and the argument a

    • An overload of << activates the function on the argument before it returns the stream

    • Interesting details on page 633

y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/io/manipulators-2.ccIllustration of more manipulators.


y:/Kurt/Files/Advanced-programming-cpp/cpp/kn/io/manipulators-2-outputProgram output.