jeudi 1 janvier 2015

clang compilation error with template function

I'm compiling some code I wrote and compiled with the microsoft toolchain. Here is some piece of code for which I do not understand the error:



#include <iostream>
#include <bitset>

template <int N>
auto foo(int index, std::bitset<N> & already_given)->int
{
return 0;
}


auto bar()->void
{
auto const n = 10;

auto baz = std::bitset<n>{};
for (auto i = 0; i < n; i++) {
std::cout << foo(i, baz)
<< std::endl;
}
}


gives me the error no matching function to call to 'foo'. What is the source of this error?


Aucun commentaire:

Enregistrer un commentaire