Put alphabet in vector

I need to put every letter of the alphabet in a vector isolated, so like this:

|A||B|C|D|...|X|Y|Z|

How would I go about doing this efficiently?
You could use the ascii table and loop through it with the first number being the start of the alphabet (41 for capital A and 61 for lower case a).
Start with 'A' and continue 'til 'Z'?

1
2
	char alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
	std::vector<char> alphabet( alpha, alpha+sizeof(alpha)-1 ) ;
Does that work Cire? I've only done the most basic work with C++ and STL containers. I'm always seeing new methods that boggle my mind.
Yes, it works. The behavior required for iterators is satisfied by non-void pointer types.
Last edited on
Topic archived. No new replies allowed.