Title
const equivalence of std::map
Status
nad
Section
[associative] [unord]
Submitter
Bjarne Stroustrup

Created on 2012-06-18.00:00:00 last changed 101 months ago

Messages

Date: 2016-08-02.17:03:45

[ 2016-08 Chicago ]

Recommend NAD. No other container supports conversion from different container specializations, so adding support directly might be more surprising than the omission.

We would welcome papers on the convertibility of containers of different element types directed to the LEWG in the future.

Date: 2013-04-13.21:08:28

As described in the reflector discussion c++std-core-21860 consider the following example:

map<const int, int> mci{};
map<int, int> mi = mci; // ??
mci[1] = 2;
mi[1] = 2;

Should it be required that the marked initialization is well-formed? As a possible solution this could be realized by an alias template:

template <class K, class T>
struct OriginalMap { […] };

template <class K, class T>
using ImprovedMap = OriginalMap<const K, T>;
History
Date User Action Args
2016-08-02 17:03:45adminsetstatus: new -> nad
2016-08-02 14:27:01adminsetmessages: + msg8308
2012-06-18 00:00:00admincreate