2017-01-27 3 views
0

Visual Studio 2012で書かれたライブラリをコンパイルしようとしていましたC++で。 'クラス'のタグがありませんというエラーがあります。コンパイルエラー表示されているクラスのエラーMSG enter image description heretemplate <class ... Args> void operator()(Args && ... args)コンパイルエラー "Class"にタグがありません

コードの

画面を撮影。

template <class T> 
class construct 
{ 
    public: 
     template <class ... Args> 
     void operator()(Args && ... args); 
     T * operator->() 
     { 
     if(!itsValid) 
      throw Exception("Object must be initialized prior to accessing members"); 

     return itsPtr; 
     } 

     T * ptr() 
     { 
      return operator->(); 
     } 

    private: 
     template <class A, class B> friend struct ::cereal::memory_detail::LoadAndConstructLoadWrapper; 

     construct(T * p) : itsPtr(p), itsValid(false) {} 
     construct(construct const &) = delete; 
     construct & operator=(construct const &) = delete; 

     T * itsPtr; 
     bool itsValid; 
}; 

この問題は、異なるバージョンのC++コンパイラによって発生する可能性があります。 Visual Studio 2012はC++ 0xを使用し、Visual Studio 2015はC++ 11を使用します。

どのようにそれをコンパイルする方法Visual Studio 2012は非常に高く評価されます。

+2

C++ 11の実装は、VS2012ではほとんど使用されず、VS2013ではほとんど使用できません。一般的にバックポーティングのC++ 11コードは、シシフェンのタスクです。 [この質問/回答](http://stackoverflow.com/questions/13238408/variadic-template-in-vs-2012-visual-c-november-2012-ctp)でも助けになるかもしれません。 –

答えて

3

あなたが経験しているエラーは、あなたのコード内で可変引数テンプレートを使用した結果のように、ほとんどです:http://en.cppreference.com/w/cpp/language/parameter_pack

MSDNへの旅は、彼らが最初にVS 2013に表示されていることを示していますhttps://msdn.microsoft.com/en-us/library/dn439779(v=vs.120).aspx

あなたは自分自身を設定していますコンパイラをダウングレードするために言語構成を取り除かなければならない場合は、長期的に見てください。

関連する問題