typedef'ing Function Pointers



 DEVELOP > c-Plus-Plus > typedef'ing Function Pointers

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "James Aguilar"
Date: 26 Mar 2005 08:28:10 PM
Object: typedef'ing Function Pointers
Hey all,
Another creative question: is it possible to do something like this to type
define a pointer to a specific type of function:
typedef bool (*)(std::string::const_iterator,
std::string::const_iterator) ItCompare;
And if so, how? The above example does not work, btw, I'm just wondering if
there is a way.
- JFA1
.

User: "James Aguilar"

Title: Re: typedef'ing Function Pointers (Solved) 26 Mar 2005 08:36:32 PM
"James Aguilar" <jfa1@cec.wustl.edu> wrote in message
news:d255nq$h0d$1@newsreader.wustl.edu...

Hey all,

Another creative question: is it possible to do something like this to
type define a pointer to a specific type of function:

typedef bool (*)(std::string::const_iterator,
std::string::const_iterator) ItCompare;

And if so, how? The above example does not work, btw, I'm just wondering
if there is a way.

I solved this one on my own just after asking. For those who want to know,
the syntax is like this:
typedef bool (*ItCompare)(std::string::const_iterator,
std::string::const_iterator);
.

User: "Ioannis Vranos"

Title: Re: typedef'ing Function Pointers 26 Mar 2005 08:38:02 PM
James Aguilar wrote:

Hey all,

Another creative question: is it possible to do something like this to type
define a pointer to a specific type of function:

typedef bool (*)(std::string::const_iterator,
std::string::const_iterator) ItCompare;

And if so, how? The above example does not work, btw, I'm just wondering if
there is a way.

As with other typedefs for pointers to functions, the new type alias
should be together with the *:
typedef bool (*ItCompare)(std::string::const_iterator,
std::string::const_iterator);
--
Ioannis Vranos
http://www23.brinkster.com/noicys
.

User: "Yuriy Solodkyy"

Title: Re: typedef'ing Function Pointers 26 Mar 2005 08:32:50 PM
Try
typedef bool (*ItCompare)
(
std::string::const_iterator,
std::string::const_iterator
);
James Aguilar wrote:

Hey all,

Another creative question: is it possible to do something like this to type
define a pointer to a specific type of function:

typedef bool (*)(std::string::const_iterator,
std::string::const_iterator) ItCompare;

And if so, how? The above example does not work, btw, I'm just wondering if
there is a way.

- JFA1


.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER