template<typename C>
bool lastGreaterThanFirst(const C& container)
{
if(container.empty()) return false;
typename C::const_iterator begin(container.begin());
typename C::const_iterator end(container.end());
return *--end > *begin;
}
typename C::const_iterator begin(container.begin()); typename C::const_iterator end(container.end());
template<typename C>
bool lastGreaterThanFirst(const C& container)
{
if(container.empty()) return false;
C::const_iterator begin(container.begin());
C::const_iterator end(container.end());
return *--end > *begin;
}
test.cpp:6:2: error: missing 'typename' prior to dependent type name 'C::const_iterator' C::const_iterator begin(container.begin()); ^~~~~~~~~~~~~~~~~ typename test.cpp:7:2: error: missing 'typename' prior to dependent type name 'C::const_iterator' C::const_iterator end(container.end()); ^~~~~~~~~~~~~~~~~ typename 2 errors generated.
test.cpp:8:11: error: elaborated type refers to a typedef
class C::const_iterator begin(container.begin());
^
test.cpp:15:2: note: in instantiation of function template specialization 'lastGreaterThanFirst<std::__1::vector<int, std::__1::allocator<int> > >' requested here
lastGreaterThanFirst(vec);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:476:54: note: declared here
typedef __wrap_iter<const_pointer> const_iterator;
^
1 error generated.
ClassA::foo
ClassA::foo a;
class ClassA {
public:
class foo {
};
};
class ClassA {
public:
typedef int foo;
};
typename C::const_iterator begin(container.begin());
class ClassA {
public:
class foo {
};
};
template<typename C>
class ClassB : public C::foo {
};
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有