hello!
I'm wondering if the following compiler behaviour is correct and standard
compliant.
I've used three compilers to compile this code and two of them(gcc,
MSVC++6.0) are not complaining about anything (even no warnings issued).
The problem is the third complier (Code Composer Studio 2.0 by Texas
Instuments) gives me this :
"error: specializing member "Container<T>::m_map [with T=float]" without
"template<>" syntax is nonstandard"
here's the code :
// map.h
template<typename K,typename V> class Map
{
// some stuff here
};
// function definitions
//container.h
#include "map.h"
template<typename T> class Container
{
static Map<int,T*> m_map;
public:
static int createObject(int key);
static T* getReference(int key);
static void destroyObject(int key);
};
// function definitions
//main.cpp
#include "container.h"
Map<int,float*> Container<float>::m_map;
int main()
{
// some stuff here, something like:
Container<float>::createObject(0);
float* pFloat = Container<float>::getReference(0);
if(pFloat)
*pFloat = 453.43f;
Container<float>::destroyObject(0);
}
The point is I have to use the Code Composer Studio and I have to use the
Container class as designed above.
Can you tell me if the code is 100% correct or have I made a mistake
somewhere???
Is there any workaroud for this?
regards,
Ips