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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:22:52+00:00 2026-06-10T13:22:52+00:00

I am trying to defining a specific function pointer type to be used in

  • 0

I am trying to defining a specific function pointer type to be used in my calls of boost::bind to resolve issue related to function overloaded not recognized ( by calling static_cast ). I am defining that typedef explicitly for resolving ambiguity on std::string::compare.

When I write this function I got errors.

   typedef int(std::string* resolve_type)(const char*)const;

Do you know what’s wrong with this typedef?

  • 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-10T13:22:53+00:00Added an answer on June 10, 2026 at 1:22 pm

    I think you want this.

    typedef int(std::string::*resolve_type)(const char*) const;
    

    Example.

    #include <iostream>
    #include <functional>
    
    typedef int(std::string::*resolve_type)(const char*)const;
    
    int main()
    {
       resolve_type resolver = &std::string::compare;
       std::string s = "hello";
       std::cout << (s.*resolver)("hello") << std::endl;
    }
    

    http://liveworkspace.org/code/4971076ed8ee19f2fdcabfc04f4883f8

    And example with bind

    #include <iostream>
    #include <functional>
    
    typedef int(std::string::*resolve_type)(const char*)const;
    
    int main()
    {
       resolve_type resolver = &std::string::compare;
       std::string s = "hello";
       auto f = std::bind(resolver, s, std::placeholders::_1);
       std::cout << f("hello") << std::endl;
    }
    

    http://liveworkspace.org/code/ff1168db42ff5b45042a0675d59769c0

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

Sidebar

Related Questions

I'm defining a function in PowerShell and trying to call it as shown below.
I'm trying to create a Macro function for defining function pointers , functions etc.
I'm trying to create a threadpool with the boost threadpool library, but on defining
I am trying to get jquery to pick up variable that I am defining
Trying to build out an exception if move.UserId does not equal currentUserId then Redirect
I've been trying to create a directory following a specific structure, yet nothing appears
I'm learning metaprogramming in Ruby and am just trying out defining missing methods via
I am defining a stream in terms of itself (a recursive definition). When trying
I am trying to figure out how to find numbers that are not years
I'm trying to learn proper way of defining classes. I have two classes where

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.