I am attempting to implement a function that will create a duplicate of a linked list and return a pointer to the list. For this copy function to truly be a copy function, the elements in the new linked list need to be in the exact same order as the original
When I compile the code below I get the following error:
error C2780: '_OI __cdecl std::copy(_II,_II,_OI)' : expects 3 arguments - 1 provided
From all that I can determine, my function only asks for/accepts one argument, but the compiler says it requires 3.. any ideas would be great!Code:#include <iostream> #include "d_node.h" #include "d_nodel.h" using namespace std; template<typename T> node<T> *copy(node<T> *front); int main() { dnode<double> *header=new dnode<double>; dnode<double> *newList2=new dnode<double>; insert(header->next, 5.5); insert(header->next, 6.7); insert(header->next, 15.3); insert(header->next, 3.14); insert(header->next, 2.718); insert(header->next, 15.3); insert(header->next, 3.5); writeDLinkedList(header); newList2=copy(header); writeDLinkedList(newList2); return 0; } template<typename T> node<T> *copy(node<T> *front) { dnode<T> *newList=new dnode<T>; node<T> *curr=front; while (curr !=NULL) { *newList.front()=front; curr=curr->next; } return *newList; }
Thanks!



LinkBack URL
About LinkBacks


