Skip to content

Overwork inner and outer const correctnes of the assign operator of data storage #471

@SimeonEhrig

Description

@SimeonEhrig

During the work on PR #469 we realize that we do not cover all cases of assignment of DataStorages to DataStorages with different inner and outer const typs. We also not clarified which should be allowed and what not. This is the current state what is allowed, disallowed and unclear:

assignment: to = from

total 16 cases

4 cases:

to from allowed comment
DataStorage<int> DataStorage<int> Y
DataStorage<int const> DataStorage<int> Y const view of mutable source -> hidden modification possible
DataStorage<int> DataStorage<int const> X Allows to modify inner const source
DataStorage<int const> DataStorage<int const> Y

8 cases:

to from allowed comment
DataStorage<*> const * X general not allowed to reassign a const object (C++ rule)

4 cases:

to from allowed comment
DataStorage<int> DataStorage<int> const X
DataStorage<int const> DataStorage<int> const Y
DataStorage<int> DataStorage<int const> const X
DataStorage<int const> DataStorage<int const> const Y

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactoringThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions