小编use*_*447的帖子

构建时间:Visual Studio 2015-2017构建非常慢

对于我的小型(5-6000行代码)C++程序,我使用了VS 2015和2017,我的构建时间在第一次构建时大约是2分钟.这显然非常慢,但我不确定为什么.在tools-> options-> projects and solutions-> build and run中 - 我已经将"最大并行项目构建数"设置为8但没有发生变化.

是否有任何其他设置或一般规则可用于缩短构建时间?

c++ msbuild build build-time visual-studio

4
推荐指数
1
解决办法
2530
查看次数

如何实现继承已知类的未知类的副本

我需要一个不同类实例的数组(这里是:B),它们共享相同的基类(这里:A).
实例应存储为指针,因为它们在别处引用(此处未显示).
我这样试过:

class A {
public:
  A() {}
};

class B : public A {
  int m_magicValue;
public:
  B() : A() , m_magicValue(4711){}
  int getMagicValue() { return m_magicValue; }
};

class Manager {
  std::vector<A*> m_array;
public:
  Manager() {}
  virtual ~Manager() {
      for( size_t i=0; i<m_array.size(); i++ )
          delete m_array[i];
      m_array.clear();

  }
  void addA( const A& a ) {
    // here A is copied - here the problem occurs
    m_array.push_back( new A(a) );
//    createSomeReferences( m_array.back() );
  }
  A& getA( …
Run Code Online (Sandbox Code Playgroud)

c++ inheritance

1
推荐指数
1
解决办法
148
查看次数

标签 统计

c++ ×2

build ×1

build-time ×1

inheritance ×1

msbuild ×1

visual-studio ×1