Author |
Topic |
|
Frunobulax
Ketchup Master
84 Posts |
Posted - Sep 08 2007 : 11:05:37 AM
|
Hi,
it seems to me that the autocompletion feature of VAX has trouble with STL containers used with boost shared pointers. Consider the following example:
---- class MyClass { void foo(); }; typedef boost::shared_ptr<MyClass> MyPtr; typedef std::set<MyPtr> MySet;
for (MySet::iterator it = myContainer.begin(); it != myContainer.end(); ++it) { (*it)->[autocompletion here] ----
Being at [autocompletion here], VAX should suggest foo(). Instead it suggests the function that a boost shared pointer offers, like get(), count_type() etc.
VAX version is 1559, just downloaded.
Regards, tv |
"The nice part about being a pessimist is that you are constantly being either proven right or pleasantly surprised." (George F. Will)
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Sep 10 2007 : 09:06:40 AM
|
That is a little odd. Changing the code to read:
#include <boost/shared_ptr.hpp>
#include <set>
class MyClass {
void foo();
};
typedef boost::shared_ptr<MyClass> MyPtr;
typedef std::set<MyPtr> MySet;
static void testUsingTypedefBoostSharedPtr()
{
MySet myContainer;
for (MySet::iterator it = myContainer.begin(); it != myContainer.end(); ++it) {
(*it)->|;
}
}
so that it will compile, at this point I am seeing the single item "foo()" in the listbox.
If you use this code what result do you get? Does VA know about boost::shared_ptr? If you place the caret into the filename in the:
#include <boost/shared_ptr.hpp>
line does VA show you the full path for this file in the definition field at the top of the editor?
Do you have:
VA Options -> Advanced -> listboxes -> Get content from default Intellisense
turned on? It is turned off for my tests. |
zen is the art of being at one with the two'ness |
|
|
Frunobulax
Ketchup Master
84 Posts |
Posted - Sep 10 2007 : 11:41:36 AM
|
quote: Originally posted by feline
That is a little odd. Changing the code to read:
#include <boost/shared_ptr.hpp>
#include <set>
class MyClass {
void foo();
};
typedef boost::shared_ptr<MyClass> MyPtr;
typedef std::set<MyPtr> MySet;
static void testUsingTypedefBoostSharedPtr()
{
MySet myContainer;
for (MySet::iterator it = myContainer.begin(); it != myContainer.end(); ++it) {
(*it)->|;
}
}
so that it will compile, at this point I am seeing the single item "foo()" in the listbox.
If you use this code what result do you get?
This works for me. However, if I type "it->|" then VAX suggests foo() too, which is incorrect (boost shared pointers overload the "->" operator so the result of this is just a shared pointer and does not evaluate to the underlying class).
I just played around a little and could reproduce the problem with a bit of sample code that is closer to the code structure causing the problem. Perhaps the forward declaration causes the problem?
#include "stdafx.h"
#include <set>
#include <boost/shared_ptr.hpp>
namespace bar {
class MyClass;
typedef boost::shared_ptr<MyClass> MyPtr;
typedef std::set<MyPtr> MySet;
}
namespace bar {
class MyClass {
public:
void foo(void) { }
};
}
void myFunc(void) {
bar::MySet mySet;
MyClass myClass;
myClass.foo(); /* correct suggesion */
for (bar::MySet::iterator it = mySet.begin(); it != mySet.end(); ++it) {
(*it)->foo(); /* foo is not suggested */
}
}
quote:
Does VA know about boost::shared_ptr? If you place the caret into the filename in the:
#include <boost/shared_ptr.hpp>
line does VA show you the full path for this file in the definition field at the top of the editor?
Yes, and since it does suggest the boost functions I wouldn't expect a problem here.
quote:
Do you have:
VA Options -> Advanced -> listboxes -> Get content from default Intellisense
turned on? It is turned off for my tests.
It's turned off (basically the only thing I configured after installing VAX was that I turned off the underlines, having german comments in the code :-)
Regards, tv
|
"The nice part about being a pessimist is that you are constantly being either proven right or pleasantly surprised." (George F. Will)
|
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Sep 10 2007 : 4:53:39 PM
|
I had to change the code slightly to get it to compile:
void myFunc(void) {
bar::MySet mySet;
bar::MyClass myClass;
myClass.foo(); /* correct suggesion */
for (bar::MySet::iterator it = mySet.begin(); it != mySet.end(); ++it) {
(*it)->foo(); /* foo is not suggested */
}
}
having done that I get "foo" suggested on "myClass." , "it->" and "(*it)->"
What happens when you make the same change on your system? |
zen is the art of being at one with the two'ness |
|
|
Frunobulax
Ketchup Master
84 Posts |
Posted - Sep 11 2007 : 04:17:50 AM
|
quote: Originally posted by feline
I had to change the code slightly to get it to compile:
void myFunc(void) {
bar::MySet mySet;
bar::MyClass myClass;
myClass.foo(); /* correct suggesion */
for (bar::MySet::iterator it = mySet.begin(); it != mySet.end(); ++it) {
(*it)->foo(); /* foo is not suggested */
}
}
having done that I get "foo" suggested on "myClass." , "it->" and "(*it)->"
What happens when you make the same change on your system?
Sorry, I did play around before I posted and obviously forgot to put back the namespace in the last iteration. But the problem still remains on my system: I duplicated the change and VA still does not suggest foo() when typing either "(*it)->" or "it->". (And yes, this time I made sure that the code compiles :-)
Version info from VAX is below, I use Visual Studio 2005 Professional, english, service pack 1.
Regards, tv
VA_X.dll file version 10.3.1559.0 built 2007.07.06 VAOpsWin.dll version 1.3.2.4 VATE.dll version 1.0.5.8 DevEnv.exe version 8.0.50727.762 msenv.dll version 8.0.50727.762 Font: Courier New 13(Pixels) Comctl32.dll version 6.0.2900.2982 Windows XP 5.1 Build 2600 Service Pack 2 2 processors
Platform: Win32 Stable Includes: C:\\Programme\\vs80\\VC\\include; C:\\Programme\\vs80\\VC\\atlmfc\\include; C:\\Programme\\vs80\\VC\\PlatformSDK\\include; C:\\Programme\\vs80\\SDK\\v2.0\\include;
Library Includes: C:\\Programme\\vs80\\VC\\atlmfc\\src\\mfc; C:\\Programme\\vs80\\VC\\atlmfc\\src\\mfcm; C:\\Programme\\vs80\\VC\\atlmfc\\src\\atl; C:\\Programme\\vs80\\VC\\crt\\src;
Other Includes:
|
"The nice part about being a pessimist is that you are constantly being either proven right or pleasantly surprised." (George F. Will)
|
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Sep 11 2007 : 08:25:12 AM
|
I am not seeing anything odd in your about information, so I am not sure why we are getting different results.
Are you able to reproduce this problem in a new default C++ project? If so would you be able to send me a copy of the project? That way we will know that I am testing the same thing you are.
If so please submit the files via the form:
http://www.wholetomato.com/support/contact.asp
including this thread ID or URL in the description, so we can match it up. |
zen is the art of being at one with the two'ness |
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Sep 11 2007 : 11:58:16 AM
|
I have the files, thank you for those.
I can sort of reproduce the effect you are describing, but only if VA does not know how to locate the boost header files. Once I have added boost ( C:\\boost\\boost_1_33_1\\ ) to the stable include directory list (via the IDE) then both examples work perfectly for me in your project.
I always get "foo" suggested.
This suggests that the problem either lies in the version of boost you are using, or in any machine specific changes you have made to VA's stdafx.h files.
If you add boost to the IDE's include directories: http://www.wholetomato.com/products/features/directories.asp do you still see this problem?
Which version of boost are you using? I am running 1.33.1 currently. |
zen is the art of being at one with the two'ness |
|
|
Frunobulax
Ketchup Master
84 Posts |
Posted - Sep 11 2007 : 12:24:14 PM
|
quote: Originally posted by feline
I have the files, thank you for those. [...] If you add boost to the IDE's include directories: http://www.wholetomato.com/products/features/directories.asp do you still see this problem?
Indeed, adding boost to the list of static headers does solve the problem. That's good news.
But I'm afraid I'm still not happy. The problem is that we're using a rather large zoo of includes which are mostly, but not entirely static (in particular they are branch-dependent). So while I could probably copy the boost headers into a fixed local directory (assuming that boost upgrades are rare), what about those other zillion include files? :-)
It seemed to me that VAX does correctly parse additional include directories specified in the VC project file?
Regards, tv
(BTW, we're using boost v1.33.1 too.)
|
"The nice part about being a pessimist is that you are constantly being either proven right or pleasantly surprised." (George F. Will)
|
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Sep 11 2007 : 12:26:21 PM
|
How *exactly* are you adding the boost directory to the project?
VA should have no problems with C++ additional include directories, I, and various of our users, often use this method. So this suggests you are doing something different. |
zen is the art of being at one with the two'ness |
|
|
Frunobulax
Ketchup Master
84 Posts |
Posted - Sep 11 2007 : 3:12:12 PM
|
The usual way - project properties, C++ options, additional include directories. But wait, there is something unusual - instead of using #include "whatnot.h" we use #include <whatnot.h> for those headers - VC has no problem with that, because it searches additional include directories for both versions.
Regards, tv
|
"The nice part about being a pessimist is that you are constantly being either proven right or pleasantly surprised." (George F. Will)
|
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Sep 12 2007 : 08:42:25 AM
|
Using your test project I did the following test:
* I removed boost from the stable include directories list, rebuild VA's symbol database, and made sure that I got the wrong suggestion for the iterator * I then set the C++ additional include directories (properties on the project VAXTest) to C:\\boost\\boost_1_33_1 * I restarted VS2005, to make sure that VA found this change to the project * I tried typing -> after "it" and "(*it)", "foo()" was suggested in both cases
This is working perfectly for me.
When I place the caret in the file name on the line:
#include <boost/shared_ptr.hpp>
the definition field shows:
C:\\boost\\boost_1_33_1\\boost\\shared_ptr.hpp
Do you have several additional include directories set? If so I am wondering if somehow this is confusing VA. When I went into the project properties I noticed that the additional include directories were set to "D:\\R83-Checkout\\bif\\install\\inc", where the path was wrapped in double quotes. I changed this to C:\\boost\\boost_1_33_1, note no double quotes. |
zen is the art of being at one with the two'ness |
|
|
Frunobulax
Ketchup Master
84 Posts |
Posted - Sep 12 2007 : 11:05:08 AM
|
quote: Originally posted by feline
Using your test project I did the following test: * I removed boost from the stable include directories list, rebuild VA's symbol database, and made sure that I got the wrong suggestion for the iterator * I then set the C++ additional include directories (properties on the project VAXTest) to C:\\boost\\boost_1_33_1
Yes, it appears that a restart is necessary.
quote:
* I restarted VS2005, to make sure that VA found this change to the project * I tried typing -> after "it" and "(*it)", "foo()" was suggested in both cases
Which is still wrong :-)
quote:
Do you have several additional include directories set? If so I am wondering if somehow this is confusing VA. When I went into the project properties I noticed that the additional include directories were set to "D:\\R83-Checkout\\bif\\install\\inc", where the path was wrapped in double quotes. I changed this to C:\\boost\\boost_1_33_1, note no double quotes.
I just checked, the quotes seem to appear sometimes if I use the VC GUI to add include paths (in additional include directories, use the "..." button to open the dialog, then the "new dir" button and then again the "..." to add the new dir). But this doesn't always happen, and I just checked a few of our projects, the include dirs are without quotes. Still, I just checked my real-life project and the problem persists, even adding the boost include dir to the list of static directories didn't solve the problem. If I explicitly include the boost header with #include <boost/shared_ptr.hpp> and place the caret there, then VAX correctly shows the location of the included file, but still does not suggest correctly.
Yes, we do have several include directories, they look like "dir1;dir2;dir3" (in the .vcproj file, no double quotes visible in the VC IDE), but that doesn't seem to be the problem either (I copied the additional includes from my real-life project into my test project and still everything worked).
I just tried a number of things to reproduce the problem. I'm not sure what exactly did the trick, but now I've ended up again with a slightly modified sample project that compiles fine but where VAX won't suggest foo(), and where it doesn't matter if I place boost in the static includes or not. I'll send you this project - if it works on your machine then I'm almost out of ideas...
Regards, tv
|
"The nice part about being a pessimist is that you are constantly being either proven right or pleasantly surprised." (George F. Will)
|
Edited by - Frunobulax on Sep 12 2007 11:09:33 AM |
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Sep 13 2007 : 11:37:04 AM
|
I am starting to get really confused here.
I have replied to your email, since that is where the confusion is currently centred. |
zen is the art of being at one with the two'ness |
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
Posted - Sep 14 2007 : 3:55:19 PM
|
I finally have a reproducible test case:
case=8873 |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|