STL Map C++

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

  1. MarkZweers

    MarkZweers New Member

    Joined:
    Dec 10, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    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!

    Mark
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice