| 1613 | |
| 1614 | |
| 1615 | void Resources::unallocate() |
| 1616 | { |
| 1617 | foreach ( |
| 1618 | Resource_Unsafe& resource_, |
| 1619 | resourcesNoMutationWithoutExclusiveOwnership) { |
| 1620 | if (resource_->resource.has_allocation_info()) { |
| 1621 | // Copy-on-write (if more than 1 reference). |
| 1622 | if (resource_.use_count() > 1) { |
| 1623 | resource_ = make_shared<Resource_>(*resource_); |
| 1624 | } |
| 1625 | resource_->resource.clear_allocation_info(); |
| 1626 | } |
| 1627 | } |
| 1628 | } |
| 1629 | |
| 1630 | |
| 1631 | Resources Resources::filter( |