From 4bea6d7a2dc2c833b7af0cd1be15ad5e10c85316 Mon Sep 17 00:00:00 2001 From: Keir Mierle Date: Mon, 25 Sep 2017 13:09:41 -0700 Subject: [PATCH] Add a comment about default constructed reference counts= Change-Id: Ia6b8a75144755d9bcf05c893bb97a1e207da6b0f --- internal/ceres/problem_impl.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/ceres/problem_impl.cc b/internal/ceres/problem_impl.cc index 07da5501a..ae77c0bb8 100644 --- a/internal/ceres/problem_impl.cc +++ b/internal/ceres/problem_impl.cc @@ -340,6 +340,9 @@ ResidualBlock* ProblemImpl::AddResidualBlock( } if (options_.cost_function_ownership == TAKE_OWNERSHIP) { + // Increment the reference count, creating an entry in the table if + // needed. Note: C++ maps guarantee that new entries have default + // constructed values; this implies integers are zero initialized. ++cost_function_ref_count_[cost_function]; }