0

On vs2005 all is a fine,but on vs2013 is not work. I have code:

    template <
     typename _path_builder,
     typename _vertex_allocator
 >
 struct CBuilderAllocatorConstructor {
     template <template <typename _T> class _vertex>
     class CDataStorage :
         public _path_builder::CDataStorage<_vertex>,
         public _vertex_allocator::CDataStorage<typename _path_builder::CDataStorage<_vertex>::CGraphVertex>
     {
     public:
         typedef typename _path_builder::CDataStorage<_vertex> CDataStorageBase;
         typedef typename _vertex_allocator::CDataStorage<
             typename _path_builder::CDataStorage<
                 _vertex
             >::CGraphVertex
         > CDataStorageAllocator;
         typedef typename CDataStorageBase::CGraphVertex CGraphVertex;
         typedef typename CGraphVertex::_index_type _index_type;

     public:
         IC CDataStorage (const u32 vertex_count);
         virtual ~CDataStorage ();
         IC void init ();
     };
 };

But after porting on vs 2013 i'm got error: on line typedef typename _path_builder::CDataStorage<_vertex> CDataStorageBase;

error C2143: syntax error : missing ',' before '<' what is happen?

EDIT: thanks all for reply,i'm all corrected

2 Answers2

1

You need to introduce the template keyword to let the parser know that _path_builder::CDataStorage is a template.

typedef typename _path_builder::template CDataStorage<_vertex> CDataStorageBase;
                                ^^^^^^^^

See here for a nice explanation.

Community
  • 1
  • 1
juanchopanza
  • 210,243
  • 27
  • 363
  • 452
0

Apparently this is a tightening up of the compiler. "<" is generally supposed to be "less than" unless preceeded by keyword template:

template <
typename _path_builder,
       typename _vertex_allocator
       >
       struct CBuilderAllocatorConstructor {
           template <template <typename _T> class _vertex>
               class CDataStorage :
                   public _path_builder::template CDataStorage<_vertex>,
                   public _vertex_allocator::template CDataStorage<_path_builder::template CDataStorage<_vertex>::CGraphVertex>
           {
               public:
                   typedef typename _path_builder::template CDataStorage<_vertex> CDataStorageBase;
                   typedef typename _vertex_allocator::template CDataStorage<
                       typename _path_builder::template CDataStorage<
                       _vertex
                       >::CGraphVertex
                       > CDataStorageAllocator;
                   typedef typename CDataStorageBase::CGraphVertex CGraphVertex;
                   typedef typename CGraphVertex::_index_type _index_type;

               public:
                   IC CDataStorage (const u32 vertex_count);
                   virtual ~CDataStorage ();
                   IC void init ();
           };
       };

Here is the msdn page on the specific error: http://msdn.microsoft.com/en-us/library/0afb82ta.aspxhttp://msdn.microsoft.com/en-us/library/0afb82ta.aspx

Joshua Clayton
  • 1,557
  • 16
  • 25