Skip to content

Do not use variadic type parameters in templates #6

@dangelog

Description

@dangelog

A container's type may include non-type template parameters, e.g.

QVarLengthArray<int, 32> container;
                  // ^^ NTTP

Accepting them with template <typename ...> typename Container will therefore fail:

    QVector<int> vec{1, 2, 3, 4};
    const auto toString = [](int i) { return QString::number(i); };
    auto result = KDAlgorithms::transformed<QVarLengthArray>(vec, toString); // ERROR

For some reason this was a deliberate choice. But why simply using template <typename> typename Container doesn't work here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions