Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Intellisense fails when using boost::enable_if

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
burbelgruff Posted - Oct 02 2009 : 08:06:21 AM
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?
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Oct 06 2009 : 6:05:12 PM
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.
burbelgruff Posted - Oct 02 2009 : 3:51:01 PM
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.

feline Posted - Oct 02 2009 : 12:10:22 PM
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.

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