D
daniel.w.gelder
Hello, I have been trying to write a functor template for a week now
and I'm just having tons of trouble because I don't understand an issue
that I guess is pretty basic to this task.
functor<bool (long, long)> myFunctor;
myFunctor = AFunctionOfThatPrototype;
To get that much is elementary because the template can just store a
(bool)(long,long) as a member variable in functor<T>. Here is the
problem:
bool whether = myFunctor(1,2);
How can I possibly ever utilize the individual result and parameter
type from the prototype in functor:perator()? I have been poring over
several template libraries and I just can't see how they accomplish it
with partial specialization. After all, I can't debug the compiler
itself or look at preprocessor source to figure out what's happening.
I understand that I could always settle for this syntax fairly easily:
functor<bool, long, long> myFunctor;
bool whether = myFunctor(4,5);
And then use a typedef inside the template to make the prototype. But
the libraries I've seen don't have to settle for that. How is this
trick done??? If it matters, I'm using XCode. Thank you very much in
advance,
Yours,
Dan
and I'm just having tons of trouble because I don't understand an issue
that I guess is pretty basic to this task.
functor<bool (long, long)> myFunctor;
myFunctor = AFunctionOfThatPrototype;
To get that much is elementary because the template can just store a
(bool)(long,long) as a member variable in functor<T>. Here is the
problem:
bool whether = myFunctor(1,2);
How can I possibly ever utilize the individual result and parameter
type from the prototype in functor:perator()? I have been poring over
several template libraries and I just can't see how they accomplish it
with partial specialization. After all, I can't debug the compiler
itself or look at preprocessor source to figure out what's happening.
I understand that I could always settle for this syntax fairly easily:
functor<bool, long, long> myFunctor;
bool whether = myFunctor(4,5);
And then use a typedef inside the template to make the prototype. But
the libraries I've seen don't have to settle for that. How is this
trick done??? If it matters, I'm using XCode. Thank you very much in
advance,
Yours,
Dan