Remove using std::string from port.h

Change-Id: I7376f5e7eace22ec1fc05a61eaa858594f08682d
diff --git a/internal/ceres/array_utils.cc b/internal/ceres/array_utils.cc
index a22eb61..3eb5ea4 100644
--- a/internal/ceres/array_utils.cc
+++ b/internal/ceres/array_utils.cc
@@ -41,6 +41,8 @@
 namespace ceres {
 namespace internal {
 
+using std::string;
+
 // It is a near impossibility that user code generates this exact
 // value in normal operation, thus we will use it to fill arrays
 // before passing them to user code. If on return an element of the
diff --git a/internal/ceres/array_utils.h b/internal/ceres/array_utils.h
index c11129e..55b53d2 100644
--- a/internal/ceres/array_utils.h
+++ b/internal/ceres/array_utils.h
@@ -64,7 +64,7 @@
 
 // Utility routine to print an array of doubles to a string. If the
 // array pointer is NULL, it is treated as an array of zeros.
-void AppendArrayToString(const int size, const double* x, string* result);
+void AppendArrayToString(const int size, const double* x, std::string* result);
 
 extern const double kImpossibleValue;
 
diff --git a/internal/ceres/callbacks.cc b/internal/ceres/callbacks.cc
index 3858309..9a2a313 100644
--- a/internal/ceres/callbacks.cc
+++ b/internal/ceres/callbacks.cc
@@ -37,6 +37,8 @@
 namespace ceres {
 namespace internal {
 
+using std::string;
+
 StateUpdatingCallback::StateUpdatingCallback(Program* program,
                                              double* parameters)
     : program_(program), parameters_(parameters) {}
diff --git a/internal/ceres/coordinate_descent_minimizer.cc b/internal/ceres/coordinate_descent_minimizer.cc
index 9f14840..b949c00 100644
--- a/internal/ceres/coordinate_descent_minimizer.cc
+++ b/internal/ceres/coordinate_descent_minimizer.cc
@@ -54,6 +54,7 @@
 
 using std::map;
 using std::set;
+using std::string;
 using std::vector;
 
 CoordinateDescentMinimizer::~CoordinateDescentMinimizer() {
diff --git a/internal/ceres/coordinate_descent_minimizer.h b/internal/ceres/coordinate_descent_minimizer.h
index 7aed5d3..25b9024 100644
--- a/internal/ceres/coordinate_descent_minimizer.h
+++ b/internal/ceres/coordinate_descent_minimizer.h
@@ -60,7 +60,7 @@
   bool Init(const Program& program,
             const ProblemImpl::ParameterMap& parameter_map,
             const ParameterBlockOrdering& ordering,
-            string* error);
+            std::string* error);
 
   // Minimizer interface.
   virtual ~CoordinateDescentMinimizer();
@@ -71,7 +71,7 @@
   // Verify that each group in the ordering forms an independent set.
   static bool IsOrderingValid(const Program& program,
                               const ParameterBlockOrdering& ordering,
-                              string* message);
+                              std::string* message);
 
   // Find a recursive decomposition of the Hessian matrix as a set
   // of independent sets of decreasing size and invert it. This
diff --git a/internal/ceres/evaluator.cc b/internal/ceres/evaluator.cc
index c94c62c..4675c4a 100644
--- a/internal/ceres/evaluator.cc
+++ b/internal/ceres/evaluator.cc
@@ -50,7 +50,7 @@
 
 Evaluator* Evaluator::Create(const Evaluator::Options& options,
                              Program* program,
-                             string* error) {
+                             std::string* error) {
   switch (options.linear_solver_type) {
     case DENSE_QR:
     case DENSE_NORMAL_CHOLESKY:
diff --git a/internal/ceres/evaluator.h b/internal/ceres/evaluator.h
index 7fec1ee..52c7d8c 100644
--- a/internal/ceres/evaluator.h
+++ b/internal/ceres/evaluator.h
@@ -72,7 +72,7 @@
 
   static Evaluator* Create(const Options& options,
                            Program* program,
-                           string* error);
+                           std::string* error);
 
   // This is used for computing the cost, residual and Jacobian for
   // returning to the user. For actually solving the optimization
@@ -190,12 +190,12 @@
   // that the base class implementation does not have to worry about
   // life time issues. Further, these calls are not expected to be
   // frequent or performance sensitive.
-  virtual std::map<string, int> CallStatistics() const {
-    return std::map<string, int>();
+  virtual std::map<std::string, int> CallStatistics() const {
+    return std::map<std::string, int>();
   }
 
-  virtual std::map<string, double> TimeStatistics() const {
-    return std::map<string, double>();
+  virtual std::map<std::string, double> TimeStatistics() const {
+    return std::map<std::string, double>();
   }
 };
 
diff --git a/internal/ceres/evaluator_test.cc b/internal/ceres/evaluator_test.cc
index ddfafd9..de24274 100644
--- a/internal/ceres/evaluator_test.cc
+++ b/internal/ceres/evaluator_test.cc
@@ -51,6 +51,7 @@
 namespace ceres {
 namespace internal {
 
+using std::string;
 using std::vector;
 
 // TODO(keir): Consider pushing this into a common test utils file.
diff --git a/internal/ceres/execution_summary.h b/internal/ceres/execution_summary.h
index 3f684f9..e25f2c9 100644
--- a/internal/ceres/execution_summary.h
+++ b/internal/ceres/execution_summary.h
@@ -46,30 +46,30 @@
 // can be used for reporting times associated with various activities.
 class ExecutionSummary {
  public:
-  void IncrementTimeBy(const string& name, const double value) {
+  void IncrementTimeBy(const std::string& name, const double value) {
     CeresMutexLock l(&times_mutex_);
     times_[name] += value;
   }
 
-  void IncrementCall(const string& name) {
+  void IncrementCall(const std::string& name) {
     CeresMutexLock l(&calls_mutex_);
     calls_[name] += 1;
   }
 
-  const std::map<string, double>& times() const { return times_; }
-  const std::map<string, int>& calls() const { return calls_; }
+  const std::map<std::string, double>& times() const { return times_; }
+  const std::map<std::string, int>& calls() const { return calls_; }
 
  private:
   Mutex times_mutex_;
-  std::map<string, double> times_;
+  std::map<std::string, double> times_;
 
   Mutex calls_mutex_;
-  std::map<string, int> calls_;
+  std::map<std::string, int> calls_;
 };
 
 class ScopedExecutionTimer {
  public:
-  ScopedExecutionTimer(const string& name, ExecutionSummary* summary)
+  ScopedExecutionTimer(const std::string& name, ExecutionSummary* summary)
       : start_time_(WallTimeInSeconds()),
         name_(name),
         summary_(summary) {}
@@ -80,7 +80,7 @@
 
  private:
   const double start_time_;
-  const string name_;
+  const std::string name_;
   ExecutionSummary* summary_;
 };
 
diff --git a/internal/ceres/file.h b/internal/ceres/file.h
index 4741d65..858b662 100644
--- a/internal/ceres/file.h
+++ b/internal/ceres/file.h
@@ -39,12 +39,13 @@
 namespace ceres {
 namespace internal {
 
-void WriteStringToFileOrDie(const string &data, const string &filename);
-void ReadFileToStringOrDie(const string &filename, string *data);
+void WriteStringToFileOrDie(const std::string &data,
+                            const std::string &filename);
+void ReadFileToStringOrDie(const std::string &filename, std::string *data);
 
 // Join two path components, adding a slash if necessary.  If basename is an
 // absolute path then JoinPath ignores dirname and simply returns basename.
-string JoinPath(const string& dirname, const string& basename);
+std::string JoinPath(const std::string& dirname, const std::string& basename);
 
 }  // namespace internal
 }  // namespace ceres
diff --git a/internal/ceres/gradient_checking_cost_function.cc b/internal/ceres/gradient_checking_cost_function.cc
index 52b649b..0ac3fe6 100644
--- a/internal/ceres/gradient_checking_cost_function.cc
+++ b/internal/ceres/gradient_checking_cost_function.cc
@@ -52,6 +52,7 @@
 namespace ceres {
 namespace internal {
 
+using std::string;
 using std::vector;
 
 namespace {
diff --git a/internal/ceres/gradient_checking_cost_function.h b/internal/ceres/gradient_checking_cost_function.h
index d49c8e6..0fa6fb7 100644
--- a/internal/ceres/gradient_checking_cost_function.h
+++ b/internal/ceres/gradient_checking_cost_function.h
@@ -61,7 +61,7 @@
     const CostFunction* cost_function,
     double relative_step_size,
     double relative_precision,
-    const string& extra_info);
+    const std::string& extra_info);
 
 // Create a new ProblemImpl object from the input problem_impl, where
 // each CostFunctions in problem_impl are wrapped inside a
diff --git a/internal/ceres/gradient_problem_evaluator.h b/internal/ceres/gradient_problem_evaluator.h
index 7d144e3..3cdb0dd 100644
--- a/internal/ceres/gradient_problem_evaluator.h
+++ b/internal/ceres/gradient_problem_evaluator.h
@@ -79,11 +79,11 @@
 
   virtual int NumResiduals() const { return 1; }
 
-  virtual std::map<string, int> CallStatistics() const {
+  virtual std::map<std::string, int> CallStatistics() const {
     return execution_summary_.calls();
   }
 
-  virtual std::map<string, double> TimeStatistics() const {
+  virtual std::map<std::string, double> TimeStatistics() const {
     return execution_summary_.times();
   }
 
diff --git a/internal/ceres/gradient_problem_solver.cc b/internal/ceres/gradient_problem_solver.cc
index aea0804..78e509f 100644
--- a/internal/ceres/gradient_problem_solver.cc
+++ b/internal/ceres/gradient_problem_solver.cc
@@ -46,6 +46,7 @@
 namespace ceres {
 using internal::StringPrintf;
 using internal::StringAppendF;
+using std::string;
 
 namespace {
 
diff --git a/internal/ceres/lapack.cc b/internal/ceres/lapack.cc
index a3d9980..6cf2f6b 100644
--- a/internal/ceres/lapack.cc
+++ b/internal/ceres/lapack.cc
@@ -70,7 +70,7 @@
     int num_rows,
     const double* in_lhs,
     double* rhs_and_solution,
-    string* message) {
+    std::string* message) {
 #ifdef CERES_NO_LAPACK
   LOG(FATAL) << "Ceres was built without a BLAS library.";
   return LINEAR_SOLVER_FATAL_ERROR;
@@ -151,7 +151,7 @@
     int work_size,
     double* work,
     double* rhs_and_solution,
-    string* message) {
+    std::string* message) {
 #ifdef CERES_NO_LAPACK
   LOG(FATAL) << "Ceres was built without a LAPACK library.";
   return LINEAR_SOLVER_FATAL_ERROR;
diff --git a/internal/ceres/lapack.h b/internal/ceres/lapack.h
index 8933c2c..f1b7676 100644
--- a/internal/ceres/lapack.h
+++ b/internal/ceres/lapack.h
@@ -58,7 +58,7 @@
       int num_rows,
       const double* lhs,
       double* rhs_and_solution,
-      string* message);
+      std::string* message);
 
   // The SolveUsingQR function requires a buffer for its temporary
   // computation. This function given the size of the lhs matrix will
@@ -91,7 +91,7 @@
       int work_size,
       double* work,
       double* rhs_and_solution,
-      string* message);
+      std::string* message);
 };
 
 }  // namespace internal
diff --git a/internal/ceres/line_search.cc b/internal/ceres/line_search.cc
index d9343c9..d7d6576 100644
--- a/internal/ceres/line_search.cc
+++ b/internal/ceres/line_search.cc
@@ -47,6 +47,7 @@
 
 using std::map;
 using std::ostream;
+using std::string;
 using std::vector;
 
 namespace {
diff --git a/internal/ceres/line_search.h b/internal/ceres/line_search.h
index ea72f74..ccbfd58 100644
--- a/internal/ceres/line_search.h
+++ b/internal/ceres/line_search.h
@@ -179,7 +179,7 @@
     // the next candidate step size across all iterations.
     double polynomial_minimization_time_in_seconds;
     double total_time_in_seconds;
-    string error;
+    std::string error;
   };
 
   explicit LineSearch(const LineSearch::Options& options);
@@ -187,7 +187,7 @@
 
   static LineSearch* Create(const LineSearchType line_search_type,
                             const LineSearch::Options& options,
-                            string* error);
+                            std::string* error);
 
   // Perform the line search.
   //
diff --git a/internal/ceres/line_search_minimizer.cc b/internal/ceres/line_search_minimizer.cc
index 85cc031..f5059e8 100644
--- a/internal/ceres/line_search_minimizer.cc
+++ b/internal/ceres/line_search_minimizer.cc
@@ -69,7 +69,7 @@
 bool Evaluate(Evaluator* evaluator,
               const Vector& x,
               LineSearchMinimizer::State* state,
-              string* message) {
+              std::string* message) {
   if (!evaluator->Evaluate(x.data(),
                            &(state->cost),
                            NULL,
diff --git a/internal/ceres/line_search_preprocessor.cc b/internal/ceres/line_search_preprocessor.cc
index bf17dee..9f4dac5 100644
--- a/internal/ceres/line_search_preprocessor.cc
+++ b/internal/ceres/line_search_preprocessor.cc
@@ -42,7 +42,7 @@
 namespace internal {
 namespace {
 
-bool IsProgramValid(const Program& program, string* error) {
+bool IsProgramValid(const Program& program, std::string* error) {
   if (program.IsBoundsConstrained()) {
     *error = "LINE_SEARCH Minimizer does not support bounds.";
     return false;
diff --git a/internal/ceres/linear_least_squares_problems.cc b/internal/ceres/linear_least_squares_problems.cc
index b6a6a8c..31209f9 100644
--- a/internal/ceres/linear_least_squares_problems.cc
+++ b/internal/ceres/linear_least_squares_problems.cc
@@ -46,6 +46,8 @@
 namespace ceres {
 namespace internal {
 
+using std::string;
+
 LinearLeastSquaresProblem* CreateLinearLeastSquaresProblemFromId(int id) {
   switch (id) {
     case 0:
diff --git a/internal/ceres/linear_least_squares_problems.h b/internal/ceres/linear_least_squares_problems.h
index fdeed70..a8619f6 100644
--- a/internal/ceres/linear_least_squares_problems.h
+++ b/internal/ceres/linear_least_squares_problems.h
@@ -71,7 +71,7 @@
 
 // Write the linear least squares problem to disk. The exact format
 // depends on dump_format_type.
-bool DumpLinearLeastSquaresProblem(const string& filename_base,
+bool DumpLinearLeastSquaresProblem(const std::string& filename_base,
                                    DumpFormatType dump_format_type,
                                    const SparseMatrix* A,
                                    const double* D,
diff --git a/internal/ceres/linear_solver.h b/internal/ceres/linear_solver.h
index 14f171c..de44bca 100644
--- a/internal/ceres/linear_solver.h
+++ b/internal/ceres/linear_solver.h
@@ -273,7 +273,7 @@
     double residual_norm;
     int num_iterations;
     LinearSolverTerminationType termination_type;
-    string message;
+    std::string message;
   };
 
   // If the optimization problem is such that there are no remaining
@@ -296,12 +296,12 @@
   // that the base class implementation does not have to worry about
   // life time issues. Further, these calls are not expected to be
   // frequent or performance sensitive.
-  virtual std::map<string, int> CallStatistics() const {
-    return std::map<string, int>();
+  virtual std::map<std::string, int> CallStatistics() const {
+    return std::map<std::string, int>();
   }
 
-  virtual std::map<string, double> TimeStatistics() const {
-    return std::map<string, double>();
+  virtual std::map<std::string, double> TimeStatistics() const {
+    return std::map<std::string, double>();
   }
 
   // Factory
@@ -331,11 +331,11 @@
     return SolveImpl(down_cast<MatrixType*>(A), b, per_solve_options, x);
   }
 
-  virtual std::map<string, int> CallStatistics() const {
+  virtual std::map<std::string, int> CallStatistics() const {
     return execution_summary_.calls();
   }
 
-  virtual std::map<string, double> TimeStatistics() const {
+  virtual std::map<std::string, double> TimeStatistics() const {
     return execution_summary_.times();
   }
 
diff --git a/internal/ceres/minimizer.h b/internal/ceres/minimizer.h
index 24c8e67..ef696d2 100644
--- a/internal/ceres/minimizer.h
+++ b/internal/ceres/minimizer.h
@@ -134,7 +134,7 @@
     int max_consecutive_nonmonotonic_steps;
     std::vector<int> trust_region_minimizer_iterations_to_dump;
     DumpFormatType trust_region_problem_dump_format_type;
-    string trust_region_problem_dump_directory;
+    std::string trust_region_problem_dump_directory;
     int max_num_consecutive_invalid_steps;
     double min_trust_region_radius;
     LineSearchDirectionType line_search_direction_type;
diff --git a/internal/ceres/parameter_block.h b/internal/ceres/parameter_block.h
index 1ef8673..3ece270 100644
--- a/internal/ceres/parameter_block.h
+++ b/internal/ceres/parameter_block.h
@@ -237,7 +237,7 @@
     return true;
   }
 
-  string ToString() const {
+  std::string ToString() const {
     return StringPrintf("{ user_state=%p, state=%p, size=%d, "
                         "constant=%d, index=%d, state_offset=%d, "
                         "delta_offset=%d }",
diff --git a/internal/ceres/polynomial.cc b/internal/ceres/polynomial.cc
index 848fbee..361ab68 100644
--- a/internal/ceres/polynomial.cc
+++ b/internal/ceres/polynomial.cc
@@ -43,6 +43,7 @@
 namespace ceres {
 namespace internal {
 
+using std::string;
 using std::vector;
 
 namespace {
diff --git a/internal/ceres/polynomial.h b/internal/ceres/polynomial.h
index aaa4401..d5816e5 100644
--- a/internal/ceres/polynomial.h
+++ b/internal/ceres/polynomial.h
@@ -96,7 +96,7 @@
         gradient(0.0),
         gradient_is_valid(false) {
   }
-  string ToDebugString() const;
+  std::string ToDebugString() const;
 
   double x;
   double value;      // value = f(x)
diff --git a/internal/ceres/preprocessor.h b/internal/ceres/preprocessor.h
index 5269eeb..312dab6 100644
--- a/internal/ceres/preprocessor.h
+++ b/internal/ceres/preprocessor.h
@@ -84,7 +84,7 @@
       : fixed_cost(0.0) {
   }
 
-  string error;
+  std::string error;
   Solver::Options options;
   LinearSolver::Options linear_solver_options;
   Evaluator::Options evaluator_options;
diff --git a/internal/ceres/problem_impl.cc b/internal/ceres/problem_impl.cc
index a363248..ee1e32e 100644
--- a/internal/ceres/problem_impl.cc
+++ b/internal/ceres/problem_impl.cc
@@ -55,9 +55,9 @@
 namespace ceres {
 namespace internal {
 
-using std::vector;
 using std::map;
-
+using std::string;
+using std::vector;
 typedef std::map<double*, internal::ParameterBlock*> ParameterMap;
 
 namespace {
diff --git a/internal/ceres/program.cc b/internal/ceres/program.cc
index 77bc63a..131802f 100644
--- a/internal/ceres/program.cc
+++ b/internal/ceres/program.cc
@@ -51,6 +51,7 @@
 namespace internal {
 
 using std::set;
+using std::string;
 using std::vector;
 
 Program::Program() {}
diff --git a/internal/ceres/program.h b/internal/ceres/program.h
index 54dc271..8f82cd3 100644
--- a/internal/ceres/program.h
+++ b/internal/ceres/program.h
@@ -105,7 +105,7 @@
   // offsets) are correct.
   bool IsValid() const;
 
-  bool ParameterBlocksAreFinite(string* message) const;
+  bool ParameterBlocksAreFinite(std::string* message) const;
 
   // Returns true if the program has any non-constant parameter blocks
   // which have non-trivial bounds constraints.
@@ -114,7 +114,7 @@
   // Returns false, if the program has any constant parameter blocks
   // which are not feasible, or any variable parameter blocks which
   // have a lower bound greater than or equal to the upper bound.
-  bool IsFeasible(string* message) const;
+  bool IsFeasible(std::string* message) const;
 
   // Loop over each residual block and ensure that no two parameter
   // blocks in the same residual block are part of
@@ -145,7 +145,7 @@
   // the problem.
   Program* CreateReducedProgram(std::vector<double*>* removed_parameter_blocks,
                                 double* fixed_cost,
-                                string* error) const;
+                                std::string* error) const;
 
   // See problem.h for what these do.
   int NumParameterBlocks() const;
@@ -161,7 +161,7 @@
 
   // A human-readable dump of the parameter blocks for debugging.
   // TODO(keir): If necessary, also dump the residual blocks.
-  string ToString() const;
+  std::string ToString() const;
 
  private:
   // Remove constant parameter blocks and residual blocks with no
@@ -177,7 +177,7 @@
   // error will contain a human readable description of the problem.
   bool RemoveFixedBlocks(std::vector<double*>* removed_parameter_blocks,
                          double* fixed_cost,
-                         string* message);
+                         std::string* message);
 
   // The Program does not own the ParameterBlock or ResidualBlock objects.
   std::vector<ParameterBlock*> parameter_blocks_;
diff --git a/internal/ceres/program_evaluator.h b/internal/ceres/program_evaluator.h
index 24ed3ae..00724fe 100644
--- a/internal/ceres/program_evaluator.h
+++ b/internal/ceres/program_evaluator.h
@@ -297,11 +297,11 @@
     return program_->NumResiduals();
   }
 
-  virtual std::map<string, int> CallStatistics() const {
+  virtual std::map<std::string, int> CallStatistics() const {
     return execution_summary_.calls();
   }
 
-  virtual std::map<string, double> TimeStatistics() const {
+  virtual std::map<std::string, double> TimeStatistics() const {
     return execution_summary_.times();
   }
 
diff --git a/internal/ceres/program_test.cc b/internal/ceres/program_test.cc
index 77a1c44..26ca683 100644
--- a/internal/ceres/program_test.cc
+++ b/internal/ceres/program_test.cc
@@ -42,6 +42,7 @@
 namespace ceres {
 namespace internal {
 
+using std::string;
 using std::vector;
 
 // A cost function that simply returns its argument.
diff --git a/internal/ceres/reorder_program.cc b/internal/ceres/reorder_program.cc
index fad69f9..d1c1df4 100644
--- a/internal/ceres/reorder_program.cc
+++ b/internal/ceres/reorder_program.cc
@@ -59,6 +59,7 @@
 
 using std::map;
 using std::set;
+using std::string;
 using std::vector;
 
 namespace {
diff --git a/internal/ceres/reorder_program.h b/internal/ceres/reorder_program.h
index 0474c1f..1275fd6 100644
--- a/internal/ceres/reorder_program.h
+++ b/internal/ceres/reorder_program.h
@@ -46,14 +46,14 @@
 bool ApplyOrdering(const ProblemImpl::ParameterMap& parameter_map,
                    const ParameterBlockOrdering& ordering,
                    Program* program,
-                   string* error);
+                   std::string* error);
 
 // Reorder the residuals for program, if necessary, so that the residuals
 // involving each E block occur together. This is a necessary condition for the
 // Schur eliminator, which works on these "row blocks" in the jacobian.
 bool LexicographicallyOrderResidualBlocks(int size_of_first_elimination_group,
                                           Program* program,
-                                          string* error);
+                                          std::string* error);
 
 // Schur type solvers require that all parameter blocks eliminated
 // by the Schur eliminator occur before others and the residuals be
@@ -77,7 +77,7 @@
     const ProblemImpl::ParameterMap& parameter_map,
     ParameterBlockOrdering* parameter_block_ordering,
     Program* program,
-    string* error);
+    std::string* error);
 
 // Sparse cholesky factorization routines when doing the sparse
 // cholesky factorization of the Jacobian matrix, reorders its
@@ -93,7 +93,7 @@
     SparseLinearAlgebraLibraryType sparse_linear_algebra_library_type,
     const ParameterBlockOrdering& parameter_block_ordering,
     Program* program,
-    string* error);
+    std::string* error);
 
 }  // namespace internal
 }  // namespace ceres
diff --git a/internal/ceres/reorder_program_test.cc b/internal/ceres/reorder_program_test.cc
index 6f2b1b0..74b4a1d 100644
--- a/internal/ceres/reorder_program_test.cc
+++ b/internal/ceres/reorder_program_test.cc
@@ -105,7 +105,7 @@
   Program* program = problem.mutable_program();
   program->SetParameterOffsetsAndIndex();
 
-  string message;
+  std::string message;
   EXPECT_TRUE(LexicographicallyOrderResidualBlocks(
                   2,
                   problem.mutable_program(),
@@ -131,7 +131,7 @@
   linear_solver_ordering.AddElementToGroup(&y, 1);
 
   Program program(problem.program());
-  string message;
+  std::string message;
   EXPECT_FALSE(ApplyOrdering(problem.parameter_map(),
                              linear_solver_ordering,
                              &program,
@@ -154,7 +154,7 @@
   linear_solver_ordering.AddElementToGroup(&z, 1);
 
   Program* program = problem.mutable_program();
-  string message;
+  std::string message;
 
   EXPECT_TRUE(ApplyOrdering(problem.parameter_map(),
                             linear_solver_ordering,
diff --git a/internal/ceres/residual_block.cc b/internal/ceres/residual_block.cc
index 5eb2117..c2a11c7 100644
--- a/internal/ceres/residual_block.cc
+++ b/internal/ceres/residual_block.cc
@@ -117,7 +117,7 @@
                          cost,
                          residuals,
                          eval_jacobians)) {
-    string message =
+    std::string message =
         "\n\n"
         "Error in evaluating the ResidualBlock.\n\n"
         "There are two possible reasons. Either the CostFunction did not evaluate and fill all    \n"  // NOLINT
diff --git a/internal/ceres/residual_block.h b/internal/ceres/residual_block.h
index b936064..82fa0bf 100644
--- a/internal/ceres/residual_block.h
+++ b/internal/ceres/residual_block.h
@@ -127,7 +127,7 @@
   int index() const { return index_; }
   void set_index(int index) { index_ = index; }
 
-  string ToString() {
+  std::string ToString() {
     return StringPrintf("{residual block; index=%d}", index_);
   }
 
diff --git a/internal/ceres/residual_block_utils.cc b/internal/ceres/residual_block_utils.cc
index d2564a7..9bd8f6b 100644
--- a/internal/ceres/residual_block_utils.cc
+++ b/internal/ceres/residual_block_utils.cc
@@ -44,6 +44,8 @@
 namespace ceres {
 namespace internal {
 
+using std::string;
+
 void InvalidateEvaluation(const ResidualBlock& block,
                           double* cost,
                           double* residuals,
diff --git a/internal/ceres/residual_block_utils.h b/internal/ceres/residual_block_utils.h
index 7051c21..6574f5b 100644
--- a/internal/ceres/residual_block_utils.h
+++ b/internal/ceres/residual_block_utils.h
@@ -68,11 +68,11 @@
 // Create a string representation of the Residual block containing the
 // value of the parameters, residuals and jacobians if present.
 // Useful for debugging output.
-string EvaluationToString(const ResidualBlock& block,
-                          double const* const* parameters,
-                          double* cost,
-                          double* residuals,
-                          double** jacobians);
+std::string EvaluationToString(const ResidualBlock& block,
+                               double const* const* parameters,
+                               double* cost,
+                               double* residuals,
+                               double** jacobians);
 
 }  // namespace internal
 }  // namespace ceres
diff --git a/internal/ceres/rotation_test.cc b/internal/ceres/rotation_test.cc
index ef1adf7..1cf0236 100644
--- a/internal/ceres/rotation_test.cc
+++ b/internal/ceres/rotation_test.cc
@@ -503,7 +503,7 @@
   LOG(INFO) << "Rotation:";
   LOG(INFO) << "EXPECTED        |        ACTUAL";
   for (int i = 0; i < 3; ++i) {
-    string line;
+    std::string line;
     for (int j = 0; j < 3; ++j) {
       StringAppendF(&line, "%g ", kMatrix[i][j]);
     }
diff --git a/internal/ceres/solver.cc b/internal/ceres/solver.cc
index b60efd9..c6414b5 100644
--- a/internal/ceres/solver.cc
+++ b/internal/ceres/solver.cc
@@ -49,8 +49,9 @@
 namespace ceres {
 namespace {
 
-using std::vector;
 using std::map;
+using std::string;
+using std::vector;
 
 #define OPTION_OP(x, y, OP)                                             \
   if (!(options.x OP y)) {                                              \
diff --git a/internal/ceres/solver_test.cc b/internal/ceres/solver_test.cc
index e4abdef..4882fc2 100644
--- a/internal/ceres/solver_test.cc
+++ b/internal/ceres/solver_test.cc
@@ -43,6 +43,8 @@
 namespace ceres {
 namespace internal {
 
+using std::string;
+
 TEST(SolverOptions, DefaultTrustRegionOptionsAreValid) {
   Solver::Options options;
   options.minimizer_type = TRUST_REGION;
diff --git a/internal/ceres/solver_utils.cc b/internal/ceres/solver_utils.cc
index 86440eb..39619e7 100644
--- a/internal/ceres/solver_utils.cc
+++ b/internal/ceres/solver_utils.cc
@@ -37,8 +37,8 @@
 namespace ceres {
 namespace internal {
 
-string VersionString() {
-  string value = string(CERES_VERSION_STRING);
+std::string VersionString() {
+  std::string value = std::string(CERES_VERSION_STRING);
 
 #ifdef CERES_NO_LAPACK
   value += "-no_lapack";
diff --git a/internal/ceres/solver_utils.h b/internal/ceres/solver_utils.h
index 2d1edf8..412d342 100644
--- a/internal/ceres/solver_utils.h
+++ b/internal/ceres/solver_utils.h
@@ -55,7 +55,7 @@
   }
 }
 
-string VersionString();
+std::string VersionString();
 
 }  // namespace internal
 }  // namespace ceres
diff --git a/internal/ceres/split.cc b/internal/ceres/split.cc
index 0afe1c5..4d2930a 100644
--- a/internal/ceres/split.cc
+++ b/internal/ceres/split.cc
@@ -39,6 +39,7 @@
 namespace ceres {
 namespace internal {
 
+using std::string;
 using std::vector;
 
 // If we know how much to allocate for a vector of strings, we can allocate the
diff --git a/internal/ceres/split.h b/internal/ceres/split.h
index ada6676..1945b4f 100644
--- a/internal/ceres/split.h
+++ b/internal/ceres/split.h
@@ -41,8 +41,8 @@
 // Split a string using one or more character delimiters, presented as a
 // nul-terminated c string. Append the components to 'result'. If there are
 // consecutive delimiters, this function skips over all of them.
-void SplitStringUsing(const string& full, const char* delim,
-                      std::vector<string>* res);
+void SplitStringUsing(const std::string& full, const char* delim,
+                      std::vector<std::string>* res);
 
 }  // namespace internal
 }  // namespace ceres
diff --git a/internal/ceres/stringprintf.cc b/internal/ceres/stringprintf.cc
index 0f85f05..aca599f 100644
--- a/internal/ceres/stringprintf.cc
+++ b/internal/ceres/stringprintf.cc
@@ -41,6 +41,8 @@
 namespace ceres {
 namespace internal {
 
+using std::string;
+
 #ifdef _MSC_VER
 enum { IS_COMPILER_MSVC = 1 };
 #if _MSC_VER < 1800
diff --git a/internal/ceres/stringprintf.h b/internal/ceres/stringprintf.h
index cd1be14..b2b20da 100644
--- a/internal/ceres/stringprintf.h
+++ b/internal/ceres/stringprintf.h
@@ -63,23 +63,23 @@
 #endif
 
 // Return a C++ string.
-extern string StringPrintf(const char* format, ...)
+extern std::string StringPrintf(const char* format, ...)
     // Tell the compiler to do printf format string checking.
     CERES_PRINTF_ATTRIBUTE(1, 2);
 
 // Store result into a supplied string and return it.
-extern const string& SStringPrintf(string* dst, const char* format, ...)
+extern const std::string& SStringPrintf(std::string* dst, const char* format, ...)
     // Tell the compiler to do printf format string checking.
     CERES_PRINTF_ATTRIBUTE(2, 3);
 
 // Append result to a supplied string.
-extern void StringAppendF(string* dst, const char* format, ...)
+extern void StringAppendF(std::string* dst, const char* format, ...)
     // Tell the compiler to do printf format string checking.
     CERES_PRINTF_ATTRIBUTE(2, 3);
 
 // Lower-level routine that takes a va_list and appends to a specified string.
 // All other routines are just convenience wrappers around it.
-extern void StringAppendV(string* dst, const char* format, va_list ap);
+extern void StringAppendV(std::string* dst, const char* format, va_list ap);
 
 #undef CERES_PRINTF_ATTRIBUTE
 
diff --git a/internal/ceres/suitesparse.cc b/internal/ceres/suitesparse.cc
index d8b1a49..c49af3c 100644
--- a/internal/ceres/suitesparse.cc
+++ b/internal/ceres/suitesparse.cc
@@ -44,6 +44,7 @@
 namespace ceres {
 namespace internal {
 
+using std::string;
 using std::vector;
 
 SuiteSparse::SuiteSparse() {
diff --git a/internal/ceres/suitesparse.h b/internal/ceres/suitesparse.h
index 5aa9cb9..c42492e 100644
--- a/internal/ceres/suitesparse.h
+++ b/internal/ceres/suitesparse.h
@@ -143,12 +143,12 @@
   // message contains an explanation of the failures if any.
   //
   // Caller owns the result.
-  cholmod_factor* AnalyzeCholesky(cholmod_sparse* A, string* message);
+  cholmod_factor* AnalyzeCholesky(cholmod_sparse* A, std::string* message);
 
   cholmod_factor* BlockAnalyzeCholesky(cholmod_sparse* A,
                                        const std::vector<int>& row_blocks,
                                        const std::vector<int>& col_blocks,
-                                       string* message);
+                                       std::string* message);
 
   // If A is symmetric, then compute the symbolic Cholesky
   // factorization of A(ordering, ordering). If A is unsymmetric, then
@@ -164,7 +164,7 @@
   cholmod_factor* AnalyzeCholeskyWithUserOrdering(
       cholmod_sparse* A,
       const std::vector<int>& ordering,
-      string* message);
+      std::string* message);
 
   // Perform a symbolic factorization of A without re-ordering A. No
   // postordering of the elimination tree is performed. This ensures
@@ -173,7 +173,7 @@
   //
   // message contains an explanation of the failures if any.
   cholmod_factor* AnalyzeCholeskyWithNaturalOrdering(cholmod_sparse* A,
-                                                     string* message);
+                                                     std::string* message);
 
   // Use the symbolic factorization in L, to find the numerical
   // factorization for the matrix A or AA^T. Return true if
@@ -183,14 +183,14 @@
   // message contains an explanation of the failures if any.
   LinearSolverTerminationType Cholesky(cholmod_sparse* A,
                                        cholmod_factor* L,
-                                       string* message);
+                                       std::string* message);
 
   // Given a Cholesky factorization of a matrix A = LL^T, solve the
   // linear system Ax = b, and return the result. If the Solve fails
   // NULL is returned. Caller owns the result.
   //
   // message contains an explanation of the failures if any.
-  cholmod_dense* Solve(cholmod_factor* L, cholmod_dense* b, string* message);
+  cholmod_dense* Solve(cholmod_factor* L, cholmod_dense* b, std::string* message);
 
   // By virtue of the modeling layer in Ceres being block oriented,
   // all the matrices used by Ceres are also block oriented. When
@@ -260,15 +260,15 @@
   void Free(cholmod_dense* m)  { cholmod_free_dense(&m, &cc_);  }
   void Free(cholmod_factor* m) { cholmod_free_factor(&m, &cc_); }
 
-  void Print(cholmod_sparse* m, const string& name) {
+  void Print(cholmod_sparse* m, const std::string& name) {
     cholmod_print_sparse(m, const_cast<char*>(name.c_str()), &cc_);
   }
 
-  void Print(cholmod_dense* m, const string& name) {
+  void Print(cholmod_dense* m, const std::string& name) {
     cholmod_print_dense(m, const_cast<char*>(name.c_str()), &cc_);
   }
 
-  void Print(cholmod_triplet* m, const string& name) {
+  void Print(cholmod_triplet* m, const std::string& name) {
     cholmod_print_triplet(m, const_cast<char*>(name.c_str()), &cc_);
   }
 
diff --git a/internal/ceres/system_test.cc b/internal/ceres/system_test.cc
index 54fd30a..a365e52 100644
--- a/internal/ceres/system_test.cc
+++ b/internal/ceres/system_test.cc
@@ -60,6 +60,7 @@
 namespace ceres {
 namespace internal {
 
+using std::string;
 using std::vector;
 
 const bool kAutomaticOrdering = true;
diff --git a/internal/ceres/test_util.cc b/internal/ceres/test_util.cc
index 9d252e9..7758381 100644
--- a/internal/ceres/test_util.cc
+++ b/internal/ceres/test_util.cc
@@ -120,7 +120,7 @@
   }
 }
 
-string TestFileAbsolutePath(const string& filename) {
+std::string TestFileAbsolutePath(const std::string& filename) {
   return JoinPath(FLAGS_test_srcdir + CERES_TEST_SRCDIR_SUFFIX,
                   filename);
 }
diff --git a/internal/ceres/test_util.h b/internal/ceres/test_util.h
index 4c530de..c3703ac 100644
--- a/internal/ceres/test_util.h
+++ b/internal/ceres/test_util.h
@@ -63,7 +63,7 @@
 
 // Construct a fully qualified path for the test file depending on the
 // local build/testing environment.
-string TestFileAbsolutePath(const string& filename);
+std::string TestFileAbsolutePath(const std::string& filename);
 
 }  // namespace internal
 }  // namespace ceres
diff --git a/internal/ceres/trust_region_minimizer.cc b/internal/ceres/trust_region_minimizer.cc
index 0a6ce80..2f6fcc4 100644
--- a/internal/ceres/trust_region_minimizer.cc
+++ b/internal/ceres/trust_region_minimizer.cc
@@ -85,7 +85,7 @@
       options.max_line_search_step_expansion;
   line_search_options.function = &line_search_function;
 
-  string message;
+  std::string message;
   scoped_ptr<LineSearch> line_search(
       CHECK_NOTNULL(LineSearch::Create(ceres::ARMIJO,
                                        line_search_options,
diff --git a/internal/ceres/trust_region_preprocessor.cc b/internal/ceres/trust_region_preprocessor.cc
index 129442c..305eff8 100644
--- a/internal/ceres/trust_region_preprocessor.cc
+++ b/internal/ceres/trust_region_preprocessor.cc
@@ -67,7 +67,7 @@
 
 // Check if all the user supplied values in the parameter blocks are
 // sane or not, and if the program is feasible or not.
-bool IsProgramValid(const Program& program, string* error) {
+bool IsProgramValid(const Program& program, std::string* error) {
   return (program.ParameterBlocksAreFinite(error) &&
           program.IsFeasible(error));
 }
@@ -84,7 +84,7 @@
   options->linear_solver_type = LinearSolver::LinearSolverForZeroEBlocks(
       linear_solver_type_given);
 
-  string message;
+  std::string message;
   if (linear_solver_type_given == ITERATIVE_SCHUR) {
     options->preconditioner_type = Preconditioner::PreconditionerForZeroEBlocks(
         preconditioner_type_given);
diff --git a/internal/ceres/trust_region_strategy.h b/internal/ceres/trust_region_strategy.h
index 998514f..cd70ef7 100644
--- a/internal/ceres/trust_region_strategy.h
+++ b/internal/ceres/trust_region_strategy.h
@@ -98,7 +98,7 @@
     // name starting with dump_filename_base.  If dump_format_type is
     // CONSOLE then dump_filename_base will be ignored and the linear
     // system will be written to the standard error.
-    string dump_filename_base;
+    std::string dump_filename_base;
     DumpFormatType dump_format_type;
   };
 
diff --git a/internal/ceres/types.cc b/internal/ceres/types.cc
index 52bd67d..7217c69 100644
--- a/internal/ceres/types.cc
+++ b/internal/ceres/types.cc
@@ -36,6 +36,8 @@
 
 namespace ceres {
 
+using std::string;
+
 #define CASESTR(x) case x: return #x
 #define STRENUM(x) if (value == #x) { *type = x; return true;}
 
diff --git a/internal/ceres/visibility_based_preconditioner.cc b/internal/ceres/visibility_based_preconditioner.cc
index 125856e..3659d9d 100644
--- a/internal/ceres/visibility_based_preconditioner.cc
+++ b/internal/ceres/visibility_based_preconditioner.cc
@@ -445,7 +445,7 @@
   lhs->stype = 1;
 
   // TODO(sameeragarwal): Refactor to pipe this up and out.
-  string status;
+  std::string status;
 
   // Symbolic factorization is computed if we don't already have one handy.
   if (factor_ == NULL) {
@@ -470,7 +470,7 @@
   const int num_rows = m_->num_rows();
   memcpy(CHECK_NOTNULL(tmp_rhs_)->x, x, m_->num_rows() * sizeof(*x));
   // TODO(sameeragarwal): Better error handling.
-  string status;
+  std::string status;
   cholmod_dense* solution =
       CHECK_NOTNULL(ss->Solve(factor_, tmp_rhs_, &status));
   memcpy(y, solution->x, sizeof(*y) * num_rows);
diff --git a/internal/ceres/wall_time.cc b/internal/ceres/wall_time.cc
index 85c4417..22594d7 100644
--- a/internal/ceres/wall_time.cc
+++ b/internal/ceres/wall_time.cc
@@ -59,7 +59,7 @@
 #endif
 }
 
-EventLogger::EventLogger(const string& logger_name)
+EventLogger::EventLogger(const std::string& logger_name)
     : start_time_(WallTimeInSeconds()),
       last_event_time_(start_time_),
       events_("") {
@@ -75,7 +75,7 @@
   }
 }
 
-void EventLogger::AddEvent(const string& event_name) {
+void EventLogger::AddEvent(const std::string& event_name) {
   if (!VLOG_IS_ON(3)) {
     return;
   }
diff --git a/internal/ceres/wall_time.h b/internal/ceres/wall_time.h
index 37f5568..faffa56 100644
--- a/internal/ceres/wall_time.h
+++ b/internal/ceres/wall_time.h
@@ -72,14 +72,14 @@
 //     Total:  time3  time1 + time2 + time3;
 class EventLogger {
  public:
-  explicit EventLogger(const string& logger_name);
+  explicit EventLogger(const std::string& logger_name);
   ~EventLogger();
-  void AddEvent(const string& event_name);
+  void AddEvent(const std::string& event_name);
 
  private:
   const double start_time_;
   double last_event_time_;
-  string events_;
+  std::string events_;
 };
 
 }  // namespace internal