error C3211: 'std::greater<cEvent::Ptr>': explicit specialization is using partial specialization syntax, use template<> instead

Hi,
When I try to compile my code, i got the following error message
*****
error C3211: 'std::greater<cEvent::Ptr>': explicit specialization is using partial specialization syntax, use template<> instead
*****
 The change i made in my code is to turn template<> to template<class _Ty>.
If I try to remove this modification from my code, I get the following error message
*******
error C2065: '_Ty': undeclared identifier
******

You'll find the following comment in front of the "wrong" line
// THE "WRONG LINE"

//*******************************
#include "resource.h"

class cEvent
{
private:
  cTimeCode Tc;
  wstring Comment;
public:
  typedef cEvent* Ptr;

  cEvent();
  virtual ~cEvent();

  void set(cTimeCode tc,wstring comment);
  void print();

  cTimeCode tc();
  wstring comment();

  void createComment(
    cUnknownPtr<IAAFDictionary> pDictionary,
    cUnknownPtr<IAAFDataDef> pDataDef,
    cUnknownPtr<IAAFSequence> pSequence);
};

template<class _Ty> // THE "WRONG LINE"
struct std::greater<cEvent::Ptr> : binary_function<_Ty, _Ty, bool>
{
  bool operator()(const _Ty& x, const _Ty& y) const
  {
    return y->tc() > x->tc();
  }
};

//*******************************

ANY CLUES ???
racinecondeAsked:
Who is Participating?
 
AlexFMCommented:
template<>
struct std::greater<cEvent::Ptr> : binary_function<cEvent::Ptr, cEvent::Ptr, bool>
{
  bool operator()(const cEvent::Ptr& x, const cEvent::Ptr& y) const
  {
    return y->tc() > x->tc();
  }
};
0
 
rajeev_devinCommented:
This time there is no error.
Please post the complete code.
>> cTimeCode Tc; like this
0
 
racinecondeAuthor Commented:
This seams to work
//**
template<>
struct std::greater<cEvent::Ptr> : binary_function<cEvent::Ptr, cEvent::Ptr, bool>
{
  bool operator()(const cEvent::Ptr& x, const cEvent::Ptr& y) const
  {
    return y->tc() > x->tc();
  }
};
//********

Thanks Alex

Rajeev, here's the complete code of cTimeCode

//*********
enum eFps {e24fps=24, e25fps=25, e30fps=30, e60fps=60};
typedef wstring String;
typedef wchar_t Char;

class cTimeCode
{
public:
  cTimeCode (int hour, int minute, int second, int frame, eFps fps, bool dropFrame=false);
  cTimeCode (int framesSinceMidnight, eFps fps, bool dropFrame=false);
  cTimeCode (wstring tc, eFps fps, bool dropFrame=false);
  cTimeCode (const cTimeCode& other);
  cTimeCode ();

  cTimeCode& operator += (int frames);
  cTimeCode& operator += (const cTimeCode& timecode);
  cTimeCode& operator -= (int frames);
  cTimeCode& operator -= (const cTimeCode& timecode);

  bool operator == (const cTimeCode &time) const;
  bool operator != (const cTimeCode &time) const;
  bool operator <  (const cTimeCode &time) const;
  bool operator <= (const cTimeCode &time) const;
  bool operator >  (const cTimeCode &time) const;
  bool operator >= (const cTimeCode &time) const;

  void incWithLimit (int frames);

  wstring toString() const;

  int framesSinceMidnight() const;
  void setFramesSinceMidnight (int framesSinceMidnight);

  int maxFrames() const;

  unsigned int getPacked() const;
  void setFromPacked (unsigned int packedTimeCode);

  unsigned char hour() const;
  unsigned char minute() const;
  unsigned char second() const;
  unsigned char frame() const;

  eFps fps() const;
  bool isDropFrame() const;

  int getFramesPerDay();

//{{{
private:
  unsigned char Hour;
  unsigned char Minute;
  unsigned char Second;
  unsigned char Frame;
  int FramesSinceMidnight;
  bool DropFrame;
  eFps Fps;

  int FramesPerDay;

  //{{{
  int limit (int num, int min, int max)         // worth inlining
    {
    if (num < min) return min;
    if (num > max) return max;
    return num;
    }
  //}}}
  void checkDropFrameState();
  void updateFramesPerDay();
  void framesToTimeCode();
  void timeCodeToFrames();
//}}}
};


inline wostream& __cdecl
operator<<(wostream& s,const cTimeCode& tc)
{
  s << tc.toString();
  return (s);
}

//*********

Thanks all for your help...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.