Boost logo

Boost Users :

From: Hossein Haeri (powerprogman_at_[hidden])
Date: 2004-12-28 05:46:02


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? :)

> > 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?

> are
> not functions by the standard's definition of
> "function."

Sure.

> It doesn't work because there's no way to code it in
> general.

Eh, really? I'm begining to become upset when I see
Dave Abrahams -- of the biggest names in
Metaprogramming -- says that. :(

> First of
> all there's no universal standard for a way to get
> the result type of a
> function object. Accessing a nested result_type
> sometimes works, but
> then, sometimes the operator() is overloaded, or
> even templated.

Gush! Seems that you're right... :(

> You might look at boost::result_of for a more
> general solution.

Let me see. I'll be back afterwards... ;)

All of the Best,
--Hossein

        
                
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net