Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

acw83

Templated function pointer. . .

This topic is 6028 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there anyway I can do this in VC++.NET: template <class type> bool (*isGreater) (type data1, type data2); It is a function for a templated binary tree class. It it used to determine if a data memeber needs to go to the right or left. VC++.NET gives me the following error: error C2998: 'bool (__cdecl *__cdecl isGreater)(<template parameter>,<template parameter>)' : cannot be a template definition [Edit: board needs a little coaxing to show template definitions.] [edited by - Oluseyi on April 20, 2002 11:11:23 AM]

Share this post


Link to post
Share on other sites
Advertisement
Embed the function pointer type in a template class:

template <class type> class function_type
{
typedef bool (*isGreater)(type data1, type data2);
};

Then, reference via:

function_type<type_goes_here>::isGreater func= blah;

MSN

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!