Fix example code in the documentation.

The example code for DynamicNumericDiffCostFunction and
DynamicAutoDiffCostFunction in the documentation was
allocating the cost function objects on the stack rather
than the heap.

Thanks to Rodney Hoskinson for reporting this.

Change-Id: I217aee02d1e2c1e9c25b8197451e9f9e0482915d
diff --git a/docs/source/nnls_modeling.rst b/docs/source/nnls_modeling.rst
index 276a046..fba2fe1 100644
--- a/docs/source/nnls_modeling.rst
+++ b/docs/source/nnls_modeling.rst
@@ -332,11 +332,12 @@
 
      .. code-block:: c++
 
-       DynamicAutoDiffCostFunction<MyCostFunctor, 4> cost_function(
+       DynamicAutoDiffCostFunction<MyCostFunctor, 4>* cost_function =
+         new DynamicAutoDiffCostFunction<MyCostFunctor, 4>(
            new MyCostFunctor());
-       cost_function.AddParameterBlock(5);
-       cost_function.AddParameterBlock(10);
-       cost_function.SetNumResiduals(21);
+       cost_function->AddParameterBlock(5);
+       cost_function->AddParameterBlock(10);
+       cost_function->SetNumResiduals(21);
 
    Under the hood, the implementation evaluates the cost function
    multiple times, computing a small set of the derivatives (four by
@@ -561,11 +562,11 @@
 
      .. code-block:: c++
 
-       DynamicNumericDiffCostFunction<MyCostFunctor> cost_function(
-           new MyCostFunctor());
-       cost_function.AddParameterBlock(5);
-       cost_function.AddParameterBlock(10);
-       cost_function.SetNumResiduals(21);
+       DynamicNumericDiffCostFunction<MyCostFunctor>* cost_function =
+         new DynamicNumericDiffCostFunction<MyCostFunctor>(new MyCostFunctor);
+       cost_function->AddParameterBlock(5);
+       cost_function->AddParameterBlock(10);
+       cost_function->SetNumResiduals(21);
 
    As a rule of thumb, try using :class:`NumericDiffCostFunction` before
    you use :class:`DynamicNumericDiffCostFunction`.