static const -> static constexpr where we can.

Change-Id: I8a6d26a89c4377dd440fa6dcf23513b7556533fc
diff --git a/examples/libmv_bundle_adjuster.cc b/examples/libmv_bundle_adjuster.cc
index 2ab7d0d..be93678 100644
--- a/examples/libmv_bundle_adjuster.cc
+++ b/examples/libmv_bundle_adjuster.cc
@@ -307,8 +307,8 @@
     return value;
   }
  private:
-  static const long int kLittleEndian = 0x03020100ul;
-  static const long int kBigEndian = 0x00010203ul;
+  static constexpr long int kLittleEndian = 0x03020100ul;
+  static constexpr long int kBigEndian = 0x00010203ul;
 
   // Switch endian type between big to little.
   template <typename T>
diff --git a/examples/more_garbow_hillstrom.cc b/examples/more_garbow_hillstrom.cc
index 87713a0..0dc8fbf 100644
--- a/examples/more_garbow_hillstrom.cc
+++ b/examples/more_garbow_hillstrom.cc
@@ -80,7 +80,7 @@
 
 #define BEGIN_MGH_PROBLEM(name, num_parameters, num_residuals)            \
   struct name {                                                           \
-    static const int kNumParameters = num_parameters;                     \
+    static constexpr int kNumParameters = num_parameters;                 \
     static const double initial_x[kNumParameters];                        \
     static const double lower_bounds[kNumParameters];                     \
     static const double upper_bounds[kNumParameters];                     \
diff --git a/examples/robot_pose_mle.cc b/examples/robot_pose_mle.cc
index 0076947..83c0903 100644
--- a/examples/robot_pose_mle.cc
+++ b/examples/robot_pose_mle.cc
@@ -160,7 +160,7 @@
               "the robot.");
 
 // The stride length of the dynamic_autodiff_cost_function evaluator.
-static const int kStride = 10;
+static constexpr int kStride = 10;
 
 struct OdometryConstraint {
   typedef AutoDiffCostFunction<OdometryConstraint, 1, 1> OdometryCostFunction;
diff --git a/internal/ceres/canonical_views_clustering.cc b/internal/ceres/canonical_views_clustering.cc
index b2fd49f..e927e1f 100644
--- a/internal/ceres/canonical_views_clustering.cc
+++ b/internal/ceres/canonical_views_clustering.cc
@@ -214,7 +214,7 @@
     center_to_cluster_id[centers[i]] = i;
   }
 
-  static const int kInvalidClusterId = -1;
+  static constexpr int kInvalidClusterId = -1;
 
   const IntSet& views = graph_->vertices();
   for (const auto& view : views) {
diff --git a/internal/ceres/conditioned_cost_function_test.cc b/internal/ceres/conditioned_cost_function_test.cc
index b0705f3..cd15507 100644
--- a/internal/ceres/conditioned_cost_function_test.cc
+++ b/internal/ceres/conditioned_cost_function_test.cc
@@ -41,7 +41,7 @@
 namespace internal {
 
 // The size of the cost functions we build.
-static const int kTestCostFunctionSize = 3;
+static constexpr int kTestCostFunctionSize = 3;
 
 // A simple cost function: return ax + b.
 class LinearCostFunction : public CostFunction {
diff --git a/internal/ceres/cubic_interpolation_test.cc b/internal/ceres/cubic_interpolation_test.cc
index e1abb0f..4cf27ff 100644
--- a/internal/ceres/cubic_interpolation_test.cc
+++ b/internal/ceres/cubic_interpolation_test.cc
@@ -38,7 +38,7 @@
 namespace ceres {
 namespace internal {
 
-static const double kTolerance = 1e-12;
+static constexpr double kTolerance = 1e-12;
 
 TEST(Grid1D, OneDataDimension) {
   int x[] = {1, 2, 3};
@@ -255,8 +255,8 @@
   }
 
  private:
-  static const int kNumSamples = 10;
-  static const int kNumTestSamples = 100;
+  static constexpr int kNumSamples = 10;
+  static constexpr int kNumTestSamples = 100;
   std::unique_ptr<double[]> values_;
 };
 
@@ -375,10 +375,10 @@
 
 
   Eigen::Matrix3d coeff_;
-  static const int kNumRows = 10;
-  static const int kNumCols = 10;
-  static const int kNumRowSamples = 100;
-  static const int kNumColSamples = 100;
+  static constexpr int kNumRows = 10;
+  static constexpr int kNumCols = 10;
+  static constexpr int kNumRowSamples = 100;
+  static constexpr int kNumColSamples = 100;
   std::unique_ptr<double[]> values_;
 };
 
diff --git a/internal/ceres/invert_psd_matrix_test.cc b/internal/ceres/invert_psd_matrix_test.cc
index 9ca38e3..279eeab 100644
--- a/internal/ceres/invert_psd_matrix_test.cc
+++ b/internal/ceres/invert_psd_matrix_test.cc
@@ -36,8 +36,8 @@
 namespace ceres {
 namespace internal {
 
-static const bool kFullRank = true;
-static const bool kRankDeficient = false;
+static constexpr bool kFullRank = true;
+static constexpr bool kRankDeficient = false;
 
 template <int kSize>
 typename EigenTypes<kSize, kSize>::Matrix RandomPSDMatrixWithEigenValues(
diff --git a/internal/ceres/loss_function.cc b/internal/ceres/loss_function.cc
index 5963d48..2c21a73 100644
--- a/internal/ceres/loss_function.cc
+++ b/internal/ceres/loss_function.cc
@@ -102,7 +102,9 @@
   // large, it will overflow.  Since numerically 1 + e^x == e^x when the
   // x is greater than about ln(2^53) for doubles, beyond this threshold
   // we substitute x for ln(1 + e^x) as a numerically equivalent approximation.
-  static const double kLog2Pow53 = 36.7;  // ln(MathLimits<double>::kEpsilon).
+
+  // ln(MathLimits<double>::kEpsilon).
+  static constexpr double kLog2Pow53 = 36.7;
   if (x > kLog2Pow53) {
     rho[0] = s - a_ - c_;
     rho[1] = 1.0;
diff --git a/internal/ceres/numeric_diff_test_utils.h b/internal/ceres/numeric_diff_test_utils.h
index 0eddebb..33497d9 100644
--- a/internal/ceres/numeric_diff_test_utils.h
+++ b/internal/ceres/numeric_diff_test_utils.h
@@ -39,10 +39,10 @@
 namespace internal {
 
 // Noise factor for randomized cost function.
-static const double kNoiseFactor = 0.01;
+static constexpr double kNoiseFactor = 0.01;
 
 // Default random seed for randomized cost function.
-static const unsigned int kRandomSeed = 1234;
+static constexpr unsigned int kRandomSeed = 1234;
 
 // y1 = x1'x2      -> dy1/dx1 = x2,               dy1/dx2 = x1
 // y2 = (x1'x2)^2  -> dy2/dx1 = 2 * x2 * (x1'x2), dy2/dx2 = 2 * x1 * (x1'x2)
diff --git a/internal/ceres/rotation_test.cc b/internal/ceres/rotation_test.cc
index 197495f..6a06632 100644
--- a/internal/ceres/rotation_test.cc
+++ b/internal/ceres/rotation_test.cc
@@ -334,7 +334,7 @@
   EXPECT_LE(angle, kPi);
 }
 
-static const int kNumTrials = 10000;
+static constexpr int kNumTrials = 10000;
 
 // Takes a bunch of random axis/angle values, converts them to quaternions,
 // and back again.
@@ -475,7 +475,7 @@
 
 TEST(Rotation, AtPiAngleAxisRoundTrip) {
   // A rotation of kPi about the X axis;
-  static const double kMatrix[3][3] = {
+  static constexpr double kMatrix[3][3] = {
     {1.0,  0.0,  0.0},
     {0.0,  -1.0,  0.0},
     {0.0,  0.0,  -1.0}
diff --git a/internal/ceres/visibility.cc b/internal/ceres/visibility.cc
index 72a1c33..0981eed 100644
--- a/internal/ceres/visibility.cc
+++ b/internal/ceres/visibility.cc
@@ -125,7 +125,7 @@
   // Add vertices and initialize the pairs for self edges so that self
   // edges are guaranteed. This is needed for the Canonical views
   // algorithm to work correctly.
-  static const double kSelfEdgeWeight = 1.0;
+  static constexpr double kSelfEdgeWeight = 1.0;
   for (int i = 0; i < visibility.size(); ++i) {
     graph->AddVertex(i);
     graph->AddEdge(i, i, kSelfEdgeWeight);
diff --git a/internal/ceres/visibility_based_preconditioner.cc b/internal/ceres/visibility_based_preconditioner.cc
index 2b60fac..3372e82 100644
--- a/internal/ceres/visibility_based_preconditioner.cc
+++ b/internal/ceres/visibility_based_preconditioner.cc
@@ -65,9 +65,9 @@
 //
 // This will require some more work on the clustering algorithm and
 // possibly some more refactoring of the code.
-static const double kCanonicalViewsSizePenaltyWeight = 3.0;
-static const double kCanonicalViewsSimilarityPenaltyWeight = 0.0;
-static const double kSingleLinkageMinSimilarity = 0.9;
+static constexpr double kCanonicalViewsSizePenaltyWeight = 3.0;
+static constexpr double kCanonicalViewsSimilarityPenaltyWeight = 0.0;
+static constexpr double kSingleLinkageMinSimilarity = 0.9;
 
 VisibilityBasedPreconditioner::VisibilityBasedPreconditioner(
     const CompressedRowBlockStructure& bs,