eg.
#include <iostream>
#include <map>
#include <vector>
struct Info
{
string name;
int age;
};
int main()
{
vector<Info*> vecInfos;
Info* p = new Info;
p->name = "account1";
p->age = 28;
vecInfos.push_back(p);
p = new Info;
p->name = "account2";
p->age = 17;
vecInfos.push_back(p);
vector<Info*>::iterator itVec = vecInfos.begin();
while (itVec != vecInfos.end())
{
cout << itVec->name /* at here */
<< itVec->age /* and at here */
<< endl;
}
map<string, Info*> mapInfos;
p = new Info;
p->name = "test1";
p->age = 21;
mapInfos.insert(make_pair(p->name, p));
p = new Info;
p->name = "test2";
p->age = 22;
mapInfos.insert(make_pair(p->name, p));
map<string, Info*>::iterator itMap = mapInfos.begin();
while (itMap != mapInfos.end())
{
cout << itMap->first /* at here */
cout << itMap->second->name /* at here */
}
return 0;
}
the codeCompletion can't display 'first','second',and the Members of struct Info.
If there are a lot of members for struct or class;
I'll feel Coding difficult;
This is a known bug of our CC, it can't handle the template related code very well.
Currently, you can use the clang based code completion plugin. Or help us by supplying patches ;)
Is anyone currently working on improving the template related code? If not, I'll work on it and come up with a solution for this issue.
Quote from: jat1 on May 24, 2015, 02:02:46 AM
Is anyone currently working on improving the template related code? If not, I'll work on it and come up with a solution for this issue.
Hi, jat1. I think currently no one is working on the template related part of the parser and the codecompletion. It was two or three years ago that someone like blueshake, me, loaden worked on that parts. It is quite complex as I know, so if any question, ask here. Thanks.
Indeed, with the new standart (11 and 14), the template is better than before. The code completion for template is very important for me (I use exclusively template :D).
jat1, Thanks in advance if you work on that subject !
Good news: with revision 10339, I commit jat1's great patch to handle template related code completion(see the test file added in this revision). Many thanks to Jat1!!!
To handle the iterator related code completion, we may need to improve the parser on how to parse a statement.
(*it).| code suggestion here
Now, we need some operator precedence parser. (currently, we can only handle some pattern like AAA::BBB().CCC). In the above statement, we may have three steps:
1. solve the "it" -> result1
2, solve the operator * of result1 -> result2
3, list all the children of result2 -> result3
Thanks ollydbg. This issue as well as code refactoring are my next projects. I'll start looking into these.