I understand how a basic struct
works in C++, as in this example:
struct Options
{
int num_particles;
bool use_lbp;
string infile;
string outfile;
};
However, I do not understand the following, where in the declaration there is an additional section. What is the purpose of Options():...
?
struct Options
{
Options()
:num_particles(NUM_PARTICLES),
use_lbp(false),
infile(),
outfile()
{}
int num_particles;
bool use_lbp;
string infile;
string outfile;
};
Is this similar to what is going on in the code below?
struct State_
{
State_( State pp ) : p( pp ) { }
operator State() { return p; }
State p;
};