Lionel
Lionel

Reputation: 33

error: ‘numeric_limits’ is not a class template

I want to compile a code and I get error messages. The first one: ../base/cmvs/../stann/sep_float.hpp:50:7: error: ‘numeric_limits’ is not a class template class numeric_limits >

Here is the file:

using namespace std;

template<typename T>
class sep_float;

namespace std
{
template<>
class numeric_limits<sep_float<float> >
{
public:
    static const bool is_specialized = true;
    static float max() throw() {return numeric_limits<float>::max();}
    static float min() throw() {return  -numeric_limits<float>::max();}
 };

This is not my own code and I am not so advanced in c++. Any idea of what I can do to fix it?

Upvotes: 3

Views: 5614

Answers (1)

Matthieu Brucher
Matthieu Brucher

Reputation: 22023

The issue is that this header should be self sufficient and include the header that declares this type traits :

#include <limits>

Be aware that adding using namespace std is more than a bad practice in a header. Remove it.

Upvotes: 4

Related Questions