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 8175295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:43:31+00:00 2026-06-06T22:43:31+00:00

Here is well described how to call member function by pointer: http://www.newty.de/fpt/functor.html But the

  • 0

Here is well described how to call member function by pointer:
http://www.newty.de/fpt/functor.html

But the functor needs to get 2 arguments: pointer-to-object and pointer-to-member-function:

TSpecificFunctor(TClass* _pt2Object, void(TClass::*_fpt)(const char*))
{ pt2Object = _pt2Object;  fpt=_fpt; }

call:

(*pt2Object.*fpt)(string);

Is it possible to pass single argument like C-style:

func() -- call
func -- function pointer

Why obj.method isn’t complete pointer-to-class-member?

  • 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-06T22:43:32+00:00Added an answer on June 6, 2026 at 10:43 pm

    The syntax object.*ptmf doesn’t create an intermediate object. It has no meaning and is forbidden by the language. You have to immediately call the result of accessing a pointer to member function.

    You can explicitly create such an object using std::bind, which interprets the ptmf as a functor object, and makes the implicit this argument explicit.

    auto fn = std::bind( ptmf, object, std::placeholders::_1 );
    std::function< void( const char * ) > stdfn = fn;
    fn( "foo" ); // equivalent to object.*ptmf( "foo" );
    

    http://ideone.com/ds24F

    Note that this functionality is new in C++11. Although C++03 TR1 has function and bind, they won’t perform this conversion on a ptmf. (Plain C++03 can do the job with std::mem_fn and std::bind1st, but they are extremely painful to use and have been deprecated.)

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

Sidebar

Related Questions

I hope i described the problem well!? You can see it here: http://dealmob.de/index_dev.html when
As seen here and some other places for each is well explained, but how
I am aware of formatted DataContract names, as described here: http://msdn.microsoft.com/en-us/library/ms731045.aspx (Customizing Data Contract
i found this site: here its very well described why it works and why
I'm trying to do a nested repeater as described here but it's erroring out.
I'm trying to do something similar to what's described here, but with nullable types.
The issue described here was encountered on 3.0 as well as 3.1 on an
Title should make my problem well described.Here goes my code. <div id=adiv><text>Some text</text></div> <script
You can see the full problem here: http://users.cjb.net/syn4k/test.htm I have described the problem in
Extreme Android developer newbie here...well, new to Android development, not development in general. 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.