从 MSVC14 切换到 MSVC16 会导致"compiler is out of heap space (C1060)"错误

Switching from MSVC14 to MSVC16 leads to "compiler is out of heap space (C1060)" error

本文关键字:heap of out space 错误 C1060 is compiler MSVC16 MSVC14      更新时间:2023-10-16

我正试图从Visual Studio 14 2015编译器切换到Visual Studio 16 2019来编译我的项目(也尝试过Visual Studio 15 2017,但这导致了相同的问题(。我使用的是irrequietus/typestring,它与旧编译器配合得很好,但现在会导致错误。

下面是一个应该与typestring一起使用的类:

// my_custom_class.h
template<typename T>
class MyCustomClass
{
public:
static bool compareTheTypestring(const std::string& other) const {
return std::strcmp(data(), other.c_str()) == 0;
}
}

这就是我如何使用类:

// use_it.cpp
#include "typestring.hh"
#include "my_custom_class.h"
typedef MyCustomClass<typestring_is("Foo")> FooCompare;

它在typestring.hh中抛出以下错误:

  • compiler is out of heap space (C1060)

use_it.cpp:中还有更多错误

  • irqus::typeek: no matching overloaded function found (C2672)
  • Failed to specialize function template 'unknown-type irqus::typeek(irqus::typestring<C...>)'
  • 无法推导MyCustomClass的模板参数

存储库包含类似的问题,但维护人员似乎没有回复。我试图找到替代的typestring实现,但没有找到。有人能帮我解决这个问题吗?

此问题已在1月份报告,自那时以来已收到0条回复。图书馆似乎不再更新了。。。也许可以寻找替代解决方案

你真的应该在你的问题中加入你想做什么的细节。在我理解你想要实现的目标之前,我必须通读外部图书馆。我最好的建议是:寻找一个替代方案。还有其他编译时间字符串的方法。模板参数可能不是最好的答案。

如果真的想要使用模板参数字符串,您必须自己修复它。库可能依赖于未定义的行为。所以它现在坏了。我试过了,但不是很直接。您可能需要在宏中使用charizing运算符来拆分字符串,然后将字符放入元组类型中。。。

template<char c>
class CharType {
public:
static constexpr char Char = c;
};
using FooString = std::tuple<CharType<'F'>, CharType<'o'>, CharType<'o'>>;

或者类似的东西。