Compiler error using HashMap



  • On 06/04/2016 at 04:27, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   15-17 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi,

    I have the hashmap

    maxon::HashMap<Int32, LineChangeInterval *> lineChangeIntervals;

    If I try to add entries using FindOrCreateEntry like

    maxon::HashMap<Int32, LineChangeInterval *>::Entry *e = lineChangeIntervals.FindOrCreateEntry(hash, created);

    I get the compiler error C2228: left of '.ConstructHashMapEntry' must have class/struct/union in file hashmap.h line 498 (VS 2013)

    that is:      e = constructor.ConstructHashMapEntry(e, key);

    What am I missing? If I use FindEntry() and Put() it compiles without errors.

    Thanks for your help.



  • On 20/04/2016 at 00:54, xxxxxxxx wrote:

    Hello,

    we got word from the developers on this. Since HashMap is part of the "maxon" namespace it expects a "maxon::Bool" and not a "Bool" value for "created":

      
    typedef maxon::HashMap<Int, String> IntStringMap;  
    IntStringMap map;  
      
    maxon::Bool created = false;  
    IntStringMap::Entry* e = map.FindOrCreateEntry(42, created);  
      
    if(e)  
    {  
      // do something  
    }  
    

    best wishes,
    Sebastian


Log in to reply