Author Topic: several tagging issue: iterator and BOOST_FOREACH  (Read 6075 times)

scsnow

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
several tagging issue: iterator and BOOST_FOREACH
« on: January 27, 2014, 05:08:34 PM »
SlickEdit 2013 (v18.0.1.2 32-bit)

1)
typedef std::map<uint32_t, std::set<std::string>> Event2SourceIds_t;
typedef std::map<uint32_t, std::set<std::string>>::iterator Event2SourceIdsIt_t;

int main() {
    Event2SourceIds_t map;
    Event2SourceIdsIt_t mapIt;

    for(mapIt = map.begin(); mapIt != map.end(); ++mapIt) {
        // no code completion after "second."
        // insert is highlighted as undefined symbol
        mapIt->second.insert("test");
    }
}

2)
// myNode is highlighted as undefined symbol
BOOST_FOREACH(boost::property_tree::ptree::value_type const &myNode, events.get_child("MyNodes")) {
...}

Dennis

  • Senior Community Member
  • Posts: 3999
  • Hero Points: 522
Re: several tagging issue: iterator and BOOST_FOREACH
« Reply #1 on: January 28, 2014, 01:05:45 PM »
Platform?
Compiler?
What version of Boost?
Have you tried defining BOOST_FOREACH() in the C/C++ preprocessing options?

scsnow

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Re: several tagging issue: iterator and BOOST_FOREACH
« Reply #2 on: January 28, 2014, 07:50:48 PM »
Linux / Debian 6
GCC 4.4.5
Boost 1.42
I didn't try to define anything in preprocessing options. Should it work out of the box?
I'm able to build this code w/o any errors.
« Last Edit: January 29, 2014, 09:39:57 AM by scsnow »

rajkej

  • Senior Community Member
  • Posts: 345
  • Hero Points: 14
Re: several tagging issue: iterator and BOOST_FOREACH
« Reply #3 on: January 29, 2014, 02:36:41 PM »
The editor and compiler are two different entities. The editor does not know what #define values to use as it does not parse the code to that level. So in some cases you will need to use the C/C++ preprocessing options and create a definition so that the editor knows how to parse the data for tagging purposes. Without creating those preprocessing options, the editor/tagging unit have no definition for the value and has trouble parsing the code which is what I would think is happening in your case.

Go to the options pane and search on preprocessing. Languages->Application Langugages->C/C++ Preprocessing. Then create the definitions you need to get the tagging to work. You might have a list of definitions to create there, I'm not sure because I don't use boost.

scsnow

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Re: several tagging issue: iterator and BOOST_FOREACH
« Reply #4 on: January 30, 2014, 08:39:38 PM »
What should I define under C/C++ Preprocessing options to get BOOST_FOREACH correctly handled?
What about iterators issue? I assume it's not related to preprocessing..

Dennis

  • Senior Community Member
  • Posts: 3999
  • Hero Points: 522
Re: several tagging issue: iterator and BOOST_FOREACH
« Reply #5 on: February 03, 2014, 02:04:14 PM »
BOOST_FOREACH() is a preprocessor macro.  That's what you need to define to have a chance to get that working.  Be aware that if BOOST_FOREACH uses other Boost preprocessor macros, you'll need to define those too.