Код: Выделить всё
#include
int main()
{
int i = 1;
double x = 2.5;
x = i; // I don't want this to compile without warning.
// I only want x=(double)i, or x=std::static_cast(i) to compile without warning.
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/64509448/how-do-i-forbid-an-implicit-conversion-from-int-to-double-in-c-and-c[/url]
Мобильная версия