Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CMap and its key types

CMap and its key types

Scheduled Pinned Locked Moved C / C++ / MFC
comhelpquestiondiscussion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Polly Parrot
    wrote on last edited by
    #1

    Hi everybody, here's a newbie one for y'all: I was hoping that I'd be able to create an instance of CMap using very simplistic keys with something like: CMap< int, int&, CMyClass, CMyClass& > m_myMap; But I get a "'operator =' function is unavailable" error from the compiler. Is this because I have to use keys that are objects of a class, or what? Best regards, Håkan Olsson ------------------------------------ Håkan Olsson, M. Sc. Technical Project Manager Airborne Hydrography AB, Sweden http://www.airbornehydro.com NOTE: All standpoints, opinions, suggestions etc in the above stands for me and me alone and are not in any way affiliated with or endorsed by Airborne Hydrography AB.

    A 1 Reply Last reply
    0
    • P Polly Parrot

      Hi everybody, here's a newbie one for y'all: I was hoping that I'd be able to create an instance of CMap using very simplistic keys with something like: CMap< int, int&, CMyClass, CMyClass& > m_myMap; But I get a "'operator =' function is unavailable" error from the compiler. Is this because I have to use keys that are objects of a class, or what? Best regards, Håkan Olsson ------------------------------------ Håkan Olsson, M. Sc. Technical Project Manager Airborne Hydrography AB, Sweden http://www.airbornehydro.com NOTE: All standpoints, opinions, suggestions etc in the above stands for me and me alone and are not in any way affiliated with or endorsed by Airborne Hydrography AB.

      A Offline
      A Offline
      Antony M Kancidrowski
      wrote on last edited by
      #2

      It is saying that you need to implement an operator = within CMyClass.

      CMyClass& operator =(const CMyClass& right)
      {
        // Do the copy of data
        // e.g. m_Data = right.m_Data;

      return *this;
      }

      Ant. I'm hard, yet soft.
      I'm coloured, yet clear.
      I'm fruity and sweet.
      I'm jelly, what am I? Muse on it further, I shall return!
      - David Walliams (Little Britain)

      P 1 Reply Last reply
      0
      • A Antony M Kancidrowski

        It is saying that you need to implement an operator = within CMyClass.

        CMyClass& operator =(const CMyClass& right)
        {
          // Do the copy of data
          // e.g. m_Data = right.m_Data;

        return *this;
        }

        Ant. I'm hard, yet soft.
        I'm coloured, yet clear.
        I'm fruity and sweet.
        I'm jelly, what am I? Muse on it further, I shall return!
        - David Walliams (Little Britain)

        P Offline
        P Offline
        Polly Parrot
        wrote on last edited by
        #3

        UHh... OK. I thought that the "= not defined" thing was about CMap member functions not being able to compare keys rather than the objects...? Anyway, thanks I'll try that! ------------------------------------ Håkan Olsson, M. Sc. Technical Project Manager Airborne Hydrography AB, Sweden http://www.airbornehydro.com NOTE: All standpoints, opinions, suggestions etc in the above stands for me and me alone and are not in any way affiliated with or endorsed by Airborne Hydrography AB.

        M 1 Reply Last reply
        0
        • P Polly Parrot

          UHh... OK. I thought that the "= not defined" thing was about CMap member functions not being able to compare keys rather than the objects...? Anyway, thanks I'll try that! ------------------------------------ Håkan Olsson, M. Sc. Technical Project Manager Airborne Hydrography AB, Sweden http://www.airbornehydro.com NOTE: All standpoints, opinions, suggestions etc in the above stands for me and me alone and are not in any way affiliated with or endorsed by Airborne Hydrography AB.

          M Offline
          M Offline
          Mike Beckerleg
          wrote on last edited by
          #4

          If it was complaining about a compare method it would be "==" not "=". Mike

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups