Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2006-06-27 16:37:23


Hi!
I do not expect a really quick input on this issue, but it would be nice to
if anyone could confirm, that this should be checked on boost test systems.

Thanks,
Ovanes

-----Original Message-----
From: Ovanes Markarian [mailto:om_boost_at_[hidden]]
Sent: Monday, June 26, 2006 19:23
To: boost-users_at_[hidden]
Subject: [Boost-users] still problems with has_xxx and shared_ptr...

Hello all!
Sorry to disturb again... I have the following code:

namespace detail
{
        BOOST_MPL_HAS_XXX_TRAIT_DEF(element_type)
        BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type)
        BOOST_MPL_HAS_XXX_TRAIT_DEF(type)
        BOOST_MPL_HAS_XXX_TRAIT_DEF(type_t)
}

struct B1
{};

int main()
{
typedef boost::shared_ptr<B1> ptr_t;

typedef
                        mpl::if_c
                        <
                                detail::has_type<ptr_t>::value
                                , mpl::int_<0>
                                , mpl::if_c
                                        <
        
detail::has_element_type<ptr_t>::value
                                                , mpl::int_<1>
                                                , mpl::if_c
                                                        <
        
detail::has_value_type<ptr_t>::value
                                                                ,
mpl::int_<2>
                                                                , mpl::if_c
                                                                        <
        
detail::has_type_t<ptr_t>::value
        
, mpl::int_<3>
        
, mpl::int_<-1>
>
>
>
>
                type_id;

                type_id
just_for_debug_an_instance;

}

MSVC 8.0 debugger shows for just_for_debug_an_instance the following
type:
boost::mpl::if_c<1,boost::mpl::int_<0>,boost::mpl::if_c<1,boost::mpl::int_<1
>,boost::mpl::if_c<1,boost::mpl::int_<2>,boost::mpl::if_c<0,boost::mpl::int_
<3>,boost::mpl::int_<-1>
> > > >

How is it possible, if I really can find in the shared_ptr template class
the following typedefs:

public:

    typedef T element_type;
    typedef T value_type;
    typedef T * pointer;
    typedef typename detail::shared_ptr_traits<T>::reference reference;

For me it is really unclear why does:
detail::has_type<ptr_t>::value has the value 1 in the first static if
statement?

I looked through the shared_ptr template class and found nowhere the 'type'
typedef, function, or anything else, what could be evaluated by has_value.
Any help would be really apreciated.

Many Thanks,

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