User forums > General (but related to Code::Blocks)

Code Completion in foreach loop

(1/4) > >>

koonschi:
Hi,

I like using the foreach statement in c++, provided with the c++11 standard:


--- Code: ---list<string> strList;
for(string &str : strList)
{
cout << str << endl;
}

--- End code ---

But now my problem is, that, in the for block, the variable "str" is unknown by the code completion, which can be quite annoying/confusing.

Is there anything that can be done to resolve this problem?

edit: I'm using the latest nightly build.

Thanks!

Koonschi

oBFusCATed:

--- Quote from: koonschi on October 04, 2012, 11:40:39 am ---Is there anything that can be done to resolve this problem?

--- End quote ---
Make a patch that implements this feature.

killerbot:
this is not purely a problem with the range based for loop, it is a problem with every declaration in the for(;;) construct, also in declarations in if() construct  [I am not talking about the bodies/blocks of the for/if]


--- Code: ---if(TxmlElement* problem = handle.FirstChildElement("test"))
{
  /// ---> will not code complete on 'problem'
}

--- End code ---

koonschi:
oBFusCATed: Sounds good. How exactly would that work?

oBFusCATed:
Here is the code for the latest revision of C::B: http://svn.berlios.de/wsvn/codeblocks/trunk/?rev=8431&peg=8431#a0b40758157c8f16fa703ca3be466fa8a
Go browse it, study it, find where it must be modified, modify it, test the modification, read this http://wiki.codeblocks.org/index.php?title=Creating_a_patch_to_submit_to_BerliOS_%28Patch_Tracker%29 , create a patch, submit to berlios, fix reported bugs.

I hope, I've not missed any of the required steps.  ::)

Navigation

[0] Message Index

[#] Next page

Go to full version