Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2006-06-26 13:23:12


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