Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::array arr{ 1, 2, 3, 4, 5 }; // with C++17 template argument deduction
- std::array<int, 5> arr{ 1, 2, 3, 4, 5 }; // just a normal C++11 std::array
- std::array arr{ 1, 2, 3.f, 4, 5 };
- main.cpp:7:26: error: class template argument deduction failed:
- std::array arr{2,4.,5}; // will not compile
- std::array<float> arr{ 1, 2, 3.f, 4, 5 }; // will not compile as well
- main.cpp:7:21: error: wrong number of template arguments (1, should be 2)
- std::array<float> arr{2,4.,5};
- ^
- std::tuple t(1, 2, 3); // OK: deduction
- std::tuple<int,int,int> t(1, 2, 3); // OK: all arguments are provided
- std::tuple<int> t(1, 2, 3); // Error: partial deduction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement