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

  • Home
  • SEARCH
  • 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 8794223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:13:23+00:00 2026-06-13T23:13:23+00:00

When I was playing with std::bind from the C++11 -standard I recognized the following

  • 0

When I was playing with std::bind from the C++11-standard I recognized the following would be allowed by the compiler:

class Foo
{
public:
  void F();
  int G(int, int);
};

void Foo::F()
{
  auto f = bind(&Foo::G, this, _1, _2);
  cout << f(1,2) << endl;
}

int Foo::G(int a, int b)
{
  cout << a << ',' << b << endl;
  return 666;
}

But if I eliminated the ‘&’ in front of the Foo::G in the bind-line, I would get some compiler errors (using MinGW 4.7).

Why is Foo::G not valid as a pointer to a member function, although H and &H would both work for “usual” functions?

LG ntor

  • 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-13T23:13:24+00:00Added an answer on June 13, 2026 at 11:13 pm

    & is required to take address of a member function, some compilers will allow you to omit the same but it is non-standard and at times confusing.

    you can read about member function pointers in here:
    http://www.codeproject.com/Articles/7150/Member-Function-Pointers-and-the-Fastest-Possible

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

Sidebar

Related Questions

class Map { private: std::vector<std::string> key; std::vector<std::string> storage; int i; public: Map(); Map* set(std::string,
I've been playing around with C++0x's auto keyword and tried the following. std::unique_ptr<auto> ptr(new
The following code works fine #include <functional> using namespace std; using namespace std::placeholders; class
I'm playing around with templates. I'm not trying to reinvent the std::vector, I'm trying
While playing with standard library i've found a strange difference between python2 and python3.
Am playing with Google Maps V3 API and StyledMarkers. The data is derived from
I'm playing around new c++ standard. I write a test to observe behavior of
Possible Duplicate: Advantages of std::for_each over for loop So I was playing around with
I'm playing around with lambda functions in gcc 4.6.2, and would like to implement
I'm playing around with creating a utility class for the pimpl idiom, however 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.