0
이 코드가 VS13에서 성공적으로 컴파일되고 gcc로 컴파일되지 않는 이유는 무엇입니까?gcc : 잘못된 템플릿 인수 수
///// file my_map.h /////
namespace my
{
// my custom map
template<typename K, typename V, typename order = less<K>, typename allocator = cached_alloc<page_allocator<pair<K,V> > > >
class map : public set_base<pair<K, V>, K, select1st, order, ins_unique, allocator>
{
...
};
}
///// file test.h /////
#include "my_map.h"
template <typename T>
class Base
{
protected:
typedef my::map<T, double> MyMap;
MyMap m_map; // this is line NN
public:
void func(const T& key)
{
typename MyMap::iterator it = m_map.find(key);
if(it != m_map.end()) {
// ....
}
}
};
class Inherited1 : public Base <char>
{ };
class Inherited2 : public Base <int>
{ };
실제로 "템플릿 인수 잘못된 번호"가 무엇을 의미하는지 컴파일러 오류 (GCC 4.1.2)
filepath.h:LineNN error: wrong number of template arguments (1, should be 4)
..: error: provided for 'template<class K, class V, class order, class allocator> class my::map'
그것은 나를 위해 분명하지 않다 다음의 결과?
GCC 4.1.2 ?! olllldddd –
'# include'와 함께 완벽한 테스트 케이스를 제출하십시오. –
@LightnessRacesinOrbit 예. 죄송합니다) –