I have been struggling with this one for a day now and I cant seem to figure out if my problem is syntax or simple impossibility. The function in question looks something like this:
string *function( string temp[] )
{
string sides[ 4 ];
// code
return sides;
}
and I am calling it like so:
string *tempSide = function( sides[ 0 ] );
sides[ 0 ] being an element of a matrix of strings. When I compile and run, I get this message:
terminate called after throwing an instance of 'std::length_error'
what(): basic_string::_S_create
I have never encountered this before, nor have I ever attempted to return a string array (which if I am not mistaken is itself matrix) or pass an element of a string matrix as an argument so I am fully willing to accept that I am just doing something silly. However a viable solution that wont require a full rewrite of the rest of my code (which I cant actually show) would be preferable. Thank you for your time.