diff --git a/taglib/ape/apetag.cpp b/taglib/ape/apetag.cpp index 58ca1389..ef3c3cd0 100644 --- a/taglib/ape/apetag.cpp +++ b/taglib/ape/apetag.cpp @@ -19,6 +19,14 @@ * USA * ***************************************************************************/ +#ifdef __SUNPRO_CC +// Sun Studio finds multiple specializations of Map because +// it considers specializations with and without class types +// to be different; this define forces Map to use only the +// specialization with the class keyword. +#define WANT_CLASS_INSTANTIATION_OF_MAP (1) +#endif + #include #include #include diff --git a/taglib/toolkit/tmap.h b/taglib/toolkit/tmap.h index 620c2983..ae13d021 100644 --- a/taglib/toolkit/tmap.h +++ b/taglib/toolkit/tmap.h @@ -22,9 +22,10 @@ #ifndef TAGLIB_MAP_H #define TAGLIB_MAP_H -#include "taglib.h" - #include +using namespace std; + +#include "taglib.h" namespace TagLib { @@ -40,8 +41,21 @@ namespace TagLib { { public: #ifndef DO_NOT_DOCUMENT +#ifdef WANT_CLASS_INSTANTIATION_OF_MAP + // Some STL implementations get snippy over the use of the + // class keyword to distinguish different templates; Sun Studio + // in particular finds multiple specializations in certain rare + // cases and complains about that. GCC doesn't seem to mind, + // and uses the typedefs further below without the class keyword. + // Not all the specializations of Map can use the class keyword + // (when T is not actually a class type), so don't apply this + // generally. + typedef typename std::map::iterator Iterator; + typedef typename std::map::const_iterator ConstIterator; +#else typedef typename std::map::iterator Iterator; typedef typename std::map::const_iterator ConstIterator; +#endif #endif /*! diff --git a/taglib/toolkit/tmap.tcc b/taglib/toolkit/tmap.tcc index b01517ec..b7ed7b3a 100644 --- a/taglib/toolkit/tmap.tcc +++ b/taglib/toolkit/tmap.tcc @@ -26,13 +26,18 @@ namespace TagLib { //////////////////////////////////////////////////////////////////////////////// template -template class Map::MapPrivate : public RefCounter +template +class Map::MapPrivate : public RefCounter { public: MapPrivate() : RefCounter() {} - MapPrivate(const std::map &m) : RefCounter(), map(m) {} - +#ifdef WANT_CLASS_INSTANTIATION_OF_MAP + MapPrivate(const std::map& m) : RefCounter(), map(m) {} + std::map map; +#else + MapPrivate(const std::map& m) : RefCounter(), map(m) {} std::map map; +#endif }; template