my assignment was to implement a sequence class with dynamic array
for some reason the only error is this:
1>c:\documents and settings\joe\de sktop\spring 2010\csc 212\hw\hw #3\sequence2.cx x(53) : error C3861: 'copy': identifier not found
^there are 3 of these since i used copy 3 times
copy is part of algorithm and i did the #include<algori thm>
ive look through this code MANY MANY times and i still cant find my mistake
please someone look through this and help me spot my possibly obvious mistake! thank you!
for some reason the only error is this:
1>c:\documents and settings\joe\de sktop\spring 2010\csc 212\hw\hw #3\sequence2.cx x(53) : error C3861: 'copy': identifier not found
^there are 3 of these since i used copy 3 times
copy is part of algorithm and i did the #include<algori thm>
ive look through this code MANY MANY times and i still cant find my mistake
please someone look through this and help me spot my possibly obvious mistake! thank you!
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);
}
Code:
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 + current_index, larger_array);
delete [] data;
data = larger_array;
capacity = new_capacity;
}
Code:
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);
}
Comment