Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8030591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:49:14+00:00 2026-06-05T00:49:14+00:00

How does the c++ standard define the recognition of manipulators or just manipulators in

  • 0

How does the c++ standard define the recognition of manipulators or just manipulators in general?

For example:

using namespace std;
ostream& hello_manip(ostream& os){
  os<<"Hello there, fine fellow!"; return os;
}
int main(){
  cout<<hello_manip;
} 

The code cout << hello_manip would seem to be translated into operator<<( cout, hello_manip ) or cout.operator<<(hello_manip), but instead it takes up the form of hello_manip( cout ).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:49:16+00:00Added an answer on June 5, 2026 at 12:49 am

    There’s an overload of operator<< that accepts a function pointer and invokes it. No magic involved.

    Processing of simple manipulators such as yours is described in section 27.7.3.6.3 of the Standard.

    basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& (*pf) basic_ostream<charT,traits>&))

    1. Effects: None. Does not behave as a formatted output function (as described in 27.7.3.6.1).
    2. Returns: pf(*this).

    basic_ostream<charT,traits>& operator<<(basic_ios<charT,traits>& (*pf) basic_ios<charT,traits>&))

    1. Effects: Calls pf(*this). This inserter does not behave as a formatted output function (as described in 27.7.3.6.1).
    2. Returns: *this.

    basic_ostream<charT,traits>& operator<<(ios_base& (*pf)(ios_base&))

    1. Effects: Calls pf(*this). This inserter does not behave as a formatted output function (as described in 27.7.3.6.1).
    2. Returns: *this.

    More complex manipulators (which accept parameters and carry state) are implemented by returning functor objects, which have their own operator<< overloads.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why does the Standard define end() as one past the end, instead of at
Why DataSource interface does not define the Standard Data Source Properties specified by the
In the C++11 standard, section 1.10/5 mentions, but does not formally define the terms
Does the C++ Standard Library define this function, or do I have to resort
Does the HTTP standard or something define which encoding should be used on special
Does the standard define precisely what I can do with an object once it
Does the standard define what happens with this code? #include <iostream> template <typename Func>
What does standard specify about indexing sequence with Attr objects inside NamedNodeMap object? I
Does the standard guarantee that order of equal elements will not change (eh, forgot
The standard RadioButton does not support setting the color of the ellipse. So, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.