C++ 无法为带有指针的数组指定显式initilizer

C++ 无法为带有指针的数组指定显式initilizer,c++,visual-studio-2013,C++,Visual Studio 2013,我正在使用VS2013进行编译,以下代码有问题,因为我收到一个错误,无法为数组指定显式initilizer: struct OctreeNode { OctreeNode* child[8] = { nullptr }; std::vector<const Extents *> nodeExtentsList; Extents nodeExtents; bool isLeaf = true; };

我正在使用VS2013进行编译,以下代码有问题,因为我收到一个错误,无法为数组指定显式initilizer:

struct OctreeNode
    {
        OctreeNode* child[8] = { nullptr };

        std::vector<const Extents *> nodeExtentsList; 
        Extents nodeExtents;
        bool isLeaf = true;
    };
结构八叉树节点 { 八叉树节点*child[8]={nullptr}; std::向量节点扩展列表; 扩展节点扩展; bool isLeaf=true; }; 我得到的错误是:

错误3错误C2536:“BVH::Octree::OctreeNode::BVH::Octree::OctreeNode::child”:无法为数组指定显式初始值设定项


如果有人遇到此问题,请提供建议。

如果您不想升级到VS2017,您必须处理此问题并以不同方式初始化阵列,例如在构造函数中(struct可以在C++中使用构造函数):

结构八叉树节点 { 八叉树*子[8]; std::向量节点扩展列表; int节点扩展; bool isLeaf=true;
OctreeNode(){for(auto&p:child)p=nullptr;};//vs2013非常旧且非常不兼容。请尽可能尝试更新到最新版本。无论如何,请发布您收到的实际错误消息。您的代码很好,可以在此处编译。升级到VS2017。错误3错误C2536:“BVH::Octree::OctreeNode::BVH::Octree::OctreeNode::child”:无法指定显式初始值设定项对于阵列,这是错误消息。我不想切换到较新的VS,因为存在其他问题:)
struct OctreeNode
{
  OctreeNode* child[8];

  std::vector<const int *> nodeExtentsList;
  int nodeExtents;
  bool isLeaf = true;

  OctreeNode() { for (auto & p : child) p = nullptr; }; //<< constructor
};
OctreeNode()
  { for (int i = 0; i < _countof(child); i++) child[i] = nullptr; };