tags:

views:

329

answers:

8

Every IDE I've tried fails to provide code-completion when something template-related is used. For example,

boost::shared_ptr<Object> ptr;
ptr->[cursor is here]

Is there IDE that can provide code completion in this case?

+6  A: 

Visual Studio with Visual Assist X handles that case, but still fails more complex code.

Marcus Lindblom
+5  A: 

Actually this is a fairly simple template use-case, Qt Creator can handle this easily and more complex template code aswell.

Idan K
It fails for the boost::static_pointer_cast<DerivedClass>(baseClassObject)->[cursor is here], where baseClassObject have type BaseClass, and DerivedClass is derived from BaseClass. But, anyway, it is currently the best one.
Mad Fish
You'll always find cases that work in a specific IDE but don't in another. The question is what works in most cases. Qt Creator is an evolving IDE and is free. I'm also quite certain that if you issue a bug on a specific case, such as the one you mentioned with boost::static_pointer_cast it will be addressed.
Idan K
What's the connection between "is an evolving IDE" and "is actually a *good* IDE"? If it is evolving, that juts means it might one day *become* good, it certainly doesn't automatically imply that it is good *now*.
jalf
The question here isn't what's a "good" IDE. The author wanted an IDE that handles some particular template code and Qt Creator does that. My comment was merely to show that if there is something Qt Creator doesn't handle, it's likely that it will be fixed since it's in heavy development. Unlike other IDEs (VS) that take years to fix something.
Idan K
+1  A: 

G'day,

As an aside, I'd highly recommend Scott Meyers's excellent "Effective STL" book.

Item 49 "Learn to decipher STL-related compiler diagnostics" is worth the price of admission alone! The info therein is also applicable to decoding complex template related diagnostics beyond STL, e.g. for Boost.

Have fun.

BTW +1 for an interesting question.

cheers,

Rob Wells
A: 

I believe Slickedit (http://www.slickedit.com) handles this pretty well.

RA
A: 

Eclipse + the CDT plugin will handle this as well as the other tools mentioned

Glen
No, it doesn't. I've just checked. It gives a list of local variables instead.
Mad Fish
Are you sure you've set it up correctly? Works for me
Glen
+2  A: 

I've always use Eclipse C/C++ IDE. It supports code completion as well :)

linker
It doesn't work even for the mentioned use case.
Mad Fish
+2  A: 

Visual Studio 2010 has significantly improved in this area. There is an open beta going on, you should check it out.

Terry Mahaffey
Been using vs2010 (beta) for a month now, and I'd have to agree!
Beh Tou Cheh
A: 

Netbeans sometimes gets it right, but not always. It's non-deterministic: seemingly similar code may get parsed, or not, depending on the whim of the IDE.

quant_dev