TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Hugh
NA
3
0
populating an array of structs at compile time?
Mar 6 2009 5:37 PM
I'm a little embarrassed to ask this one, since it seems so fundamental, but here goes anyway:
I'm trying to create an array of structs which I'll populate at compile-time. So I've got a struct
struct S {
string str;
int idx;
double wgt;
};
which I want to populate something like this:
S [] s = {
{ "name", 0, 1.24 },
{ "foo", 3, 3.14 },
...
{ "", 0.0, 0.0 }
};
I've tried the above and a variety of permutations, but can't figure out how to get the compiler to accept it. I can call the struct a class, but that doesn't seem to make much difference. It's a big list, and this kind of problem is not unusual in coding, so there must be a way!
Thanks for any help,
Hugh
Reply
Answers (
2
)
what should i be usiing? List<> or ArrayList.. something else?
Seeking advice for recording telemetry