Skip to content

Commit

Permalink
Replace std::shared_ptr::unique() with use_count() == 1
Browse files Browse the repository at this point in the history
std::shared_ptr::unique() has been removed from c++20
PiperOrigin-RevId: 631443441
  • Loading branch information
tensorflower-gardener committed May 7, 2024
1 parent a0cda67 commit b927a50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tensorflow/core/graph/graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ gtl::iterator_range<NeighborIter> Node::in_nodes() const {
void Node::MaybeCopyOnWrite() {
// TODO(mdan): As nodes become more dynamic, this may not be worth the cost.
// NodeProperties may be shared between Nodes. Make a copy if so.
if (!props_.unique()) {
// TODO(b/338453606): use_count() == 1 has a race condition.
if (!(props_.use_count() == 1)) {
props_ = std::make_shared<NodeProperties>(*props_);
}
}
Expand Down

0 comments on commit b927a50

Please sign in to comment.