This is about the source code of the statistical machine translation system Moses.
In the Factor class of the Mosesdecoder project, there is this strange use of the keyword mutable:
class Factor {
__SOME_OTHER_CODE__
// FactorCollection writes here.
// This is mutable so the pointer can be changed to pool-backed memory.
mutable StringPiece m_string
size_t m_id;
__SOME_OTHER_CODE__
}
The complete file of Factor.h is here. I know that mutable is used when you want to modify a member variant in a const member function, or when you want to modify some out-of-scope variable in a lambda expression. I do not, however, understand what the mutable is doing in this code.
I appreciate any hint. Thank you.