copying string from one string pointer array to another

if(temp>final_hash_index_one)
{
string *tmp = new string[temp+1];
std::copy(level_two, tmp, final_hash_index_one+1);
delete [] level_two;
level_two = tmp;
}
this method is not working and is giving me an exception that is "invalid null pointer"!!

string *tmp = new string[some_size];
string *level_two = new string[some_size];
how to copy contents from level_two to tmp??? in case of string one; string two . we can copy the string through loop. but what in this case??

how to copy through loop string by string??
std::copy( level_two->begin(), level_two->end(), tmp->begin() );
or
std::copy( level_two->begin(), level_two->end(), std::back_inserter( *tmp) );


But I am afraid that you do not understand what is std::string class and how does std::copy work.
Last edited on
Topic archived. No new replies allowed.