Does in-class definition break the ODR rule?
Bjarne Stroustrup's explanation states this:
A class is typically declared in a header file and a header file is typically included into many translation units. However, to avoid complicated linker rules, C++ requires that every object has a unique definition. That rule would be broken if C++ allowed in-class definition of entities that needed to be stored in memory as objects.
class foo
{
float f = 1.1f;
int i = 1;
string s = "foo";
long long ll = 44ll;
};
Does that is the actual definition of the members? Does this break ODR rule? and if not, what're the advantages of doing this over initialization through constructors?