
Hi, I use many Boost libraries, develop with MSVC (currently 2008), and build both my project and its Boost dependencies with Boost.Build. The one thing that's always frustrated me using boost is its tendency to confuse MSVC's Intellisense. I don't know if this holds true for other IDEs with an Intellisense-like capability, but heavy use of boost::shared_ptr and BOOST_FOREACH in particular seem to confuse Intellisense in a large project. MSVC never knows what to show when dereferencing a shared_ptr and it never defines the instance variable in BOOST_FOREACH. I came up with two fairly simple workarounds for this but I'm interested to hear if there's a better solution. If not, I'm wondering if the workarounds could go in boost itself. For shared_ptr, I use a conditional macro like: #ifdef INTELLISENSE #define TYPEDEF_SHARED_PTR(type) typedef type* type##Ptr #else #define TYPEDEF_SHARED_PTR(type) typedef boost::shared_ptr<type> type##Ptr #endif For BOOST_FOREACH, I do basically the same thing: #ifdef INTELLISENSE #define BOOST_FOREACH(a, b) a; #else #include <boost/foreach.hpp> #endif Then I just add INTELLISENSE to the VC project's preprocessor macros (not my build system) and Intellisense gets the job done a lot more often. I didn't look into whether MSVC defines an automatic preprocessor variable when Intellisense is parsing (which would be useful for helping it navigate complex code), but of course that would be even better. The obvious flaw for TYPEDEF_SHARED_PTR in my implementation is that it assumes a particular variable name scheme, but an "official" version could make both type names explicit. The are some other confusing libs like Boost.Preprocessor but I don't think they are as commonly used. The nice thing about these workarounds is they can be applied separately to each library. I'm wondering if other boost devs or users would be interested in having these workarounds in the official boost distro. For the smart_ptrs, it could go at the end of the headers. For BOOST_FOREACH, the whole foreach.hpp could be surrounded by #ifndef INTELLISENSE (so that all the stuff inside it doesn't need to be parsed for Intellisense) and the #else would define BOOST_FOREACH and BOOST_REVERSE_FOREACH as I did above. If not, maybe it's time I switched IDEs. Are there any that provide Intellisense-like capability with smart_ptrs and BOOST_FOREACH? :) Thanks, -Matt