Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Intellisense fails when using boost::enable_if
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

burbelgruff
New Member

8 Posts

Posted - Oct 02 2009 :  08:06:21 AM  Show Profile  Reply with Quote
I have the following case:


#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_enum.hpp>

template<typename Enum>
class ElementEnum {
public:
    void TestFunction();
};

template<typename Enum,typename EnableIf=void>
class Element;

template<typename Enum>
class Element<Enum,typename boost::enable_if<boost::is_enum<Enum> >::type>
    :   public ElementEnum<Enum>
{};

enum SomeEnum {
    Monday,
    Red,
    FortyTwo,
};

void test()
{
    Element<SomeEnum> a;
    a.TestFunction();
    
    ElementEnum<SomeEnum> b;
    b.TestFunction();
}


The intellisense fails to show anything for variable a, but successfully shows available functions for variable b.

The problem lies in the use of enable_if, where the compiler needs to select the correct overload of Element by using SFINAE.
(http://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error)

Are there any hopes that Visual Assist will ever support this?

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Oct 02 2009 :  12:10:22 PM  Show Profile  Reply with Quote
I have never heard of boost::enable_if and the wikipedia page is not really helping me. This looks / sounds like it is going to be using run time type information to check things, which reminds me of how dynamic_cast<> works.

If this is correct, and it is something of a guess, then in general I don't see how VA could support this, since you won't actually know the type until run time, so VA cannot help you with intellisense while coding.

zen is the art of being at one with the two'ness
Go to Top of Page

burbelgruff
New Member

8 Posts

Posted - Oct 02 2009 :  3:51:01 PM  Show Profile  Reply with Quote
Here is a more relevant link to the documenation of enable_if:
http://www.boost.org/doc/libs/1_40_0/libs/utility/enable_if.html

enable_if is about doing type selection at compile time.
This is all about compile time type information, so it is possible to generate intellisense for this.

This is a feature that uses only standard C++, so all major c++ compilers will compile the code I presented.

In order for VA to support this, it needs to have a quite complete internal c++ parser to generate the intellisense.

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Oct 06 2009 :  6:05:12 PM  Show Profile  Reply with Quote
I have put in a feature request for this:

case=33327

given that our parser still has problems with some boost code I am not sure how easy this will be to fix, but it is good to be aware of the problem. Thank you for the explanations.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000