Is it possible to use an stl data type as the return type of a function? (see code below for an example). Also, can stl data types and iterators be passed by reference?
set<Action> Init::AllPossibleActions()
{
class Action f(0);
class Action t(1);
set<Action> all;
pair<set<Action>::iterator, bool> inserted;
inserted = all.insert(f);
if (!inserted.second)//insertion was unsuccessful
cerr << "AllPossibleActions insertion into set unsuccessful\n";
inserted = all.insert(t);
if (!inserted.second)//insertion was unsuccessful
cerr << "AllPossibleActions insertion into set unsuccessful\n";
#ifdef DEBUG
set<Action>::iterator pos;
cout << "All possible Actions\n";
for(pos = all.begin(); pos != all.end(); ++pos)
{
cout << *pos << " ";
}
cout << "\n";
#endif
return all;
}
set<Action> Init::AllPossibleActions()
{
class Action f(0);
class Action t(1);
set<Action> all;
pair<set<Action>::iterator, bool> inserted;
inserted = all.insert(f);
if (!inserted.second)//insertion was unsuccessful
cerr << "AllPossibleActions insertion into set unsuccessful\n";
inserted = all.insert(t);
if (!inserted.second)//insertion was unsuccessful
cerr << "AllPossibleActions insertion into set unsuccessful\n";
#ifdef DEBUG
set<Action>::iterator pos;
cout << "All possible Actions\n";
for(pos = all.begin(); pos != all.end(); ++pos)
{
cout << *pos << " ";
}
cout << "\n";
#endif
return all;
}