samedi 26 mai 2018

C++ - 60603 (Fedora Cygwin 5.4.0-2) when using std::cout

I was practicing using the auto and decltype keywords.

When I tried to add 2 values and print the resul, I got 60603 (Fedora Cygwin 5.4.0-2) in the console.

I'm think that's probably the name of my compiler, right? Why did I get that? Because that's pretty confusing, as I'm only a rookie to the C++ world.

Here's the complete code:

#include <iostream>

template<class T, class K>
auto test(T val1, K val2) -> decltype(val1 + val2) {
    return val1 + val2;
};

int main() {

    std::cout << test("Hello There!", 99);

    return 0;
}

Thanks for your time!

Aucun commentaire:

Enregistrer un commentaire