0

I would like to initialize a user defined struct with the = operator and a scalar type (for example: double) on its right hand side, like this:

```
struct real
{
double value;
double error;
...
};
int main()
{
real x = 1.; // supposing error=0.
}
```

It is possible somehow?

I defined my struct like this:

```
struct real
{
double value;
double error;
real(double val, double err);
};
real::real(double val, double err=0);
```

This allows initializatin like this:

```
real x(1.,0.);
real y(1.);
```

I can also overload operator=

```
real operator=(const real param);
real operator=(const double param);
```

but I can not initialize with it!

I can overload the cast operator double(),

but I need the oposite one!

I need to convert double -> real,

and not real -> double!

How can I solve this problem?