| 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
.
|
|
|
|

|
Related Articles |
|
|