diff liboctave/Objective.h @ 1861:620a65533630

[project @ 1996-02-04 10:17:34 by jwe]
author jwe
date Sun, 04 Feb 1996 10:26:22 +0000
parents 26411f9c7603
children 1b57120c997b
line wrap: on
line diff
--- a/liboctave/Objective.h
+++ b/liboctave/Objective.h
@@ -1,7 +1,7 @@
 // Objective.h                                          -*- C++ -*-
 /*
 
-Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton
+Copyright (C) 1996 John W. Eaton
 
 This file is part of Octave.
 
@@ -26,45 +26,38 @@
 
 #include "dColVector.h"
 
-class Objective
+class
+Objective
 {
- public:
+public:
 
   typedef double (*objective_fcn) (const ColumnVector&);
   typedef ColumnVector (*gradient_fcn) (const ColumnVector&);
 
   Objective (void)
-    {
-      phi = 0;
-      grad = 0;
-    }
+    : phi (0), grad (0) { }
 
   Objective (const objective_fcn obj)
-    {
-      phi = obj;
-      grad = 0;
-    }
+    : phi (obj), grad (0) { }
 
   Objective (const objective_fcn obj, const gradient_fcn g)
-    {
-      phi = obj;
-      grad = g;
-    }
+    : phi (obj), grad (g) { }
 
   Objective (const Objective& a)
-    {
-      phi = a.phi;
-      grad = a.grad;
-    }
+    : phi (a.phi), grad (a.grad) { }
 
   Objective& operator = (const Objective& a)
     {
-      phi = a.phi;
-      grad = a.grad;
-
+      if (this != &a)
+	{
+	  phi = a.phi;
+	  grad = a.grad;
+	}
       return *this;
     }
 
+  ~Objective (void) { }
+
   objective_fcn objective_function (void) const { return phi; }
 
   Objective& set_objective_function (const objective_fcn obj)
@@ -81,7 +74,7 @@
       return *this;
     }
 
- private:
+private:
 
   objective_fcn phi;
   gradient_fcn grad;