Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Auto type complete on assignment

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
stpeev Posted - Jan 25 2008 : 07:58:44 AM
As you know when writing in C++ it can be quite frustrating to declare types when you assign var names or have loops.
e.g.1:
for (className::innerTypeDef::const_iterator& it = list.begin(); it != list.end; ++it)

e.g.2:
className::innerTypeDef retVal = myObj.DoSometingAndGetResult();

In both cases the type of "it" and "retVal" can be deducted from "list" and the return type of DoSometingAndGetResult(). So it will be nice if I can just write:
for ( it = m_list.begin() ....) or
retVal = myObj.DoSomething ...

and Visual assist to auto complete the proper type declaration for me.
16   L A T E S T    R E P L I E S    (Newest First)
support Posted - Dec 16 2011 : 1:50:40 PM
C++11 auto keyword support is case=13607, and is implemented in build 1862
tandr Posted - Mar 13 2008 : 10:40:11 PM
+1 for copy/paste variables type - it will do the trick. Would be nice to be able not to select variable first if it is the only closest (or cursor is in) variable around though..
feline Posted - Feb 19 2008 : 09:37:07 AM
case=3964
feline Posted - Feb 11 2008 : 10:36:35 AM
I also like this idea Just to be sure I understand correctly, znakeeye are you talking about VA placing the variable type from the definition field into the clipboard?

Not the exact text from the definition field, but the same information.
jameso Posted - Feb 11 2008 : 03:28:54 AM
I *like* that idea...

James
znakeeye Posted - Feb 09 2008 : 2:38:31 PM
Another more general solution would be to add a short key for "copy the type of this variable".

That way, when you want to iterate through a vector or perhaps use a static method of some class, you simple select the variable and press the key combination (ctrl+alt+c?):

vector< complex_type<int> > m_vec;

m_vec // select, ctrl+alt+c
vector< complex_type<int> > // ctrl+v, and you can type "::iterator" or whatever...
feline Posted - Feb 02 2008 : 08:31:09 AM
First point, it wont be long before someone writes:

float auto;
auto = 2.3;

and then wants to know why VA is not replacing auto, or wants to know why VA is replacing auto.

Second point, some list of all possible types is exactly what I am trying to avoid. As soon as you start looking at class hierarchies a certain amount of scanning / considering could be required to figure out every single type that might be an option.
tandr Posted - Feb 01 2008 : 3:26:23 PM
(auto is very old keyword as a matter of fact, just not used in C++)

Well, till "new" auto will properly supported by some well-known compilers, we probably will have linux rewritten in C#... :)

Anyway - I got an idea - may be to create auto "auto" expander!

imagine you type

Some_Obscure_Heavily_Typedefed<Not_Less_Obscure_Typedef>::const_iterator end;

auto babu = end;|

and then press magic Alt-Ctrl-F13, get a list of choices from fully compacted descriptions to fully expanded typedefs and select first one (fully compacted) and it opens to



Some_Obscure_Heavily_Typedefed<Not_Less_Obscure_Typedef>::const_iterator end;

Some_Obscure_Heavily_Typedefed<Not_Less_Obscure_Typedef>::const_iterator babu = end;|



yeah... I know.

Andrey
znakeeye Posted - Jan 29 2008 : 2:38:05 PM
Probably a lot, since you probably use Boost already. As far as I remember, "auto" is the only new keyword.
feline Posted - Jan 29 2008 : 12:56:01 PM
Interesting. I wonder how much of it our parser supports.

I suspect this could become "interesting".
znakeeye Posted - Jan 29 2008 : 09:20:28 AM
VS 2008 supports "C++0x TR1". Look for this at MSDN:
VS90-VCFeaturePack-Beta-KB945273-x86x64-ENU.exe
feline Posted - Jan 29 2008 : 09:13:19 AM
This is where I am in two minds on this. 90, 95% of the time VA will probably be fine with this. The real question is, will it be fine often enough? Or will the edge / problem cases turn into a support nightmare?

Simple case, what happens here:

int nTest = 2;
foo = nTest * 1.2;
bar = nTest * 3;

I know what I probably want. I probably want a float, or maybe a double, or maybe a #define or typedef for "foo"
And I probably want an int, or long, or unsigned long, or long long for "bar".

I am getting good at dreaming up edge cases

When the item is simply being returned, unmodified, by a function then you *probably* want the return type. But when dealing with pointers and a class hierarchy it is quite common to want some base type, not the actual derived type being returned.

What people want and expect in these conditions is what concerns me.
accord Posted - Jan 28 2008 : 3:54:43 PM
Sometimes I move the carret over the symbol, and then using definition field of VAX (located next to the Goto button) to select and send type into the clipboard and then paste into the source It is a good substitute for the "auto" keyword. So VAX already handle this partly (ok, maybe there are some edge cases, I did'nt used for extreme difficult cases yet )
feline Posted - Jan 28 2008 : 08:28:42 AM
Interesting. I wonder how that handles some of the edge cases, with pointer types and implicit casts.

The obvious problem with that is that current compilers are rather unlikely to support it.
znakeeye Posted - Jan 27 2008 : 3:44:14 PM
Not a bad idea, but the upcoming standard of C++ already supports this:
for (auto it = v.begin(); it != v.end())

By the way, you used a reference to the iterator. Have never seen that. Is it correct?
feline Posted - Jan 25 2008 : 11:00:55 AM
A very similar idea came up recently. When using loops to scan across a collection I personally use a VA Snippet that prompts me for the details, to insert the loop.

More generally though, this works well for some types, but not all types. What happens when you are using a pointer type? What about implicit casts?

VA can probably get this right quite often, but there are a lot of edge cases. The question is simply can VA get it right often enough to be reliable and useful?

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000