在第二个参数中,我们使用new boost::gregorian::date_input_facet("%m/%d/%Y").
In the second parameter, we use new boost::gregorian::date_input_facet("%m/%d/%Y").
问题:我是否需要考虑释放分配的资源?
Question: Do I need to concern to release the allocated resource?
谢谢
推荐答案否.需要实现来释放内存本身(除非您另外指定):
No. The implementation is required to deallocate the memory itself (unless you specify otherwise):
22.3.1.1.2类locale::facet
对于refs == 0,当销毁包含构面的最后一个语言环境对象时,实现将执行delete static_cast<locale::facet*>(f)(其中f是指向构面的指针);否则,执行delete static_cast<locale::facet*>(f)(其中f是指向构面的指针).对于refs == 1,实现永远不会破坏构面.
For refs == 0, the implementation performs delete static_cast<locale::facet*>(f) (where f is a pointer to the facet) when the last locale object containing the facet is destroyed; for refs == 1, the implementation never destroys the facet.
更多推荐
我们是否应该释放为std :: locale分配的资源
发布评论