https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91837

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-*, i?86-*-*

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
For reference:

#include <iostream>
#include <vector>
#include <cstddef>
#include <algorithm>

struct Model
{
    int open, extend;
};

struct Cell
{
    int a, b;
};

typedef std::vector<std::vector<Cell>> DPMatrix;

void print(const DPMatrix& matrix)
{
    for (std::size_t i = 0; i < matrix.size(); ++i) {
        for (std::size_t j = 0; j < matrix[i].size(); ++j) {
            std::cout << '{' << matrix[i][j].a << ' ' << matrix[i][j].b << "}
";
        }
        std::cout << std::endl;
    }
}

DPMatrix init_dp_matrix(const std::size_t num_cols, const std::size_t num_rows,
const Model& model)
{
    DPMatrix result(num_cols, DPMatrix::value_type(num_rows, Cell()));
    const int inf = model.open * std::max(num_cols, num_rows);
    for (int i = 1; i < num_cols; ++i) {
        result[i][0].b = model.open + (i - 1) * model.extend;
    }
    for (int j = 1; j < num_rows; ++j) {
        result[0][j].a = model.open + (j - 1) * model.extend;
    }
    return result;
}

int main()
{
    const Model model = {-8, -1};
    const DPMatrix matrix = init_dp_matrix(10, 2, model);
    print(matrix);
}

Reply via email to