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
 boost::optional
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Frunobulax
Ketchup Master

84 Posts

Posted - Feb 18 2011 :  04:51:38 AM  Show Profile  Reply with Quote
Hi,

do you have any update on the parsing of boost::optional?

The bug report is more than 2 years old (http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=7249, case 2154 was already open at the time).

The inability to parse optionals is a major problem because we rely heavily on optionals, and all VAX completion features stop working once an optional is in play.

I will recommend to my company to not renew maintenance until this problem is solved.

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
19024 Posts

Posted - Feb 18 2011 :  12:57:41 PM  Show Profile  Reply with Quote
Apologies for the slow progress on this. This is still down as a high priority bug, but some of the boost libraries are very complex and difficult for VA to parse.

I have found a pair of possible work arounds that might help you. The first work around is to add this to VA's StdAfx.h file:

namespace boost {
    template<typename T> class optional {
        T* operator->()
        {
            
        }
    };
}


this is working for me, using a simple test case. Hopefully this will work for you, without requiring you to make any edits to your code.

My second work around is to add

#define VA_BOOST_OPTIONAL(x) x

to VA's StdAfx.h file, but I then had to modify my test code, giving me:

#include <set>
#include <boost/optional.hpp>

#define VA_BOOST_OPTIONAL(x) boost::optional< x >

void test(void) {
	boost::optional<std::set<long> > maybeSet1 = std::set<long>();
	VA_BOOST_OPTIONAL(std::set<long>) maybeSet2 = std::set<long>();

	maybeSet1->insert(0);	// underlined
	maybeSet2->insert(0);	// no underlining, and listbox works
};


Edit VA's "StdAfx.h" file as explained in this FAQ entry:

http://docs.wholetomato.com?W302

add the entries at the bottom, making sure there is a blank line at the end of the file. This file is used to help VA's parser with difficult code, and can be used to work around odd effects. After modifying this file you need to rebuild the VA symbol database for the changes to take effect:

VA Options -> Performance -> General -> Rebuild symbol databases

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

Frunobulax
Ketchup Master

84 Posts

Posted - Feb 22 2011 :  05:27:10 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

Apologies for the slow progress on this. This is still down as a high priority bug, but some of the boost libraries are very complex and difficult for VA to parse.

I have found a pair of possible work arounds that might help you. The first work around is to add this to VA's StdAfx.h file:

namespace boost {
    template<typename T> class optional {
        T* operator->()
        {
            
        }
    };
}


this is working for me, using a simple test case. Hopefully this will work for you, without requiring you to make any edits to your code.



Works like a charm. (Good, because modifying code is not an option in this case.) Thanks for the workaround.

tv

"The nice part about being a pessimist
is that you are constantly being either
proven right or pleasantly surprised."
(George F. Will)
Go to Top of Page

guest
Junior Member

15 Posts

Posted - Feb 22 2011 :  11:17:43 AM  Show Profile  Reply with Quote
You can also try this, which covers most of the important stuff inside boost::optional.

/* boost::optional */
namespace boost
{
   namespace optional_detail
   {
      /* boost::optional default types */
      template<class T>
      struct types_when_isnt_ref
      {
         typedef T const &reference_const_type;
         typedef T       &reference_type;
         typedef T const *pointer_const_type;
         typedef T       *pointer_type;
         typedef T const &argument_type;
      };

      template <class T>
      class __optional_types : public types_when_isnt_ref<T>
      {
      };

      /* boost::optional types for references */
      template<class T>
      struct types_when_is_ref
      {
         typedef T raw_type;

         typedef raw_type& reference_const_type;
         typedef raw_type& reference_type;
         typedef raw_type* pointer_const_type;
         typedef raw_type* pointer_type;
         typedef raw_type& argument_type;
      };

      template <class T>
      class __optional_types<T &> : public types_when_is_ref<T>
      {
      };

      struct optional_tag
      {
      };

      template<class T>
      class optional_base : public optional_tag
      {
         protected:
          typedef T value_type;

          typedef __optional_types<T> types;

          typedef typename types::reference_type       reference_type;
          typedef typename types::reference_const_type reference_const_type;
          typedef typename types::pointer_type         pointer_type;
          typedef typename types::pointer_const_type   pointer_const_type;
          typedef typename types::argument_type        argument_type;
      };
   }

   template <class T>
   class optional : public optional_detail::optional_base<T>
   {
      typedef optional_detail::optional_base<T> base;

   public:
      typedef optional<T> this_type;

      typedef typename base::value_type           value_type;
      typedef typename base::reference_type       reference_type;
      typedef typename base::reference_const_type reference_const_type;
      typedef typename base::pointer_type         pointer_type;
      typedef typename base::pointer_const_type   pointer_const_type;
      typedef typename base::argument_type        argument_type;

      reference_const_type get() const;
      reference_type       get();

      reference_const_type get_value_or(reference_const_type v) const;
      reference_type       get_value_or(reference_type       v);

      pointer_const_type operator->() const;
      pointer_type       operator->();

      reference_const_type operator *() const;
      reference_type       operator *();
   };
}
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19024 Posts

Posted - Feb 24 2011 :  10:58:14 PM  Show Profile  Reply with Quote
Thank you for this

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