properties file and construction of struct

H

Hicham Mouline

Hello

I have a struct D of primitive member types that derives from B also of
primitive types
(double, int) which I construct from an input stream.

struct B {
double f1;
int f2;
};

struct D: public B {
double f3;
double f4;
...
};

The input stream would contain (not necessarily in this order) :

f1 = 5.0
f2 = 4
f3 = 7.0
f4 = 5.6
....

This seems to be a common enough situation? that there should be some
library out there for this?

otherwise, do I implement:

1. D::D(std::istream&)
or
2. std::istream& operator>>(std::istream& input, D& data);

where do i check that the values are acceptable by the application?

If the input is wrong, do I throw a std::exception

regards,
 

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,772
Messages
2,569,589
Members
45,100
Latest member
MelodeeFaj
Top