|
Boost Users : |
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2006-06-22 13:19:07
Hello all,
I am trying to specialize boost::is_pointer so, that it can determine if a type is a pointer
wrapper (shared_ptr, auto_ptr, weak_ptr).
Does anybody has ideas how this can be done? May be it would be possible to handle if e.g. one can
determine if a class/struct has some typedef inside:
template<...>
class shared_ptr
{
typedef ... element_type;
};
class some_other_class
{
typedef ... type;
};
class some_other_class2
{
//no typedef...
};
Somehow I am not certain if I am on the right path. My problem is that I have a variant container
type with different types. One could access a value using -> operator. The operator returns the
pointer to the value. But if this value is a pointer (that can be determined by boost::is_pointer
type trait) it should return the pointer and not pointer to pointer value. Now what happens if I
store shared_ptr or any other type which overload -> operator? This will result in compiler error,
because the compiler tries to access member of the pointer to pointer and not of the pointer
instance.
Is there may be a way to determine if the member access operator is overloaded? What if ->
operator is defined in the base? And what if child class inherits base as protected or private?
The other solution would be to force every user to write a specialized class is_pointer for every
type stored in variant, but this would be not so nice.
With Kind Regards,
Ovanes Markarian
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