0

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.

TheHardew
  • 399
  • 4
  • 12

1 Answers1

1

It's stupid Intellisense. It's not aligned with the c++11 support of the compiler itself.

See also

Community
  • 1
  • 1
sehe
  • 374,641
  • 47
  • 450
  • 633