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
1 file changed