Boost logo

Boost Users :

From: Christian Henning (chhenning_at_[hidden])
Date: 2007-05-03 18:37:08


Alright the second worked. Thanks a lot.

using namespace std;
using namespace boost;

namespace fields
{
   struct _id_;
   struct _name_;
   struct _birthday_;
   struct _address_id_;
}

typedef fusion::map< fusion::pair< fields::_id_ , string >
                   , fusion::pair< fields::_name_ , string >
                   , fusion::pair< fields::_birthday_ , string >
                   , fusion::pair< fields::_address_id_, string >
> table_type;

int main()
{
   table_type table;

   vector< table_type > vec;

   find_if( vec.begin()
          , vec.end()
          , bind( equal_to< string >()
                , bind( &fusion::at_key< fields::_id_, table_type const >, _1 )
                , string( "Hallo" )));

   return 0;
}

On 5/3/07, Peter Dimov <pdimov_at_[hidden]> wrote:
> Christian Henning wrote:
>
> ...
>
> > , bind( &fusion::at_key< fields::_id_ >, _1 )
>
> ...
>
> > test.cpp(43) : error C2783: 'result_of::at_key<const
> > Sequence,Key>::type boost::fusion::at_key(const Sequence &)' : could
> > not deduce template argument for 'Sequence'
>
> Have you tried supplying the Sequence template parameter? Something like:
>
> bind( &fusion::at_key< fields::_id_, table_type >, _1 )
>
> or, if this doesn't work:
>
> bind( &fusion::at_key< fields::_id_, table_type const >, _1 )
>
> If this doesn't help, I'm afraid that your get_id wrapper is the best
> workaround. It's possible to cast &fusion::at_key<_id_> to the correct type,
> but I consider the get_id approach superior in general.
>
> _______________________________________________
> 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