I've got some simple code:
#include <iostream>
#include <boost/variant.hpp>
using namespace std;
template <typename Arg, typename... Args>
auto WhichParametr(unsigned int n, Arg arg, Args... args) -> boost::variant < Arg, Args... > {
if (n != 1)
return WhichParametr(n - 1, args...);
return arg;
}
template <typename T>
T WhichParametr(unsigned int n, T arg){
return arg;
}
int main(){
cout << WhichParametr(4, 1, 2, '3', "foo");
cin.get();
cin.get();
return 0;
}
WhichParametr() function returns n parametr that was given ( WhichParametr(1, 2, 3) returns 2 ). My IDE Visual Studio 2013 says there is no overload that matches the argument list, tough program runs fine. Is there something in that code that I shouldn't use or is this just stupid IDE? Thanks in advance.