我在做什么: 我有两个文件:game.h和sound_controller.h。他们两人都有冲突。 game.h需要有一个SoundController,而sound_controller.h需要有一个Game,所以它们都包含了彼此的头文件。 问题: game.h线26: error: field soundController has incomplete type 'SoundControll
未申报是否有可能检查2个变量(如b和c)的基本类型之间的继承(如B和C)如果两者都没有在范围内声明? 我认为这是不可能的,但我不确定。 Test1.h: - #include <vector>
class A{};
std::vector<A*> test1();
Test1.cpp: - #include "Test1.h"
class B : public A{};
class C
如何检查某个类型是否在某个.cpp中是完整类型? template<class T>class Test{
//some fields
void(*functor)(T*) =[](T*){};
//^ will be written by some .cpp that can access T as complete-type
T* t=nullptr;
近日在回答一个问题在这里if-else depends on whether T is a complete type我意识到,下面无法编译 #include <iostream>
#include <type_traits>
using namespace std;
class Incomplete;
class Complete {};
template <typename I
我来到了同一个问题在我们的代码库这里 Can't allocate class with forward declared value in std::map member variable 描述。 Hoever我还发现其他情况下,我们的编译器(MSVC 2017年)能够编译这个... 用我发现,在CPP定义CON组&析构函数允许文件来编译代码摆弄左右后。 在test.h: #ifndef TES