Consider:
template<typename T>
struct MakeVectorOfType
{
typedef std::vector<T> type;
};
typedef boost::mpl::vector<int, double> TScalarTypes;
typedef boost::mpl::transform<TScalarTypes, MakeVectorOfType<boost::mpl::placeholders::_1>>::type TVectorTypes;
typedef boost::mpl::joint_view<TScalarTypes, TVectorTypes>::type TTypes;
template<typename T>
struct Wrapper
{
T value;
};
template<typename T>
struct MakeWrapper
{
typedef Wrapper<T> type;
};
typedef boost::mpl::transform<
TScalarTypes::type,
MakeWrapper<boost::mpl::placeholders::_1>
>::type TScalarWrapperTypes; // <-- Works
typedef boost::mpl::transform<
TTypes::type,
MakeWrapper<boost::mpl::placeholders::_1>
>::type TAllWrapperTypes; // <-- Compiler error
So essentially I have some types in an MPL sequence, I make another sequence with std::vectors of those types, then I want to do something with the union of the two. If I want to do another transform on that union (using joint_view), I get the following compiler error (using MSVC2017):
1>e:\source\trunk\thirdparty\boost\mpl\clear.hpp(31): error C2504: 'boost::mpl::clear_impl<boost::mpl::aux::joint_view_tag>::apply<Sequence>': base class undefined
1> with
1> [
1> Sequence=boost::mpl::joint_view<TScalarTypes,TVectorTypes>
1> ]
(... plus a lot more tracing back to the code above, obviously)
The other one (where I do the transform directly on the sequence) works fine, so AFAICT it's the combination of applying a transform on a joint_view that is the problem here. So is it because the joint_view isn't a 'real' sequence but merely a 'view'? I can make a copy of the joint_view first and then apply the transform on that copy, but it just bugs me that I can't get this to work in one go.