Why does assignment to int and float are not generating error whereas assignment to while does generate error?

Advertisements Source: int = 33 float = 0.0 while = 33 Output: while = 33 ^ SyntaxError: invalid syntax Why does assignment to int and float are not generating error in python whereas assignment to while generates error? >Solution : while is a keyword. Keywords are essential parts of the language that cannot be used… Read More Why does assignment to int and float are not generating error whereas assignment to while does generate error?

What happens when opeator= returns void rather than T&?

Advertisements In operator overloading, the assignment operator is normally defined as follows: T& T::operator =(const T2& b); which returns T& as result. But I want to know what happens when we return void. For example, the assignment operator of std::atmoic<std::shared_ptr<T>> returns void: void operator=( std::shared_ptr<T> desired ) noexcept; as defined here and here. What happens… Read More What happens when opeator= returns void rather than T&?