In the code below, the compiler complains with
q.cc:39: error: no matching function for call to `inc2(boost::fusion::map, 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
#include
#include
#include
#include
#include
#include
#include
namespace detail
{
namespace BF = boost::fusion;
struct KEY;
template<typename K>
struct id_t
{ typedef BF::map > type; };
template<typename K>
inline typename id_t<K>::type&
inc1(BF::map > &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 > m(12);
inc1(m);
inc2(m);
}
}