On Fri, 08 Oct 2010 03:31:54 +0400, Jonathan M Davis <[email protected]>
wrote:
Isn't the main
problem with having default constructors for structs that the default
constructor must result in the same value every time so that the
compiler can
set init appropriately?
Problem is that requirement is too restrictive. If ctor is pure, doesn't
access globals and results in perfectly same objects, then why can't you
do the initialization at compile-time? You usually can, that's not the
issue.
The issue is that sometimes you need to call external functionals that are
not pure in general (e.g. allocate some resources, initialize fields with
unique values, register itself somewhere etc).