[cfe-commits] [libcxx] r113731 - in /libcxx/trunk: include/iterator include/type_traits src/hash.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Tue Sep 14 15:52:32 PDT 2010


On Sep 14, 2010, at 1:26 PM, Howard Hinnant wrote:

> Hi Matthieu,
> 
> Thanks for the review!
> 
> On Sep 14, 2010, at 11:40 AM, Matthieu Monrocq wrote:
> 
>> Hi Howard,
>> 
>> I find strange to use `const typename Container::value_type&` instead of `typename Container::const_reference` for the insert iterators: it prevents the user from using a proxy instead of a plain reference (as it would prevent her to use a smart pointer instead of a plain pointer were you to use `const typename Container::value_type*` instead of `typename Container::const_pointer`).
> 
> My first preference is also Container::const_reference.

I actually disagree, but I think my position goes against what most of the standard library does. Container::const_reference should be a const reference to something stored in the container. The argument to the iterator's assignment operator (as well as many other things, like Container::push_back) does not refer to an element in the container, though, and thus shouldn't be Container::const_reference.

Sebastian



More information about the cfe-commits mailing list