What is the extraction operators in C plus plus?

1 answer

Answer

1161508

2026-04-25 12:40

+ Follow

This operator (>>) applied to an input stream is known as extraction operator. It performs an input operation on a stream generally involving some sort of interpretation of the data (like translating a sequence of numerical characters to a value of a given numerical type).

Three groups of member functions and one group of global functions overload this "extraction operator" (>>) applied to istream objects:

  • The first group of member functions are arithmetic extractors. These read characters from the input data, and parse them to interpret them as a value of the specific type of its parameter. The resulting value is stored in the variable passed as parameter.
  • The streambuf version copies as many characters as possible to the stream buffer object used as right-hand parameter, either until an error happens or until there are no more characters to copy.
  • Those in the last group of member functions have a pointer to a function as parameter. These are designed to be used with manipulator functions.

    Manipulator functions are functions specifically designed to be easily used with this operator.

  • The global functions overload the operator when the parameter is either a character or a c-string, and, as expected they extract either one character or a sequence of characters from the input stream.
ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.