user3394626
user3394626

Reputation: 49

How to create a vector of another class struc? (C++ 11)

I searched for a solution to my problem but find none, so i'm asking here.

A have a class with a public struct called equacao, and i want to create a vector of equacao in the main.cpp or in another class. But it gives an erro of :

error: 'equacao' does not name a type

Can somone help please?

tanks.

class algoritimoGenetico
{    
public:

    struct termo
    {
        std::uint_fast16_t atrazo : 6;
        std::uint_fast16_t colunaVariavel : 10;
        float expoente;
    };
    struct regresor
    {
        std::vector<termo> termos;
        std::uint_fast16_t coeficiente;
        bool divisor;
    };
    struct equacao
    {
        std::vector<regresor> regresores;
        std::uint_fast16_t maiorAtrazo;
        float aptidao;
        float erroQuadratico;

    };

And in the main.cpp i trying:

 algoritimoGenetico AG;

 std::vector<std::vector< AG.equacao > >  mat(40000, std::vector<AG.equacao> (7));

Upvotes: 2

Views: 146

Answers (1)

Cory Kramer
Cory Kramer

Reputation: 117856

Instead of the member

std::vector< AG.equacao >

You actually would have a scoped struct

std::vector< algoritimoGenetico::equacao >

Upvotes: 6

Related Questions