On Wednesday, 11 July 2012 at 15:57:51 UTC, Andrei Alexandrescu
wrote:
On 7/11/12 11:50 AM, Max Samukha wrote:
On Wednesday, 11 July 2012 at 15:28:41 UTC, Andrei
Alexandrescu wrote:
On 7/11/12 11:11 AM, Max Samukha wrote:
On Wednesday, 11 July 2012 at 12:39:03 UTC, Andrei
Alexandrescu wrote:
I gave evidence on a large, high quality C++ codebase that
the use of
mutable (which is the solution of choice for memoization,
caching, and
lazy computation) is extremely scarce.
What evidence do you have for your prediction?
Andrei
Qt codebase (large, high quality) has around 1500 'mutable'
keyword
occurrences.
How many lines total?
Andrei
1512. Obtained by grepping the src directory of Qt 4.8.0, so
the number
includes duplicates, comments, etc. I think that even if the
actual
number is lower by an order, some 100 types using mutable
still do not
qualify for 'extremely scarce'. If I have time (which is
unlikely), I
will probably analyse the codebase for the actual number.
I was asking about total number of C++ code lines. In our
codebase we have one use of "mutable" per 7659 lines of C++
code (as grep and wc count).
Andrei
Sorry, I misunderstood the question. As I said earlier, the
relative number of lines with 'mutable' is mostly irrelevant.
What is more relevant is the ratio of types defining at least one
mutable member to the total number of types.