mardi 26 janvier 2016

Passing a std::pair templated with two template arguments as a parameter

I am writing a function, insertPairIntoVector, that will insert a std::pair into a std::vector based on a comparison of the second element in the pair. My prototype looks like this:

template <typename T, typename Q>
std::vector<std::pair<T, Q>> sortPairIntoVector(
    std::pair<T,Q>, std::vector<std::pair<T, Q>>);

And my function definition looks like this:

template <typename T, typename Q>
std::vector<std::pair<T, Q>> sortPairIntoVector(
    std::pair<T, Q>, std::vector<std::pair<T, Q>>) {

}

but I am still getting a ton of ambiguous errors regarding templates. Any help as to what I am doing wrong? Thanks!

Aucun commentaire:

Enregistrer un commentaire