如何解决仅在使用调试标志进行编译时,“虚拟内存耗尽:无法分配内存”
我收到以下代码(error.cpp)的错误:
#include <map>
#include <functional>
#include <vector>
int main()
{
std::map<
int,std::map< std::string,std::map<std::string,std::string>
> > >
> > >
> > >
> > >
> > >
> > >
> > oups;
}
使用调试标志进行编译时:
g++ error.cpp -g -o error
我的系统是Ubuntu 18.04,其中g ++ 7.5.0作为VM运行。 RAM为5GB,交换为2.5GB。剩下的硬盘空间为1GB。
这正常吗?有毛病吗有限制吗?
以上代码将是“更精细”的替代方案吗? (c ++ 14)
解决方法
在该定义中您有8 + 7 + 6个字符串,对吗?因此,我想说的是,您手中拥有的是关系21。为什么不尝试:
constexpr const std::size_t my_arity = 21;
std::unordered_set<std::array<std::string,my_arity>> oups;
相反?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。