deprecation, no breathing!

Started by
1 comment, last by silverphyre673 18 years, 11 months ago
Disturbed aside, from the aforementioned cross_map post, I am getting a whole slew of these errors: [Warning] `std::map<A, B, std::less<_Key>, std::allocator<std::pair<const _Key, _Tp> > >::iterator' is implicitly a... (cut off) [Warning] implicit typename is deprecated, please see the documentation for details For these functions, whose purpose should be fairly obvious.

    std::map< A, B >::iterator first_begin()
    {
        return first_map.begin();
    }
    std::map< B, A >::iterator second_begin()
    {
        return second_map.begin();
    }
    std::map< A, B >::iterator first_end()
    {
        return first_map.end();
    }
    std::map< B, A >::iterator second_end()
    {
        return second_map.end();
    }

my siteGenius is 1% inspiration and 99% perspiration
Advertisement
Change this to
    typename std::map< A, B >::iterator first_begin()    {        return first_map.begin();    }    typename std::map< B, A >::iterator second_begin()    {        return second_map.begin();    }    typename std::map< A, B >::iterator first_end()    {        return first_map.end();    }    typename std::map< B, A >::iterator second_end()    {        return second_map.end();    }


and you'll be fine. The problem is that the compiler does not know if std::map< A, B>::iterator is a member typedef, member function, or member variable. Earlier, gcc would attempt to automatically determine which of those it is, now this doesn't happen. That's why you have to explicitly point out that std::map <A, B> is a typename.

For more information refer to agapow.net's article on implicit typename.
oh yeah - forgot. I actually asked a similar question a few months ago, but forgot. Yay memory. Thanks!
my siteGenius is 1% inspiration and 99% perspiration

This topic is closed to new replies.

Advertisement