Initialize static members with objects

J

Johannes Bauer

Hello group,

I'm changing some code from C-style to STL-C++. In the old code,
something along the lines of this is used:

struct foo {
int x, y;
};

class moo {
private:
const foo[] foos;
};

and then in a cpp-file:

const foo[] moo::foos = {
{ 12, 14 },
{ 99, 3 },
{ 1, 2 },
{ 0 },
};

Now I'd like to change that to

class moo {
private:
const std::set<foo> foos;
};

and init that like the above C-style declaration. Is that possible? If
so, how?

Kind regards,
Johannes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top