Boost logo

Boost Users :

Subject: [Boost-users] [fusion] problem converting the result of a transform of a set into a map
From: Christian Kerl (christian.kerl_at_[hidden])
Date: 2014-09-26 11:10:13


Hello everybody,

I've a problem with the boost fusion library. I try to convert a fusion
set into a map using the transform algorithm.

Here is a example:

typedef typename boost::fusion::result_of::as_map<
typename boost::fusion::result_of::transform<BoundMembers,
map_name_to_member>::type
>::type Content;

where BoundMembers is a boost::fusion::set and map_name_to_member is
defined as:

struct map_name_to_member
{
template <typename T>
struct result;

template <class F, typename T>
struct result<F(T)>
{
typedef boost::fusion::pair<typename T::Name, typename T::Member> type;
};
};

With boost 1.56 and gcc 4.8.1 I get the following compilation error:

include/boost/fusion/iterator/key_of.hpp:36:16: error: invalid use of
incomplete type ‘struct
boost::fusion::extension::key_of_impl<boost::fusion::transform_view_iterator_tag>’
struct key_of
^
include/boost/fusion/iterator/key_of.hpp:21:16: error: declaration of
‘struct
boost::fusion::extension::key_of_impl<boost::fusion::transform_view_iterator_tag>’
struct key_of_impl;

However, this code used to work with Boost 1.48. I found a workaround to
fix this, by converting the result of transform to a fusion list before
coverting it to a map, i.e.:

typedef typename boost::fusion::result_of::as_map<
typename boost::fusion::result_of::as_list<
typename boost::fusion::result_of::transform<BoundMembers,
internal::map_name_to_member>::type
>::type
>::type Content;

Am I doing something wrong or is this intended behavior? Thanks for your
support.

Best regards,
Christian Kerl


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