This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 200686 - code model does not recognize type typeof(l.begin())
Summary: code model does not recognize type typeof(l.begin())
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 7.0.1
Hardware: All All
: P3 normal (vote)
Assignee: issues@cnd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-05 03:01 UTC by dennisbot
Modified: 2013-05-07 11:21 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dennisbot 2011-08-05 03:01:49 UTC
I've defined this #define foreach(it, l) for(typeof(l.begin()) it = l.begin(); it != l.end(); it++)
and then into main I have this:
foreach(it, apariciones) {
                maxi = max(maxi, it->second);
            }
where apariciones is a map<char, int> and the "it" is highlighted with red as it were a sintax error, but I have it at the top #define ... bla bla
but, It is running so it isn't a critical problem, but would be fine if it were identified.
that's it, thanks

Product Version = NetBeans IDE 7.0.1 (Build 201107282000)
Operating System = Windows XP version 5.1 running on x86
Java; VM; Vendor = 1.6.0_19
Runtime = Java HotSpot(TM) Client VM 16.2-b04
Comment 1 Alexander Simon 2011-09-20 08:10:59 UTC
Example:
#include <cstdlib>
#include <map>
#define foreach(it, l) for(typeof(l.begin()) it = l.begin(); it != l.end(); it++)

using namespace std;

int main(int argc, char** argv) {
    map<char, int> apariciones;
    int maxi;

    foreach(it, apariciones) {
        maxi = max(maxi, it->second);
    }

    for(map<char, int>::iterator it = apariciones.begin(); it != apariciones.end(); it++) {
        maxi = max(maxi, it->second);
    }

    return 0;
}
Comment 2 nnnnnk 2011-10-06 12:02:00 UTC
"typeof" is not a part of C++ standard.
It some kind of "decltype" from C++11 alias.