 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Sebastian Ledesma [Solidy Guest
|
Posted: Fri May 04, 2007 11:34 pm Post subject: What are functor? |
|
|
Hello everyone:
Can someone explain me what are functor's?
- what are, what are for, advantages over other techniques, things that i
only can make with functors.
Thanks
in
advance.
Saludos
Sebastian |
|
| Back to top |
|
 |
Duane Hebert Guest
|
Posted: Fri May 04, 2007 11:51 pm Post subject: Re: What are functor? |
|
|
"Sebastian Ledesma [Solidyne Labs]" <labo[no_sp@m]solidyne1.com> wrote in
message news:463b7d08 (AT) newsgroups (DOT) borland.com...
| Quote: | Hello everyone:
Can someone explain me what are functor's?
- what are, what are for, advantages over other techniques, things that i
only can make with functors.
|
GIYF
A function object. A class that defines operator().
http://www.sgi.com/tech/stl/functors.html |
|
| Back to top |
|
 |
Mogens Hansen Guest
|
Posted: Fri May 04, 2007 11:53 pm Post subject: Re: What are functor? |
|
|
"Sebastian Ledesma [Solidyne Labs]" <labo[no_sp@m]solidyne1.com> wrote in
message news:463b7d08 (AT) newsgroups (DOT) borland.com...
| Quote: | Hello everyone:
Can someone explain me what are functor's?
|
Its an object of a class, which has the function call operator implemented.
Examples of functors are
std::less
std::bind1st
| Quote: | - what are, what are for, advantages over other techniques,
|
It's very usefull for generic programming.
It also allows for better runtime performance than pointer to functions,
because they can often be inlined and maintain full type checking. That's
the main reason why C++ std::sort is faster than C qsort.
--
Kind regards
Mogens Hansen |
|
| Back to top |
|
 |
Chris Uzdavinis (TeamB) Guest
|
Posted: Sat May 05, 2007 12:18 am Post subject: Re: What are functor? |
|
|
"Sebastian Ledesma [Solidyne Labs]" <labo[no_sp@m]solidyne1.com> writes:
| Quote: | Hello everyone:
Can someone explain me what are functor's?
- what are, what are for, advantages over other techniques, things that i
only can make with functors.
|
They are objects that can hold functions, or that can be invoked as if
they were functions.
They're useful in many contexts, including many STL algorithms,
implementing a "command pattern", or simple argument binding.
Anytime you need to pass around a "function" or store it for later (to
be invoked later), think of functors. The're also known as function
objects, though some people have slightly different definitions
between the two terms.
--
Chris (TeamB); |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|