So i'm working on a Hangman Game using ArrayVector Data Structure. The goal at the moment that im trying to achieve is to pick a random number from a big text file. Every word is on a different line. Then insert it into an ArrayVector<string> then that word to be turned into characters and be inserted into an ArrayVector<char> that will be used.
Sadly i am unable to find a way to put the ArrayVector<string> inside the ArrayVector<char> and i have no clue what the function i should write exactly should look like. I tried implementing different stuff to use the Copy funcing with my persnal begin() and end() functions, but that was unsucessfull.
Ahelp help is welcome. Thanks in advance!
Any help would be appreciated, thanks !
¿why do you use a container if you only want one element?
> I tried implementing different stuff to use the Copy funcing with my persnal
> begin() and end() functions, but that was unsucessfull.
I don't see such code.
(*l2)[0] is a string
(*l2)[0][0] is its first character
(*l2)[0][(*l2).size()-1] is its last character
I didn't show it here since it didn't work and i removed it. I tried many different options. Sorry for not including them.
I am using container beacuse i was doing something else with this beforehand to test stuff out and i was putting more than 1 element. And i just have forgotten to swittch it . Thanks for pointing that out.
Also when i try to implement what you told me in manner of.
copy(l2[0][0], l2[0][(l2->size() - 1)], l1)
I get a bunch of errors regarding xutility, but i might be understanding the " copy " itself wrongly.
The compiler generally emits useful information when it encounters an error. That information is invaluable, and so you should always include any error messages or warnings you receive, verbatim, in your posts asking for help.
Here are the errors i receive after using . Also I am using Visual Studio.
copy(l2[0][0], l2[0][(l2->size() - 1)], l1);
Severity Code Description Project File Line Suppression State
Error C2783 'auto std::_Get_unwrapped_n(const _Iter &,const _Diff)': could not deduce template argument for '__formal' Hangman c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.15.26726\include\xutility 2444
Severity Code Description Project File Line Suppression State
Error C2794 'iterator_category': is not a member of any direct or indirect base class of 'std::iterator_traits<_Iter>' Hangman c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.15.26726\include\xutility 975
Severity Code Description Project File Line Suppression State
Error C2672 '_Get_unwrapped_n': no matching overloaded function found Hangman c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.15.26726\include\xutility 2444
Severity Code Description Project File Line Suppression State
Error C2672 '_Get_unwrapped_n': no matching overloaded function found Hangman c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.15.26726\include\xutility 2444
Severity Code Description Project File Line Suppression State
Error C2938 '_Iter_cat_t<std::string>' : Failed to specialize alias template Hangman c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.15.26726\include\xutility 975
Severity Code Description Project File Line Suppression State
Error C2789 '_UDest': an object of const-qualified type must be initialized Hangman c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.15.26726\include\xutility 2444
Severity Code Description Project File Line Suppression State
Error C3536 '_UDest': cannot be used before it is initialized Hangman c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.15.26726\include\xutility 2445
Severity Code Description Project File Line Suppression State
Error C2062 type 'unknown-type' unexpected Hangman c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.15.26726\include\xutility 975