Boost logo

Boost Users :

From: Christian Henning (chhenning_at_[hidden])
Date: 2007-03-19 20:36:39


Sorry for my bad problem description. Basically I have a map of type
vectors. On element in the vector is used for tagging. I need a
metafunction that can retrieve the type vector that that's is tagged
with the _primary_key_ type. There is only one vector. I would also
need the same functionality for the _foreign_key_ type. Here, it can
be several type vectors.

The MPL lib has a find_if metafunction that looks like the right way
to do. But I haven't tried it yet.

Is this description better?

Christian

On 3/19/07, Joel de Guzman <joel_at_[hidden]> wrote:
> Christian Henning wrote:
> > Hi there, next metaprogramming problem. Is it possible to extract a
> > tagged type from a map?
> >
> > namespace fields
> > {
> > struct _id_;
> > struct _name_;
> > struct _birthday_;
> > struct _address_id_;
> > }
> >
> > namespace tags
> > {
> > struct _primary_key_;
> > struct _foreign_key_;
> > struct _value_;
> > }
> >
> > typedef fusion::map< fusion::vector< fields::_id_ , std::string,
> > tags::_primary_key_ >
> > , fusion::vector< fields::_name_ ,
> > std::string, tags::_value_ >
> > , fusion::vector< fields::_birthday_ ,
> > std::string, tags::_value_ >
> > , fusion::vector< fields::_address_id_,
> > std::string, tags::_foreign_key_ >
> > > table_type;
> >
> > int main()
> > {
> > /// how to get the primary key type vector
> > }
>
> at_key<fields::_id_>(m) ???
>
> > I was looking at fusion's filter_view but that is only available for
> > non-metaprogramming.
>
> Not sure what you mean.
>
> Regards,
> --
> Joel de Guzman
> http://www.boost-consulting.com
> http://spirit.sf.net
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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