add asignement operator & update setSize method
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2368 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
b89dd5d968
commit
6f594cb0c8
1 changed files with 5 additions and 17 deletions
|
|
@ -70,17 +70,6 @@ public:
|
||||||
create();
|
create();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*Assignment operator
|
|
||||||
*@param _vector The vector passed to the function to fix the new content.
|
|
||||||
*@return a new vector.
|
|
||||||
*/
|
|
||||||
|
|
||||||
moGPUIntVector& operator=(const moGPUIntVector & _vector) {
|
|
||||||
moGPUVector<int, Fitness>::operator=(_vector);
|
|
||||||
return (*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*Initializer of random integer vector.
|
*Initializer of random integer vector.
|
||||||
*/
|
*/
|
||||||
|
|
@ -98,20 +87,19 @@ public:
|
||||||
|
|
||||||
virtual inline __host__ void setSize(unsigned _size) {
|
virtual inline __host__ void setSize(unsigned _size) {
|
||||||
|
|
||||||
if(_size<N) {
|
if(N==_size)
|
||||||
|
return;
|
||||||
moGPUIntVector<Fitness> tmp_vect(_size);
|
moGPUIntVector<Fitness> tmp_vect(_size);
|
||||||
|
if(_size<N) {
|
||||||
for (unsigned i = 0; i < tmp_vect.N; i++)
|
for (unsigned i = 0; i < tmp_vect.N; i++)
|
||||||
tmp_vect.vect[i]= vect[i];
|
tmp_vect.vect[i]= vect[i];
|
||||||
(tmp_vect).invalidate();
|
|
||||||
(*this)=tmp_vect;
|
|
||||||
}
|
}
|
||||||
else if(_size>N) {
|
else if(_size>N) {
|
||||||
moGPUIntVector<Fitness> tmp_vect(_size);
|
|
||||||
for (unsigned i = 0; i <N; i++)
|
for (unsigned i = 0; i <N; i++)
|
||||||
tmp_vect.vect[i]= vect[i];
|
tmp_vect.vect[i]= vect[i];
|
||||||
|
}
|
||||||
(tmp_vect).invalidate();
|
(tmp_vect).invalidate();
|
||||||
(*this)=tmp_vect;
|
(*this)=tmp_vect;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue