I have the following wrapper of std::make_unique:
template <typename Element, typename... ArgTypes>
auto makeUnique(ArgTypes&&... arguments) {
return std::make_unique<Element>(std::forward<ArgTypes>(arguments)...);
}
which is used this way:
template <typename F>
static auto createCustomValidator(F &&validator) {
auto func = [validator = std::forward<F>(validator)](const int val){ return validator(seconds(val)); };
return makeUnique<property::CustomDoubleValidator<decltype(func)>>( std::move(func) );
}
Previous versions of Visual Studio accepted the following:
return makeUnique<property::CustomDoubleValidator<decltype(func)>>{ std::move(func) };
(notice the curly braces around std::move)
Visual Studio 16.5 breaks this and can only be fixed with parenthesis instead of curly braces. Which one is correct?