断言语句中模板结构实例化的语法错误

Syntax error for template struct instantiation inside assert statement

对于 header 中定义的以下模板结构:

#include <unordered_set>

namespace Utilities::ContainerHelpers
{
    template <template <class> class TContainer, class TVal>
    struct is_unique
    {
        bool operator()(TContainer<TVal> const& container) const
        {
            std::unordered_set<TVal, typename TVal::HashFunc> 
                uniqueSubset(container.begin(), container.end());

            return container.size() == uniqueSubset.size();
        }
    };
}

在断言上下文中使用时出现语法错误:

assert(Utilities::ContainerHelpers::is_unique< std::vector, TelemDetail >{}(telem_detail_obj);

但当定义为断言之外的临时时则不会。 TelemDetail 类型并不重要,只是包含一个嵌套的 HashFunc 结构类型。

warning C4002: too many arguments for function-like macro invocation 'assert'

error C2059: syntax error: ')'

感觉我错过了一些明显的东西?使用 MSVC 2019 -std=c++17

编译

assert,作为每个宏,不理解 C++,它将每个逗号 , 视为参数分隔符:

assert(is_unique< std::vector, TelemDetail >{}(session_details));
//    (   first arg          ,  second arg                     )
//                                   

但是预处理器宏“理解”() - 所以只需添加额外的一对 ():

assert((is_unique< std::vector, TelemDetail >{}(session_details)));