I can't initialize union in std::pair.
I have this kind of typedef
enum EValueType
{
Int,
Double,
Variable,
Unknown
};
union UValueContainer
{
int __int;
double __double;
double* __variable;
};
typedef std::pair<EValueType, UValueContainer> variant;
and I have a base class with constructor, which gets a attribute of variant
type
class fooBase
{
fooBase(variant attribute);
...
}
and a derived class with constructor, which have to initialize argument of base class constructor.
class fooDerived : public fooBase
{
fooDerived(double* value) : fooBase({Variable, UValueContainer{.__variable = value}}
}
How can I do it?
Aucun commentaire:
Enregistrer un commentaire