При реализации is_function
я пытаюсь перечислить каждый случай вручную с помощью макроса:
#define ImplIsFun(QUALIFIERS) \
template<typename R, typename... Args> \
struct is_function<R(Args...) QUALIFIERS> : public true_ \
{}; \
template<typename R, typename... Args> \
struct is_function<R(Args... COMMA...) QUALIFIERS> : public true_ \
{};
// clang-format off
ImplIsFun()
ImplIsFun(const)
ImplIsFun(&)
ImplIsFun(&&)
ImplIsFun(volatile)
ImplIsFun(noexcept)
ImplIsFun(const volatile)
ImplIsFun(const &)
ImplIsFun(const &&)
ImplIsFun(const noexcept)
ImplIsFun(volatile &)
ImplIsFun(volatile &&)
ImplIsFun(volatile noexcept)
ImplIsFun(const volatile &)
ImplIsFun(const & noexcept)
ImplIsFun(const && noexcept )
ImplIsFun(const volatile &&)
ImplIsFun(const volatile noexcept)
// clang-format on
И появляется предупреждение:
../include/rider/faiz/type_traits.hpp:315:2: warning: '...' in this location creates a C-style
varargs function [-Wambiguous-ellipsis]
ImplIsFun(const &&)
^~~~~~~~~~~~~~~~~~~
https://clang.llvm.org/docs/DiagnosticsReference.html#wambiguous-ellipsis
Эта диагностика включена по умолчанию.
Диагностический текст:
предупреждение: «...» в этом месте создает функцию varargs в стиле C, а не пакет параметров функции
Итак, переменные в стиле C могут конфликтовать с шаблоном variadic.Существуют ли какие-либо обходные пути / решения (также приветствуется библиотека boost.preprocessor, hana или другого генератора кода)?