Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
C++:push_back(new Object()) 是内存泄漏吗?
下面的C 代码是否存在内存泄漏 list push back new String hi 据我了解 任何 std 集合 容器中的 push back 总是会生成一个副本 因此 如果复制了新字符串 则没有任何东西可以删除新字符串 对吧 因为在
c
memory
newoperator
memoryleaks
gcc 4.5 特有的 C++ 数组创建问题
以下代码适用于 gcc 2 9 至 4 4 版本 但不适用于 4 5 版本 struct Pass int main void Pass passes new Pass 10 gcc 4 5 的具体错误消息是 prob cc In func
c
gcc
C11
newoperator
new[] 是否调用 C++ 中的默认构造函数?
当我使用 new 创建类数组时 int count 10 A arr new A count 我看到它调用了默认构造函数A count次 因此arr has count已初始化类型的对象A 但是如果我使用同样的东西来构造一个 int 数组
c
Arrays
standards
newoperator
new Integer(123)、Integer.valueOf(123) 和 just 123 之间的区别
最近我看到这样的代码 Java myMethod new Integer 123 我目前正在重构一些代码 声纳工具中有一个提示 使用这样的东西对内存更友好 myMethod Integer valueOf 123 但是在这种情况下 我认为使
Java
Integer
newoperator
valueOf
C++“new”运算符是如何实现的
Class B B b new B default constructor B b1 new B 10 constructor which takes an argument B int x 但是 如果我们想编写一个自定义版本new 语法是
c
newoperator
对重载new和delete施加限制
是否可以对重载运算符 new 和 delete 施加一些限制 我的重载 new 在另一个文件中链接到我的测试程序 场景是 if condition is satisfied call overloaded new else call the
c
overloading
newoperator
deleteoperator
调用析构函数,然后调用构造函数(重置对象)
我想重置一个对象 我可以按照下面的方式来做吗 anObject gt AnObject anObject new anObject AnObject edit this is not allowed anObject gt AnObject
c
memorymanagement
newoperator
C++ new/delete 和 char *
任何人都可以帮助我 为什么我在尝试释放分配的内存时收到错误消息 检测到堆损坏 CTR 检测到应用程序在堆缓冲区末尾之后写入了内存 char ff char s char s1 new char strlen s strcpy s1 s re
c
char
newoperator
为什么经常使用new Parent()而不是Object.create(Parent.prototype)来初始化子级的原型?
在中间Mozilla 文档页面 https developer mozilla org en US docs Web JavaScript Guide Details of the Object Model它切换 没有足够清晰的解释 示例
javascript
inheritance
prototype
instance
newoperator
在 Rails 上创建新应用程序 ruby
我对在 Rails 上使用 ruby 的 简单 工作感到有点困惑 因为我已经花了三天时间尝试创建一个应用程序 我从事 site5 托管工作 并尝试创建新的应用程序 一步步 rails new app d mysql gem install
mysql
rubyonrails
rubygems
newoperator
使用覆盖 new[] 运算符创建字符串数组
我们和我的朋友一起制作了一个带有覆盖 new 和 new 运算符的程序 我发现当我尝试使用以下代码创建字符串数组时 string Test1 new string 10 函数返回无效指针 通常它的值向前移动 8 位 我正在将程序编译到 x6
c
string
overriding
newoperator
限制泛型类型参数具有特定的构造函数
我想知道为什么对泛型类型参数的新约束只能在没有参数的情况下应用 也就是说 可以约束类型具有无参数构造函数 但不能约束类具有 比如说 一个构造函数接收一个 int 作为参数 我知道解决这个问题的方法 使用反射或工厂模式 效果很好 好吧 但我真
c
generics
constraints
newoperator
要“新”还是不“新”
使用时是否有可遵循的经验法则new声明对象时何时不使用关键字 List
c
NET
newoperator
Allocation
是否可以使用 new 运算符在 C++ 11 中初始化数组
大家好 我想像这样在 C 中初始化一个数组 int array 10 1 2 3 4 5 6 7 8 9 10 但我正在使用新的运算符 我知道我可以像下面这样做 然后迭代并分配值 shared ptr
c
Arrays
STL
newoperator
在派生类中重写运算符 new/delete
我有一个无状态的抽象基类 各种具体类都从中继承 其中一些派生类也是无状态的 因为其中许多是在运行期间创建的 所以我希望通过重写运算符 new delete 让所有无状态派生类模拟单例 从而节省内存和开销 一个简化的例子看起来像这样 incl
c
memorymanagement
singleton
overriding
newoperator
当使用“new”进行初始化时,() 和 {} 是否始终等效?
有一个帖子涉及类型名称后面是否有括号 https stackoverflow com questions 620137 do the parentheses after the type name make a difference wit
c
C11
constructor
initialization
newoperator
“新的展示位置”有什么用途?
这里有人用过C 的 placement new 吗 如果是这样 那又是为了什么 在我看来 它只对内存映射硬件有用 Placement new 允许您在已分配的内存中构造一个对象 当您需要构造对象的多个实例时 您可能希望这样做以进行优化 并且
c
memorymanagement
newoperator
placementnew
函数调用中的新运算符
我的问题是分配的对象会发生什么new函数调用内部的运算符 一个具体的例子 我有一个私有向量pV我想将其发送到类之外的对象 函数 foo gt func std vector
c
newoperator
使用双指针进行动态分配
我有一个基类 Toy 和派生类 Toy remote car amd Toy battery car 我正在这样做 Toy ptr ptr new Toy ptr 0 new Toy remote car 1 ptr 1 new Toy b
c
pointers
memoryleaks
memorymanagement
newoperator
SimpleXML 枚举区分大小写
我一直在尝试使用 simplexml 库 v2 6 2 创建 XMLhttp simple sourceforge net home php http simple sourceforge net home php 我想要创建的 XML 必
Java
enums
newoperator
simpleframework
«
1
2
3
4
5
6
7
»