|
Boost Users : |
From: Christian Henning (chhenning_at_[hidden])
Date: 2007-05-03 17:31:07
Hi there, I have a problem ( compilation error ) using a fusion map
with boost bind. Not sure if that is the intended usage. So, please
show some mercy when I'm doing something totally stupid.
Basically, I have a std::vector of a fusion::map instances. And I
would like to find a fusion::map instance with a special value.
Here is the code:
#include <vector>
#include <algorithm>
#include <functional>
#include <boost/bind.hpp>
#include <boost/fusion/algorithm.hpp>
#include <boost/fusion/sequence.hpp>
#include <boost/fusion/iterator.hpp>
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_ >, _1 )
, string( "Hallo" )));
return 0;
}
Does that makes sense? If yes, how would I do it?
I'm using MSVC 7.1 and the first couple of compiler errors are:
Compiling...
test.cpp
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'
c:\boost\boost\fusion\sequence\intrinsic\at_key.hpp(50) : see
declaration of 'boost::fusion::at_key'
test.cpp(43) : error C2783:
'lazy_disable_if<boost::is_const<Sequence>,boost::fusion::result_of::at_key<Sequence,Key>>::type
boost::fusion::at_key(Sequence &)' : could not deduce template
argument for 'Sequence'
c:\boost\boost\fusion\sequence\intrinsic\at_key.hpp(43) : see
declaration of 'boost::fusion::at_key'
test.cpp(43) : error C2784:
'boost::_bi::bind_t<R,boost::_mfi::dm<R,T>,_bi::list_av_1<A1>::type>
boost::bind(R T::* ,A1)' : could not deduce template argument for
'overloaded function type' from 'overloaded function type'
c:\boost\boost\bind.hpp(1616) : see declaration of 'boost::bind'
[snip]
Thanks for your patients,
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