I have an error when making the first push_back. The struct contains an enum.
The error is: "Exception thrown: read access violation._Pnext was 0xFFFFFFFFFFFFFFFF."
enum s_piece_e_tipo { RING, CYLINDER };
struct s_piece
{
s_piece_e_tipo tipo;
double R1, R2, Z1, Z2;
};
struct s_point
{
double xyz[3],potential,Efield,Q;
};
class c_static2D
{
public:
void mete_cylinder(double z0, double R, double iz, double potential);
protected:
vector<s_point> points; vector<s_piece> pieces;}
void c_static2D::mete_cylinder(double z0, double R, double iz, double potential)
{
s_point point{ { R,0,0 },potential,-777,-777 };
points.push_back(point); s_piece pie{ s_piece_e_tipo::CYLINDER,R,R,z0,z0+iz };
pieces.push_back(pie); }
What I have tried:
As I said, this works:
s_point point{ { R,0,0 },potential,-777,-777 };
points.push_back(point);