|
Boost Users : |
From: Christian Henning (chhenning_at_[hidden])
Date: 2007-04-01 13:48:19
Hi there,
is it possible to find all type vectors in a type matrix ( 2D type
vector ) that match a predicate? In the end I would like to have them
in another type matrix.
Can somebody point out how I would put together such a metafunction?
I'm not sure if the mpl lib supports my feature request.
Consider the following code:
#include "boost/mpl/vector.hpp"
#include <boost/mpl/find_if.hpp>
#include <boost/mpl/at.hpp>
using namespace std;
using namespace boost;
namespace fields
{
struct id {};
struct name {};
struct address {};
struct birthday {};
}
namespace tags
{
struct primary {};
struct foreign {};
struct no_key {};
}
typedef mpl::vector<fields::id , tags::primary> id_field_t;
typedef mpl::vector<fields::name , tags::foreign> name_field_t;
typedef mpl::vector<fields::address , tags::foreign> address_field_t;
typedef mpl::vector<fields::birthday, tags::no_key> birthday_field_t;
typedef mpl::vector< id_field_t
, name_field_t
, address_field_t
, birthday_field_t
> table;
// aggregate all foreign keys in the following vector
typedef mpl::vector0<> foreign_keys;
/// ??? metafunction for aggregating all foreign keys ???
int main()
{
return 0;
}
BTW, I'm not particular interested in a certain order of the
aggregated type vectors.
Reagrds,
Christian
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