peter_foelsche wrote:
This code does not compile.
I'm using Visual C++.
Any help would be appreciated.
I'm still quite unclear as to what you're trying to accomplish, but the
following compiles:
#include <utility>
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace mpl = boost::mpl;
template<typename T>
struct wrap { };
template<typename CDB>
struct CDer
{ };
template
struct CMyOperation : private boost::noncopyable
{
typedef CDer
<
typename mpl::transform >::type
> CDerOr;
CMyOperation(CDer<CDB> const& r0, CDer<CDB1> const& r1, CDerOr& rT)
: m_r0(r0),
m_r1(r1),
m_rT(rT),
m_iPos(0)
{ }
void operator ()(std::pair const&)
{
++m_iPos;
}
private:
CDer<CDB> const& m_r0;
CDer<CDB1> const& m_r1;
CDerOr& m_rT;
unsigned m_iPos;
};
template
struct CCreatePair
{
CCreatePair(CMyOperation& op) : m_sOp(&op) { }
typedef void result_type;
template<typename T>
void operator ()(wrap<T>) const
{
typedef typename mpl::front<T>::type first;
typedef typename mpl::back<T>::type second;
(*m_sOp)(std::make_pair(first::value, second::value));
}
private:
CMyOperation* m_sOp;
};
template
typename CMyOperation::CDerOr myOperation(CDer<CDB> const& _r0,
CDer<CDB1> const& _r1)
{
typedef mpl::zip_view > CMerged;
typename CMyOperation::CDerOr sRet;
CMyOperation sOp(_r0, _r1, sRet);
CCreatePair createPair(sOp);
mpl::for_eachmpl::_1 >(createPair);
return sRet;
}
int main()
{
CDer > sDer0;
CDer > sDer1;
myOperation(sDer0, sDer1);
return 0;
}