Boost logo

Boost Users :

From: Agoston Bejo (gusz1_at_[hidden])
Date: 2004-06-07 12:47:39


Hi,
and what about member typedef's? Is it also that hopeless?

Thx,
Gus

"Ben Hutchings" <ben.hutchings_at_[hidden]> wrote in message
news:A7F746377BDB7D4EA8E6623AF92F43C8163515_at_copper.bwsint.com...
> Agoston Bejo <gusz1_at_[hidden]>:
> > Hi,
> > I have took a look at some parts of the boost library, but I couldn't
> > find what I want, and that is something like this: How can I determine
> > if a type T has such and such member? It would look like something
> > like this:
> >
> > has_member<T, paint>::result (true if T::paint() exists)
> > has_member<T, m_size>::result (true if T::m_size exists)
> >
> > The closest to this I could find is boost::type_traits but that does
> > not provide this functionality.
>
> Unfortunately that is impossible because templates can only manipulate
> constants, types and templates, not names. There is a technique that
> can be used to detect the definition of most operators, but it
> requires a separate template for each operator and it depends on being
> able to overload the operators through non-member functions. There may
> be a way to detect member functions but it cannot be done generically.


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