mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Testcase for resolving an iterators of std::vector.
This commit is contained in:
parent
0fb210a8fe
commit
9cd97af5e5
1 changed files with 55 additions and 0 deletions
|
@ -1209,4 +1209,59 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
||||||
assertTrue(type instanceof IBasicType);
|
assertTrue(type instanceof IBasicType);
|
||||||
assertEquals(((IBasicType)type).getType(), IBasicType.t_int);
|
assertEquals(((IBasicType)type).getType(), IBasicType.t_int);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// template<typename _Iterator> struct iterator_traits {
|
||||||
|
// typedef typename _Iterator::pointer pointer;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename _Tp> struct iterator_traits<_Tp*> {
|
||||||
|
// typedef _Tp* pointer;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename _Iterator, typename _Container> class normal_iterator {
|
||||||
|
// protected:
|
||||||
|
// _Iterator _M_current;
|
||||||
|
//
|
||||||
|
// public:
|
||||||
|
// typedef typename iterator_traits<_Iterator>::pointer pointer;
|
||||||
|
// normal_iterator() : _M_current(_Iterator()) { }
|
||||||
|
//
|
||||||
|
// pointer operator->() const {
|
||||||
|
// return _M_current;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename _Tp> class allocator {
|
||||||
|
// public:
|
||||||
|
// typedef _Tp* pointer;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename _Tp, typename _Alloc = allocator<_Tp> >
|
||||||
|
// class vector {
|
||||||
|
// typedef vector<_Tp, _Alloc> vector_type;
|
||||||
|
//
|
||||||
|
// public:
|
||||||
|
// typedef typename _Alloc::pointer pointer;
|
||||||
|
// typedef normal_iterator<pointer, vector_type> iterator;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
|
||||||
|
// struct MyStruct {
|
||||||
|
// int member;
|
||||||
|
// };
|
||||||
|
// typedef vector<MyStruct> VS1;
|
||||||
|
// void test() {
|
||||||
|
// VS1::iterator it;
|
||||||
|
// it->member; // it->member
|
||||||
|
// }
|
||||||
|
public void testVectorIterator() throws Exception {
|
||||||
|
ICPPField t2 = getBindingFromASTName("member; // it->member", 6, ICPPField.class);
|
||||||
|
ICPPClassType ct= t2.getClassOwner();
|
||||||
|
assertEquals("MyStruct", ct.getName());
|
||||||
|
|
||||||
|
final IType type = t2.getType();
|
||||||
|
assertTrue(type instanceof IBasicType);
|
||||||
|
assertEquals(((IBasicType)type).getType(), IBasicType.t_int);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue