vendredi 27 janvier 2017

template

I was trying to compile a library in visual studio 2012 which is originally written for visual studio 2015 in c++. I have an error saying 'class' missing tag.

Screen shoot of error msg enter image description here

Code of the class for which it is showing compile error.

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;
};

This issue might occured due to different version of C++ compiler. Visual studio 2012 uses C++0x and Visual studio 2015 uses C++11.

Any suggestion how to compile it Visual Studio 2012 is highly appreciated.

Aucun commentaire:

Enregistrer un commentaire