about unary_function

L

LinLMa

Hello everyone,


I am wondering what is the practical usage of unary_function? Could
anyone list some practical benefits?

My question is, a class like

class Foo : public std::unary_function<class A, class B>

is always the same (could use similar implementation) to

template <class A, class B> class Foo

So we could always use the alternative approach to replace
unary_function.


thanks in advance,
George
 
P

Pete Becker

I am wondering what is the practical usage of unary_function? Could
anyone list some practical benefits?

std::unary_function provides two typedef nams that can be used by other
classes to determine the argument type and the result type of a class's
function call operator. For example, the standard library templates
std::negate and std::unary_negate use this information to determine the
argument type and return type of their own function call operators.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top