fork download
  1. #include <iostream>
  2. #include <cstdint>
  3.  
  4. using s8 = std::int8_t;
  5. using u8 = std::uint8_t;
  6.  
  7. using s16 = std::int16_t;
  8. using u16 = std::uint16_t;
  9.  
  10. using s32 = std::int32_t;
  11. using u32 = std::uint32_t;
  12.  
  13. using s64 = std::int64_t;
  14. using u64 = std::uint64_t;
  15.  
  16. using namespace std;
  17.  
  18. template <typename TIndex>
  19. struct CVertexManagerFixed
  20. {
  21. template <typename TPathBuilder, typename TCompoundVertex>
  22. class CDataStorage : public TPathBuilder::template CDataStorage<TCompoundVertex>
  23. {
  24. public:
  25. using CDataStorageBase = typename TPathBuilder::template CDataStorage<TCompoundVertex>;
  26. using Vertex = TCompoundVertex;
  27. using Index = TIndex;
  28.  
  29. public:
  30. inline CDataStorage(const u32 vertex_count);
  31. inline virtual ~CDataStorage();
  32. inline Vertex& get_node(const Index& vertex_id) const;
  33. };
  34. };
  35.  
  36.  
  37. #define TEMPLATE_SPECIALIZATION \
  38.   template <typename TIndex> \
  39.   template <typename TPathBuilder, typename TCompoundVertex>
  40.  
  41. #define CFixedVertexManager \
  42.   CVertexManagerFixed<TIndex>::template CDataStorage<TPathBuilder, TCompoundVertex> // error#1: non-template ‘CDataStorage’ used as template error#2: expected unqualified-id before ‘,’ token
  43.  
  44. TEMPLATE_SPECIALIZATION
  45. inline CFixedVertexManager::CDataStorage(const u32 vertex_count)
  46. : CDataStorageBase(vertex_count)
  47. {
  48. }
  49.  
  50. TEMPLATE_SPECIALIZATION
  51. inline typename CFixedVertexManager::Vertex& CFixedVertexManager::get_node(const Index& vertex_id) const
  52. {
  53. VERIFY(vertex_id < m_max_node_count);
  54. VERIFY(is_visited(vertex_id));
  55. return *m_indexes[vertex_id].m_vertex;
  56. }
  57.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:45:64: error: invalid use of incomplete type ‘class CVertexManagerFixed<TIndex>::CDataStorage<TPathBuilder, TCompoundVertex>’
 inline CFixedVertexManager::CDataStorage(const u32 vertex_count)
                                                                ^
prog.cpp:22:11: note: declaration of ‘class CVertexManagerFixed<TIndex>::CDataStorage<TPathBuilder, TCompoundVertex>’
     class CDataStorage : public TPathBuilder::template CDataStorage<TCompoundVertex>
           ^~~~~~~~~~~~
prog.cpp:51:82: error: ‘Index’ does not name a type
 inline typename CFixedVertexManager::Vertex& CFixedVertexManager::get_node(const Index& vertex_id) const
                                                                                  ^~~~~
prog.cpp:51:100: error: invalid use of incomplete type ‘class CVertexManagerFixed<TIndex>::CDataStorage<TPathBuilder, TCompoundVertex>’
 inline typename CFixedVertexManager::Vertex& CFixedVertexManager::get_node(const Index& vertex_id) const
                                                                                                    ^~~~~
prog.cpp:22:11: note: declaration of ‘class CVertexManagerFixed<TIndex>::CDataStorage<TPathBuilder, TCompoundVertex>’
     class CDataStorage : public TPathBuilder::template CDataStorage<TCompoundVertex>
           ^~~~~~~~~~~~
stdout
Standard output is empty