add asignement operator
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2369 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
6f594cb0c8
commit
37835557fc
1 changed files with 87 additions and 87 deletions
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __moGPUVector_H_
|
#ifndef __moGPUVector_H_
|
||||||
#define __moGPUVector_H_
|
#define __moGPUVector_H_
|
||||||
|
|
@ -43,9 +43,9 @@
|
||||||
|
|
||||||
template<class ElemT, class Fitness>
|
template<class ElemT, class Fitness>
|
||||||
|
|
||||||
class moGPUVector: public EO<Fitness> {
|
class moGPUVector: public EO<Fitness> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define vector type corresponding to Solution
|
* Define vector type corresponding to Solution
|
||||||
|
|
@ -62,12 +62,11 @@ template<class ElemT, class Fitness>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*Constructor.
|
*Constructor.
|
||||||
*@param _neighborhoodSize The neighborhood size.
|
*@param _size The solution size.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
moGPUVector(unsigned _neighborhoodSize) :
|
moGPUVector(unsigned _size) :
|
||||||
N(_neighborhoodSize) {
|
N(_size) {
|
||||||
|
|
||||||
vect = new ElemType[N];
|
vect = new ElemType[N];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -113,12 +112,13 @@ template<class ElemT, class Fitness>
|
||||||
moGPUVector& operator=(const moGPUVector & _vector) {
|
moGPUVector& operator=(const moGPUVector & _vector) {
|
||||||
|
|
||||||
if (!(N == _vector.N)) {
|
if (!(N == _vector.N)) {
|
||||||
delete[] vect;
|
|
||||||
N = _vector.N;
|
N = _vector.N;
|
||||||
vect = new ElemType[N];
|
vect = new ElemType[N];
|
||||||
}
|
}
|
||||||
for (unsigned i = 0; i < N; i++)
|
for (unsigned i = 0; i < N; i++){
|
||||||
vect[i] = _vector.vect[i];
|
vect[i] = _vector[i];
|
||||||
|
}
|
||||||
|
|
||||||
if (!(_vector.invalid()))
|
if (!(_vector.invalid()))
|
||||||
fitness(_vector.fitness());
|
fitness(_vector.fitness());
|
||||||
else
|
else
|
||||||
|
|
@ -174,7 +174,7 @@ template<class ElemT, class Fitness>
|
||||||
|
|
||||||
virtual void printOn(std::ostream& os) const=0;
|
virtual void printOn(std::ostream& os) const=0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
ElemType * vect;
|
ElemType * vect;
|
||||||
unsigned N;
|
unsigned N;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue