Hossein Haeri wrote:
Dave,
AFAIK, std::iterator_traits<> is one of the counterparts of function_traits<>, not?
A sort of symmetry which iterator_traits<> has got is that it can work for Iterators as well as plain pointers.
That's the wrong way to think about it. It just works for iterators. Plain pointers just happen to be iterators, by the *standard's definition* of "iterator."
Smart Alec... ;) Alright I could be more specific speaking like this:
"... it can work for Iterators which happen to be classes as well as plain pointers."
Excused me? :)
I'm not just being pedantic. It's hard to explain why function_traits is the way it is without making that distinction.
This seems to be not the case for function_traits<>. That is, you can pass a function type to it, but you can't do that for a functor. Is that right?
That's because function object types (what you're calling functors)
It's not me, AFAIK. That's another common name of them. Isn't that?
Yes, but it's frowned upon by many because it's a completely invented meaning for a term that already had a well-established meaning in mathematics and computing. If you read Stroustrup or almost any other author who's also on the committee you'll see the term "function object" and not "functor." -- Dave Abrahams Boost Consulting http://www.boost-consulting.com