std::map doesn't work !! 
Author Message
 std::map doesn't work !!

( Where I put CMyClass, I meant to put SerifGDI::CColour )

oops, sorry ;o)


Quote:
> Can you tell me why doing this works OK:

>  typedef std::map< COLORREF, SerifGDI::CColour*, std::less<COLORREF> >
Map;

>   Map map;
>   for ( int i = 0; i < obj->ColourMapTablePtr->Count; i++ )
>   {
>         // Get the original colour
>         COLORREF crColour = RGB(0, 0, 0);

>         // Create an RGB colour
>         CMyClass* pPointer = new CMyClass;

>        // Insert the item into our map
>        map[ crColour ] = pNewColour;
>   }

> And this fails:

> class MyWrapper : public std::map< COLORREF, SerifGDI::CColour*,
> std::less<COLORREF> >;
> {
>     MyWrapper();
>     ~MyWrapper();
> };

>   MyWrapper map;
>   for ( int i = 0; i < obj->ColourMapTablePtr->Count; i++ )
>   {
>         // Get the original colour
>         COLORREF crColour = RGB(0, 0, 0);

>         // Create an RGB colour
>         CMyClass* pPointer = new CMyClass;

>        // Insert the item into our map
>        map[ crColour ] = pNewColour;
>   }

> Regards,

> Chris Jordan



Tue, 04 Jun 2002 03:00:00 GMT  
 std::map doesn't work !!
Can you tell me why doing this works OK:

 typedef std::map< COLORREF, SerifGDI::CColour*, std::less<COLORREF> > Map;

  Map map;
  for ( int i = 0; i < obj->ColourMapTablePtr->Count; i++ )
  {
        // Get the original colour
        COLORREF crColour = RGB(0, 0, 0);

        // Create an RGB colour
        CMyClass* pPointer = new CMyClass;

       // Insert the item into our map
       map[ crColour ] = pNewColour;
  }

And this fails:

class MyWrapper : public std::map< COLORREF, SerifGDI::CColour*,
std::less<COLORREF> >;
{
    MyWrapper();
    ~MyWrapper();

Quote:
};

  MyWrapper map;
  for ( int i = 0; i < obj->ColourMapTablePtr->Count; i++ )
  {
        // Get the original colour
        COLORREF crColour = RGB(0, 0, 0);

        // Create an RGB colour
        CMyClass* pPointer = new CMyClass;

       // Insert the item into our map
       map[ crColour ] = pNewColour;
  }

Regards,

Chris Jordan



Tue, 04 Jun 2002 03:00:00 GMT  
 std::map doesn't work !!
Hi,

First of all, when you post such a question, it would help us if you could
also post exactly what errors you are getting.

Short of that, I can see one problem right off the bat.  Your CMyWrapper
class has only 'private' default constructors.  You need to make them
public.

Joe O'


Quote:
> Can you tell me why doing this works OK:

>  typedef std::map< COLORREF, SerifGDI::CColour*, std::less<COLORREF> >
Map;

>   Map map;
>   for ( int i = 0; i < obj->ColourMapTablePtr->Count; i++ )
>   {
>         // Get the original colour
>         COLORREF crColour = RGB(0, 0, 0);

>         // Create an RGB colour
>         CMyClass* pPointer = new CMyClass;

>        // Insert the item into our map
>        map[ crColour ] = pNewColour;
>   }

> And this fails:

> class MyWrapper : public std::map< COLORREF, SerifGDI::CColour*,
> std::less<COLORREF> >;
> {
>     MyWrapper();
>     ~MyWrapper();
> };

>   MyWrapper map;
>   for ( int i = 0; i < obj->ColourMapTablePtr->Count; i++ )
>   {
>         // Get the original colour
>         COLORREF crColour = RGB(0, 0, 0);

>         // Create an RGB colour
>         CMyClass* pPointer = new CMyClass;

>        // Insert the item into our map
>        map[ crColour ] = pNewColour;
>   }

> Regards,

> Chris Jordan



Tue, 04 Jun 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. SaveBarState (WORKS) LoadBarState(Doesn't Work)?

2. GetPrivateProfileSectionNames works in 2000, doesn't work in 98 or ME

3. Tooltip works and then doesn't work

4. Q147740 CWnd work-around doesn't work with control that uses lic file

5. Error using Microsoft's implementation of std::map

6. std::map's cost

7. VC7: cstdio doesn't put printf in std

8. Passing std::set and std::map objects between 2 dlls

9. Calling ADO's GetRows() from VC doesn't work

10. Don't know why this doesn't work, but

11. TERMWAIT Win 3.1 sample doesn't work under '95

12. VC++ 5.0 doesn't support ITS_RAW in ISAPI extension parse map

 

 
Powered by phpBB® Forum Software