• Advertisement

Archived

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

Templated function pointer. . .

This topic is 5849 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