Boost logo

Boost Users :

Subject: Re: [Boost-users] detect if a type has a size_t member
From: Hicham Mouline (hicham_at_[hidden])
Date: 2009-07-06 08:48:00


> -----Original Message-----
> From: Hicham Mouline [mailto:hicham_at_[hidden]]
> Sent: 05 July 2009 15:36
> To: Hicham Mouline
> Subject: FW: [Boost-users] detect if a type has a size_t member
>
>
>
> > -----Original Message-----
> > From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> > bounces_at_[hidden]] On Behalf Of joel
> > Sent: 03 July 2009 19:04
> > To: boost-users_at_[hidden]
> > Subject: Re: [Boost-users] detect if a type has a size_t member
> >
> > Hicham Mouline wrote:
> > > Can I put the macro inside the struct S ? I guess not. I'd write:
> > > HAS_STATIC_MEMBER_NAMED(T, value)
> > >
> > > which would return a integral bool or a bool type
> > it works liek BOOST_MPL_HAS_XXXX so put it where you want to define
> > a boolean meta-function. It supports ::value and ::type return mpl
> > boolean.
I'm sorry I can quite get how to use it. I have this:

#include <iostream>
#include <boost/introspection/has_member_data.hpp>

struct S {
  static const size_t maxsize =5;
};

struct T {
};

BOOST_HAS_MEMBER_DATA(S, maxsize)
BOOST_HAS_MEMBER_DATA(T, maxsize)

int main()
{
    if ( boost::introspection::has_member_data_maxsize<T>::value )
    {
        std::cout<<" T has max_size"<<std::endl;
    }
    return 0;
}

which doesn't build because

error C2953: 'boost::introspection::has_member_data_maxsize' : class
template has already been defined

Hicham


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