Map error

View: New views
2 Messages — Rating Filter:   Alert me  

Map error

by Jeremy Dean-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

by Martin Sebor-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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