200分,送!(解决了)
#include "stdafx.h"
#include <iostream>
#include <string>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/push_back.hpp>
#include <boost/mpl/begin_end.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/erase.hpp>
#include <boost/mpl/pop_front.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/front.hpp>
using std::string;
using std::cout;
using std::endl;
using boost::mpl::at ;
using boost::mpl::int_;
using boost::mpl::pop_front;
using boost::mpl::vector;
using boost::mpl::deref;
using boost::mpl::begin;
using boost::mpl::front;
struct NullType{ };
template<int N>
struct Int2Type
{
enum{ vaule = N };
};
template <class T>
struct Holder{
typename T vaule;
};
template <class TList, template<class> class Unit>
class GenScatterHierarchy;//主模板
template<class T1, class T2, template<class> class Unit>
class GenScatterHierarchy<typename begin<vector<T1,T2>>::type , Unit>//对主模进行特化。
: public GenScatterHierarchy<typename front<vector<T1,T2>>::type, Unit>
, public GenScatterHierarchy<typename pop_front<vector<T1,T2>>::type, Unit>
{
};
template<class ATomicType, template<class> class Unit>
class GenScatterHierarchy : public Unit<ATomicType>
{
};
template<template<class> class Unit>
class GenScatterHierarchy<NullType, Unit>{
};
// template<class TList, template<class> class Unit>
// Unit< at<TList, int_<0>>>& FieldHelper(
// GenScatterHierarchy<TList,Unit>& obj, Int2Type<0> )
// {
// GenScatterHierarchy<at<TList, int_<0>>, Unit>& leftBase = obj;
// return leftBase;
// };
//
// template<int i, class TList, template<class> class Unit>
// Unit< at<TList, int_<i>>>& FieldHelper(
// GenScatterHierarchy<TList, Unit>& obj, Int2Type<i>)
// {
// GenScatterHierarchy<pop_front<TList>, Unit>& rightBase = obj;
// return FieldHelper(rightBase, Int2Type<i-1>());
// }
//
// template <int i, class TList, template<class> class Unit>
// Unit< at<TList,int_<i>>>&
// Field (GenScatterHierarchy<TList, Unit>& obj)
// {
// return FieldHelper(obj, Int2Type<i>() );
// }
int _tmain(int argc, _TCHAR* argv[])
{
//typedef GenScatterHierarchy<vector<int, string>, Holder> Info;
// Info obj;
// int b = (static_cast<Holder<int>&>(obj)).vaule;//这种递归仍是可疑,关键是模板特化仍不对。
//deref<begin<vector<int>::type>::type>::type a=9;
//cout<<a<<endl;
return 0;
}f:\documents and settings\administrator\my documents\visual studio 2005\projects\csdn\csdn\csdn.cpp(48) : error C2764: 'T1' : template parameter not used or deducible in partial specialization 'GenScatterHierarchy<begin<boost::mpl::vector<T0,T1,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na>>::type,Unit>'
f:\documents and settings\administrator\my documents\visual studio 2005\projects\csdn\csdn\csdn.cpp(48) : error C2764: 'T2' : template parameter not used or deducible in partial specialization 'GenScatterHierarchy<begin<boost::mpl::vector<T0,T1,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na,boost::mpl::na>>::type,Unit>'
...全文
相关推荐
中国送餐机器人落地全球200个城市.pdf
#资源达人分享计划#
QQ旋风每天刷200分工具
QQ旋风每天刷200分工具,下载后拉到自己的旋风下载,秒下完成 完成后过明天才有积分,最多200积分, 只做一次就行了
LEM 变频器专用多量程交流电流变送器AKR 200 B 420L产品介绍(英文).pdf
LEM 变频器专用多量程交流电流变送器AKR 200 B 420L产品介绍(英文)pdf,LEM 变频器专用多量程交流电流变送器AKR 200 B 420L产品介绍(英文)
CSP-J复赛集训200分-300分必刷-csp-j-2020优秀的拆分
CSP-J复赛集训200分-300分必刷-csp-j-2020优秀的拆分
M200MKIII 电子分频电路
惠威2.0桌面音箱,HIVI-M200MKIII-电子分频电路深入剖析


