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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:43:35+00:00 2026-06-01T01:43:35+00:00

I am reading the chapter function templates of C++ Primer 3rd edition , and

  • 0

I am reading the chapter “function templates” of C++ Primer 3rd edition, and when I tried to follow the example, I found the code almost the same as the book has encountered an error during compilation under VC6 but everything is ok under g++. I don’t know why?

Here is the code:

#include <iostream>
using namespace std;

template<typename T1, typename T2, typename T3>
T1 my_min(T2 a, T3 b)
{
    return a>b?b:a;
}

int main()
{
    int (*fp)(int, int) = &my_min<int>;
    cout<<fp(3,5)<<endl;
    return 0;
}

The error happened under VC6 appears like:

error C2440: 'initializing' : cannot convert from '' to 'int (__cdecl *)(int,int)'
None of the functions with this name in scope match the target type
  • 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-01T01:43:36+00:00Added an answer on June 1, 2026 at 1:43 am

    VC6 is an ancient compiler whose support for templates is woefully lacking, so it cannot cope with legal code in many circumstances. You should ditch it and download VS 2010 Express instead.

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

Sidebar

Related Questions

I was reading the example chapter from the book by Ayende and on the
I'm reading the Monads chapter in Real World Haskell (chapter 14). A function is
I'm reading the book on Domain Driven Design of Eric Evans - Chapter 5
I am reading the book Think Python by Allen Downey. For chapter 4, one
I just finished reading the Functions chapter from Uncle Bob's Clean Code . The
I am reading through LYAH, and in Chapter 9, I found a curious problem.
I am reading the book -- Hadoop: The Definitive Guide In chapter 2 (Page
I am reading the book Javascript: The good parts. Now I am reading chapter
I am reading the real world haskell Chapter 9. There is a maybeIO function
I was reading this morning the book The Pragmatic Programmer Chapter 3 on Basic

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.