|
Boost Users : |
Subject: [Boost-users] Puzzled: compiler can't find a match for function call
From: Zeljko Vrba (zvrba_at_[hidden])
Date: 2008-09-11 04:02:43
In the code below, the compiler complains with
q.cc:39: error: no matching function for call to `inc2(boost::fusion::map<boost:
:fusion::pair<detail::KEY, int>, boost::fusion::void_, boost::fusion::void_, boo
st::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::vo
id_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>&)'
id_t<K> is the SAME type as the expanded BF::map type in inc1; it even works
as the return type of inc1, yet I can't use it as an argument to inc2. What
am I missing? This happens both on gcc 3.4 and SunCC 12.
#include <boost/fusion/include/at_key.hpp>
#include <boost/fusion/include/comparison.hpp>
#include <boost/fusion/include/erase_key.hpp>
#include <boost/fusion/include/io.hpp>
#include <boost/fusion/include/joint_view.hpp>
#include <boost/fusion/include/map.hpp>
#include <boost/fusion/sequence/intrinsic/at_key.hpp>
#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
namespace detail
{
namespace BF = boost::fusion;
struct KEY;
template<typename K>
struct id_t
{ typedef BF::map<BF::pair<K, int> > type; };
template<typename K>
inline typename id_t<K>::type&
inc1(BF::map<BF::pair<K, int> > &id)
{
++BF::at_key<K>(id);
return id;
}
template<typename K>
inline typename id_t<K>::type&
inc2(typename id_t<K>::type &id)
{
++BF::at_key<K>(id);
return id;
}
void f()
{
BF::map<BF::pair<KEY, int> > m(12);
inc1(m);
inc2(m);
}
}
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