C++ 缩短申报时间的一种方法
我有这样的想法:C++ 缩短申报时间的一种方法,c++,templates,C++,Templates,我有这样的想法: template<class Key, class Value, class Compare_p = Compare<ByKey>, template<class,class> class Insert_p = NoOverride, template<class> class FailureSign
template<class Key,
class Value,
class Compare_p = Compare<ByKey>,
template<class,class> class Insert_p = NoOverride,
template<class> class FailureSignal_p = ThrowOnFailure,
class AllocFactor_p = AllocFactorScientific<>,
class Alloc = Allocator<FailureSignal_p>
>
class Map : private Map_Base<Implementation> //Implementation is a Link with identical
//params to Map
{
public:
//I've tried to use typedef here but it's too late
typedef LinkImplementation<Pair<Key,Value>,Compare_p,Insert_p,FailureSignal_p,AllocFactor_p,Alloc> Implementation;
};
模板
class Map:private Map\u Base//实现是一个具有相同
//要映射的参数
{
公众:
//我试着在这里使用typedef,但为时已晚
类型定义链接执行;
};
所以最大的问题是:有没有办法缩短(链接实现的)声明?可能会为映射参数创建一个模板“struct”,如下所示:
template <class Key, ... blablabla >
struct MapParams{
typedef Key key_t;
typedef Value value_t;
..................
};
模板
结构映射参数{
typedef Key\u t;
类型定义值\u t;
..................
};
然后将此“struct”用作单个模板参数
对于地图和地图基础模板?这不意味着用户会受到影响吗<代码>地图xvs
地图x
?