Replace scoped_ptr with C++11's unique_ptr

Change-Id: Ib5a504c491e3a79af52a95accf009df473470c6b
This commit is contained in:
Keir Mierle
2018-03-30 16:16:59 -07:00
parent fc9336e12a
commit 7c4e8a454e
120 changed files with 427 additions and 728 deletions
+4 -3
View File
@@ -36,6 +36,7 @@
#include <algorithm>
#include <cstdlib>
#include <memory>
#include <numeric>
#include <sstream>
#include <unordered_set>
@@ -337,7 +338,7 @@ bool CovarianceImpl::GetCovarianceMatrixInTangentOrAmbientSpace(
// Assemble the blocks in the covariance matrix.
MatrixRef covariance(covariance_matrix, covariance_size, covariance_size);
const int num_threads = options_.num_threads;
scoped_array<double> workspace(
std::unique_ptr<double[]> workspace(
new double[num_threads * max_covariance_block_size *
max_covariance_block_size]);
@@ -706,7 +707,7 @@ bool CovarianceImpl::ComputeCovarianceValuesUsingSuiteSparseQR() {
// Since the covariance matrix is symmetric, the i^th row and column
// are equal.
const int num_threads = options_.num_threads;
scoped_array<double> workspace(new double[num_threads * num_cols]);
std::unique_ptr<double[]> workspace(new double[num_threads * num_cols]);
#if !(defined(CERES_USE_TBB) || defined(CERES_USE_CXX11_THREADS))
ThreadTokenProvider thread_token_provider(num_threads);
@@ -915,7 +916,7 @@ bool CovarianceImpl::ComputeCovarianceValuesUsingEigenSparseQR() {
// are equal.
const int num_cols = jacobian.num_cols;
const int num_threads = options_.num_threads;
scoped_array<double> workspace(new double[num_threads * num_cols]);
std::unique_ptr<double[]> workspace(new double[num_threads * num_cols]);
#if !(defined(CERES_USE_TBB) || defined(CERES_USE_CXX11_THREADS))
ThreadTokenProvider thread_token_provider(num_threads);