Skip to content

ES.50: Don’t cast away const and mutable #697

@KindDragon

Description

@KindDragon

ES.50: Don’t cast away const
Reason

It makes a lie out of const. Note

Usually the reason to “cast away const” is to allow the updating of some transient information of an otherwise immutable object. Examples are caching, memoization, and precomputation. Such examples are often handled as well or better using mutable or an indirection than with a const_cast.

Shouldn't only thread safe class members marked as mutable?

You Don’t Know const and mutable @hsutter

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions