Mail Archives: djgpp/1999/07/13/12:20:16
On Tue, 13 Jul 1999 03:36:36 GMT, Endlisnis <s257m AT unb DOT ca> wrote:
>Siemel Naran wrote:
>> I think that it is possible. Probably something along the lines of this:
>> int (operator () *const)(int) { return &f; }
>
>That gets a parse error before "*".
Yes, I know. But I mean that the solution is something along the lines
of this, where the "operator" keyword appears after the return type of
the returned function. Kind of like for the member function returning
a pointer to a non-member or class static function. I tried various
combinations, all without any luck. Ask on comp.std.c++ as you might
get an answer.
Incidentally, how to make an array of function pointers using 'new'
and without using 'typedef', and without using containers. With
typedef, we say
typedef void (*Func)();
Func * array=new Func[1];
delete[] array;
Without typedefs,
void (**Func)()=new void (*[1])(); // syntax error
delete[] array;
>> However, operator conversions are rarely a good idea.
>
> Thanx for the advice, but I'm not actually trying to use this construct,
>I'm making a code parser and just wanted to know what to expect.
Fine. If you don't know what to do just yet, just have your code
parser reject this outright. I don't think anyone writes codes like
this anyway.
--
----------------------------------
Siemel B. Naran (sbnaran AT uiuc DOT edu)
----------------------------------
- Raw text -