You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Jeremy Dean <Je...@roguewave.com> on 2009/02/18 21:51:25 UTC

Map error

I have a customer that getting the following error when trying to
compile his code:
 
Platform: Solaris 9
Compiler: SunPro 5.9
Build: Multithreaded-Debug-shared
 
Error Message:
"include/map", line 206: Error: second is not a member of RWCString.
"GOCC_GuiPref.cc", line 93:     Where: While instantiating
"std::map<RWCString, GOCC_WinPref*, std::less<RWCString>,
std::allocator<RWCString>>::operator[](const RWCString&)".
 
Code:
Line 206 of Map looks like this:
    mapped_type& operator[] (const key_type &__k) {
        // note: temporary is necessary to avoid an xlC 5.0 bug (PR
#25040)
        iterator __i = insert (value_type (__k, mapped_type ())).first;
        return (*__i).second;
    }
 
Jeremy


Re: Map error

Posted by Martin Sebor <ms...@gmail.com>.
Jeremy Dean wrote:
> I have a customer that getting the following error when trying to
> compile his code:
>  
> Platform: Solaris 9
> Compiler: SunPro 5.9
> Build: Multithreaded-Debug-shared
>  
> Error Message:
> "include/map", line 206: Error: second is not a member of RWCString.
> "GOCC_GuiPref.cc", line 93:     Where: While instantiating
> "std::map<RWCString, GOCC_WinPref*, std::less<RWCString>,
> std::allocator<RWCString>>::operator[](const RWCString&)".

This doesn't look like a valid specialization of std::map. The
template is declared like so:

   template <class Key, class T,
             class Compare = less<Key>,
             class Allocator = allocator<pair<const Key, T> > >
   class map;

I.e., the type of map from RWCString to GOCC_WinPref* is:

   map<RWCString, GOCC_WinPref*,
       less<RWCString>,
       allocator<pair<const RWCString, GOCC_WinPref*> > >;

Note that allocator is specialized on

   pair<const RWCString, GOCC_WinPref*>.

Martin

>  
> Code:
> Line 206 of Map looks like this:
>     mapped_type& operator[] (const key_type &__k) {
>         // note: temporary is necessary to avoid an xlC 5.0 bug (PR
> #25040)
>         iterator __i = insert (value_type (__k, mapped_type ())).first;
>         return (*__i).second;
>     }
>  
> Jeremy
> 
>