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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:49:57+00:00 2026-06-15T05:49:57+00:00

I went about with the following code to detect the long argument to a

  • 0

I went about with the following code to detect the long argument to a given function.

So, given:

int f(int *) { return 0; }

I want to extract int *.

Here is my attempt:

template<class T, class U> struct SingleArg {
    typedef U MyArg;
};

template<class T, class U> SingleArg<T, U> fT(T (*p)(U));

int main() {
    std::result_of<decltype(fT(f))>::type::MyArg t;
}

This however does not work and gcc 4.6 gives error

> error: std::result_of<SingleArg<int, int*> >::type has not been
> declared

So, I have two questions:

a) What’s wrong with the above code?

b) Is it possible to do this in any other way/ways?

  • 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-15T05:49:58+00:00Added an answer on June 15, 2026 at 5:49 am
    int f(int *) { return 0; }
    
    template<class T, class U> struct SingleArg {
        typedef U MyArg;
    };
    
    
    template<typename T> 
    struct the_same_type
    {
     typedef T type;   
    };
    
    template<class T, class U> SingleArg<T, U> fT(T (*p)(U));
    
    int main() {
    
        int k;
        the_same_type<decltype(fT(f))>::type::MyArg t= &k;
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I went to Twitter's resource page here (https://twitter.com/about/resources/tweetbutton) and got the following code: <a
When I click a link which calls following function...I get Something went wrong. We're
Say you have the following piece of code: function someProcess() { var deferred =
I want to display the image before uploading.I tried the following code but it
This is how I went about, to display a Boolean model field in the
I went through couple of articles that talk about Web Workers in HTML5 and
Ok, So about a year ago (I think) google went through a transition where
I went as far as searching C sources, but I can't find this function,
Not sure where I might have went wrong the code seems fine to me,
I am now running my code on a web hosting service http://xtreemhost.com/ <?php function

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.