mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
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@kde.org git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@700759 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
parent
ecc430e6f5
commit
47e855e654
@ -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>
|
||||
|
@ -22,9 +22,10 @@
|
||||
#ifndef TAGLIB_MAP_H
|
||||
#define TAGLIB_MAP_H
|
||||
|
||||
#include "taglib.h"
|
||||
|
||||
#include <map>
|
||||
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<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
|
||||
|
||||
/*!
|
||||
|
@ -26,13 +26,18 @@ namespace TagLib {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user