[kde-solaris] kdesupport/taglib/taglib
Adriaan de Groot
groot at kde.org
Thu Aug 16 13:47:09 CEST 2007
SVN commit 700759 by adridg:
Somewhat hackish; might be better off as a downstream patch.
Sun Studio fails on taglib because Map specializes in too many ways;
adding the class keyword reduces the specializations to one and it's ok,
but not all specializations of Map actually use T as a template class
parameter. So introduce a #define to switch that around.
Original patch from Stefan Teleman, pared down by me.
CCMAIL: kde-solaris at kde.org
M +8 -0 ape/apetag.cpp
M +16 -2 toolkit/tmap.h
M +8 -3 toolkit/tmap.tcc
--- trunk/kdesupport/taglib/taglib/ape/apetag.cpp #700758:700759
@@ -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 <tdebug.h>
#include <tfile.h>
#include <tstring.h>
--- trunk/kdesupport/taglib/taglib/toolkit/tmap.h #700758:700759
@@ -22,10 +22,11 @@
#ifndef TAGLIB_MAP_H
#define TAGLIB_MAP_H
+#include <map>
+using namespace std;
+
#include "taglib.h"
-#include <map>
-
namespace TagLib {
//! A generic, implicitly shared map.
@@ -40,9 +41,22 @@
{
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<class Key, class T>::iterator Iterator;
+ typedef typename std::map<class Key, class T>::const_iterator ConstIterator;
+#else
typedef typename std::map<Key, T>::iterator Iterator;
typedef typename std::map<Key, T>::const_iterator ConstIterator;
#endif
+#endif
/*!
* Constructs an empty Map.
--- trunk/kdesupport/taglib/taglib/toolkit/tmap.tcc #700758:700759
@@ -26,13 +26,18 @@
////////////////////////////////////////////////////////////////////////////////
template <class Key, class T>
-template <class KeyP, class TP> class Map<Key, T>::MapPrivate : public RefCounter
+template <class KeyP, class TP>
+class Map<Key, T>::MapPrivate : public RefCounter
{
public:
MapPrivate() : RefCounter() {}
- MapPrivate(const std::map<KeyP, TP> &m) : RefCounter(), map(m) {}
-
+#ifdef WANT_CLASS_INSTANTIATION_OF_MAP
+ MapPrivate(const std::map<class KeyP, class TP>& m) : RefCounter(), map(m) {}
+ std::map<class KeyP, class TP> map;
+#else
+ MapPrivate(const std::map<KeyP, TP>& m) : RefCounter(), map(m) {}
std::map<KeyP, TP> map;
+#endif
};
template <class Key, class T>
More information about the kde-solaris
mailing list