Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 879
  • Last Modified:

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 ???
0
racineconde
Asked:
racineconde
1 Solution
 
rajeev_devinCommented:
This time there is no error.
Please post the complete code.
>> cTimeCode Tc; like this
0
 
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
 
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

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now