Aillyn Aillyn - 7 months ago 29
C++ Question

Creating a set<char> in C++

I am coding this thing and it would be helpful to have a

static const set<char>
containing some elements that won't change.

class MyClass {
static const set<char> mySet = ??

How can I do this? It would be nice if you could create them from a string, like
, but I can't get the syntax to work.


Something like this will work just fine:

// my_class.h
class MyClass
  static const std::set<char> mySet;

// my_class.cpp
const char *tmp = "ABCDEFGHI";
const std::set<char> MyClass::mySet(tmp,tmp+strlen(tmp));