1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

STL Map C++

Discussion in 'C++' started by MarkZweers, Dec 10, 2007.

  1. MarkZweers

    MarkZweers New Member

    Dec 10, 2007
    Likes Received:
    Trophy Points:

    For the comparison of several objects of the same class, in order to create a library with no duplicates, I would like to store all the attributes in a data structure (as a private attribute of that class). I have chosen the STL's "map" for this purpose.

    However, since the attributes can be "double", "int" or "bool", I would like the map to be templated somehow. The following line generates an internal compiler error (Microsoft), or an error message "template instantiation of map" :

    template<class T>
    typedef std::map< string, T> AttributeMap;

    But I think it pretty much explains my wish...

    Thanks for helping me!


Share This Page