J
JackC
Hi,
I have written the following function to retrieve a class instance
from a vector, if found it returns the object.
CServer CServerControl::GetServer(string alias)
{
for(vector<CServer>::size_type i = 0; i < servers.size(); ++i)
{
if(servers.GetServerAlias() == alias)
{
// Return the server
return servers;
}
}
// Return error value here
}
Question is, how do i return a bad value if the alias is not found in
the vector? It wont let me return a NULL reference, maybe i am
approaching this incorrectly? Any tips on a better solution?
Thanks
Jack
I have written the following function to retrieve a class instance
from a vector, if found it returns the object.
CServer CServerControl::GetServer(string alias)
{
for(vector<CServer>::size_type i = 0; i < servers.size(); ++i)
{
if(servers.GetServerAlias() == alias)
{
// Return the server
return servers;
}
}
// Return error value here
}
Question is, how do i return a bad value if the alias is not found in
the vector? It wont let me return a NULL reference, maybe i am
approaching this incorrectly? Any tips on a better solution?
Thanks
Jack