Boost logo

Boost Users :

Subject: Re: [Boost-users] Detect generic base class
From: Francesco Biscani (bluescarni_at_[hidden])
Date: 2010-04-29 11:41:35


Hi Roman,

On Thu, Apr 29, 2010 at 9:23 AM, Roman Perepelitsa
<roman.perepelitsa_at_[hidden]> wrote:
> 2010/4/29 Francesco Biscani <bluescarni_at_[hidden]>
>>
>> Hi list,
>>
>> how can I detect if a class inherits from a generic class? E.g.,
>>
>> template <class Derived>
>> class base {};
>>
>> class final: public base<final> {};
>
> is_instance_of from lambda library is what you want (see
> boost/lambda/detail/is_instance_of.hpp). It's not part of public interface
> though, so either copy it to your location or use on your own risk.
> Roman Perepelitsa.

thanks for the pointer, that's exactly it. However, I think I will end
up deriving the base class from a non-templated tag class and use
is_base_of<T,tag> instead - I do not think I'd be able to maintain my
own version is_instance_of should it be changed/removed.

Cheers,

  Francesco.


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