/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Examples/test-suite/errors/cpp_concept_redefinition.i
24 строки
781 B
William S Fulton
C++20 concepts: extend tests and document broader support
13 май 2026, 01:04
13 май 2026, 01:04
ad7b85e
Код
Авторство
О чём код?
%module xxx %inline %{ #include <concepts> template<typename T> concept Numeric = std::integral<T> || std::floating_point<T>; // Two function templates with the same name and signature, differing only by their requires-clause. // SWIG does not model C++20 constraint subsumption, so the second declaration is dropped with warning 302. template<typename T> requires std::integral<T> T process(T x) { return x + 1; } template<typename T> requires std::floating_point<T> T process(T x) { return T(x * 2.0); } // Same limitation applies to constructor overloads that share a signature and differ only by requires-clause. template<typename T> class Box { public: Box(T v) requires std::integral<T> { (void)v; } Box(T v) requires std::floating_point<T> { (void)v; } }; %}