map + parametrisierter comparator



  • Ich versuche eine map mit einem "comparer mit state" auszustatten:

    struct map_less
       {
          bool m_bIgnoreCase;
    
          map_less(bool ignoreCase)  : m_bIgnoreCase(ignoreCase) {}
    
          bool operator()(string const & a, string const & b)
          {
             return (m_bIgnoreCase) ? ... : ...;
          }
       };
    
    struct Y
    {
       map<string, X, map_less> m_map;
    
       Y() : m_map(????) {}
    };
    

    irgendwie bekomm' ich den Konstruktor nicht hin. geht das überhaupt?



  • z.B.

    struct Y
    {
       map<string, X, map_less> m_map;
    
       Y() : m_map( map_less( true)) {}
    };
    

Anmelden zum Antworten