dimanche 24 septembre 2017

Compare variadic arguments by value

Is there a way to compare the values of each type of a variadic template?

template<typename... S>
class Signature {
    S... values;

    bool equals(S... s) {
        // this is not valid syntax
        bool eq = true;
        eq &= s... &= values...;
        return eq;
    }
};

Example:

Signature<int, bool> s(5, true);
s.equals(5, true); // should result in 1

Aucun commentaire:

Enregistrer un commentaire