Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sets?

Status
Not open for further replies.

Sedai

Programmer
Mar 4, 2001
158
US
is there a way to create a set of elements and then check if some variable belongs to this set.
e.g.
Code:
enum punct{'.', ','};
punct xxx;
if(a!=xxx)
//...

this doesn't work of course, as xxx is only kind of type punct and can be ASSIGNED ONE of the values of punct, but is not really a set of all of them.
so
what is the correct syntax?
is it possible at all?
thank you.


Avendeval


 
If u r using MFC, try using CList. Eg. is below.

CList<char, char&> puct;
punct.AddTail('.');
punct.AddTail(',');

char a = '.';

POSITION pos = punct.Find(a);

if(pos != NULL)
AfxMessageBox(&quot;Found&quot;)

Hope this helps

raochetan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top