Программы на C++. Форум разработчиков
-
Anonymous
Когда и где создаются экземпляры концепций C++?
Сообщение
Anonymous »
Из
https://godbolt.org/z/bnzzMn8nK:
Код: Выделить всё
// Example program
#include
#include
namespace bar
{
template
concept has_foo = std::same_as;
}
namespace my
{
struct Foo{};
}
namespace bar
{
consteval std::true_type enable_foo(my::Foo);
}
int main()
{
bool const enable_foo_ = std::same_as;
bool const has_foo_ = bar::has_foo;
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79867651/when-and-where-are-c-concepts-instantiated[/url]
1768466991
Anonymous
Из https://godbolt.org/z/bnzzMn8nK:
[code]// Example program
#include
#include
namespace bar
{
template
concept has_foo = std::same_as;
}
namespace my
{
struct Foo{};
}
namespace bar
{
consteval std::true_type enable_foo(my::Foo);
}
int main()
{
bool const enable_foo_ = std::same_as;
bool const has_foo_ = bar::has_foo;
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79867651/when-and-where-are-c-concepts-instantiated[/url]