hello everyone
im writing a program for "sequence class with dynamic arrays"
every time i compile it gives me this error:
i believe all 3 is the same
to use copy i know i have to include algorithm
here is my copy function codes used in this program:
ive look through the whole thing and everything seem correct to me
anyone can help me out n spot my mistake...
thanks in advance
im writing a program for "sequence class with dynamic arrays"
every time i compile it gives me this error:
1>c:\documents and settings\yue jiang\desktop\s pring 2010\csc 212\hw\hw #3\sequence2.cx x(30) : error C3861: 'copy': identifier not found
1>c:\documents and settings\yue jiang\desktop\s pring 2010\csc 212\hw\hw #3\sequence2.cx x(53) : error C3861: 'copy': identifier not found
1>c:\documents and settings\yue jiang\desktop\s pring 2010\csc 212\hw\hw #3\sequence2.cx x(141) : error C3861: 'copy': identifier not found
1>c:\documents and settings\yue jiang\desktop\s pring 2010\csc 212\hw\hw #3\sequence2.cx x(53) : error C3861: 'copy': identifier not found
1>c:\documents and settings\yue jiang\desktop\s pring 2010\csc 212\hw\hw #3\sequence2.cx x(141) : error C3861: 'copy': identifier not found
to use copy i know i have to include algorithm
here is my copy function codes used in this program:
Code:
sequence::sequence(const sequence& source)
{//copy constructor
data= new value_type[source.capacity];
capacity = source.capacity;
used = source.used;
current_index = source.current_index;
copy(source.data, source.data + used, data);
}
void sequence::resize(size_type new_capacity)
{//changes capacity accordingly
value_type* larger_array;
if(new_capacity == capacity)
return;
if(new_capacity < used)
new_capacity = used;
larger_array = new value_type[new_capacity];
copy(data, data + used, larger_array);
delete [] data;
data = larger_array;
capacity = new_capacity;
}
void sequence::operator = (const sequence& source)
{//modify =
value_type* new_data;
if(this == &source)
return;
if(capacity != source.capacity)
{
new_data = new value_type[source.capacity];
delete [] data;
data = new_data;
capacity = source.capacity;
}
used = source.used;
current_index = source.current_index;
copy(source.data, source.data+used, data);
}
anyone can help me out n spot my mistake...
thanks in advance
Comment