I installed visual studio 2017 for c++ desktop and linux development some about an hour ago I tried this code which uses c++17 auto templates and was surprised that it gives an error saying :
Error C3533 a parameter cannot have a type that contains 'auto'
this is the code causing the problem
template <class T, T null_value, bool no_negative, auto Deleter>
struct HandleHelper
{
using pointer = HandleWrapper<T, null_value, no_negative>;
void operator(pointer p)
{
Deleter(p);
}
};
before in visual studio 2015 I used something like this due to lack of c++17 support :
template <class T, T null_value, bool no_negative, class DelType, DelType Deleter>
struct HandleHelper
{
using pointer = HandleWrapper<T, null_value, no_negative>;
void operator(pointer p)
{
Deleter(p);
}
};
but auto templates looks more elegant
Make sure you have the correct "C++ Language Standard" set in the property pages for your project. The default for VS 2017
is C++14
.
Right click on your project and select "Properties".
Then expand the C/C++
node on the tree view on the left hand side.
Select "Language" from the expanded menu options.
Check that the "C++ Language Standard" is set to ISO C++17 Standard (/std:c++17)
.
If its blank, it will default to C++14
.