c++ - how to limit scope of overloaded new/delete operator to translation unit only (when they can not be made static)
问题描述
While moving the project from Visual Studio 2010 to 2017 I am facing a problem. One of the projects has global static overloaded new/delete operators, on compiling with VS2017 it throws an error that new/delete operators can not be declared static (it used to compile on VS2010). But static ensures scope of these overloaded new/delete specific to a translation unit. How this can be achieved when no more static new/delete operators are allowed. Please help me with the suggestions.
解决方案
在 CPP 文件中提供声明和定义。这将限制特定编译单元的可见性
推荐阅读
- sql - & 在 Oracle Column Name 中认为它是一个变量
- php - 即使条件为假,PHP IF 语句中的 SQL 语句也会执行
- java - 访问 Java admin SDK Firestore 实例的关闭选项
- python - 有没有办法在 POST 方法的主体中发送函数
- python - 如何在不更改 Python 中的原始列表变量的情况下修改列表?
- python-3.x - 在一列中填写不同类别的NA值
- flutter - Flutter Multiple DropdownButton 使用 List 创建
- ios - yarn ios, BUILD FAILED , iOS Simulator 部署目标, Skipping duplicate build file, & Capabilities for Signing & Capabilities 可能不起作用
- javascript - 下拉菜单不显示 onClick React.js
- c++ - 我们如何一起编译和运行多个 .h 和 .cpp 以及一个 main.cpp 文件