[cfe-commits] [libcxx] r113731 - in /libcxx/trunk: include/iterator include/type_traits src/hash.cpp
Matthieu Monrocq
matthieu.monrocq at gmail.com
Tue Sep 14 11:40:15 PDT 2010
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`).
Also, there seems to be a discrepancy (for the insert iterators) between the
parameter of the template `Container` and the value you used as a
replacement `_Container` (note the leading underscore) on the lines 154, 175
and 197. It is fine on the other lines because the template parameter is
indeed `_Container` later on.
Matthieu
> Author: hhinnant
> Date: Sun Sep 12 20:43:27 2010
> New Revision: 113731
>
> URL: http://llvm.org/viewvc/llvm-project?rev=113731&view=rev
> Log:
> Experimenting with a new forward fomulation (kudos Daniel Kruegler),
> updated insert iterators to work better with pproxies, and doubled the speed
> of __next_prime.
>
> Modified:
> libcxx/trunk/include/iterator
> libcxx/trunk/include/type_traits
> libcxx/trunk/src/hash.cpp
>
> Modified: libcxx/trunk/include/iterator
> URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=113731&r1=113730&r2=113731&view=diff
>
> ==============================================================================
> --- libcxx/trunk/include/iterator (original)
> +++ libcxx/trunk/include/iterator Sun Sep 12 20:43:27 2010
> @@ -151,7 +151,7 @@
> typedef void pointer;
>
> explicit back_insert_iterator(Container& x);
> - back_insert_iterator& operator=(typename Container::const_reference
> value);
> + back_insert_iterator& operator=(const typename _Container::value_type&
> value);
> back_insert_iterator& operator*();
> back_insert_iterator& operator++();
> back_insert_iterator operator++(int);
> @@ -172,7 +172,7 @@
> typedef void pointer;
>
> explicit front_insert_iterator(Container& x);
> - front_insert_iterator& operator=(typename Container::const_reference
> value);
> + front_insert_iterator& operator=(const typename
> _Container::value_type& value);
> front_insert_iterator& operator*();
> front_insert_iterator& operator++();
> front_insert_iterator operator++(int);
> @@ -194,7 +194,7 @@
> typedef void pointer;
>
> insert_iterator(Container& x, typename Container::iterator i);
> - insert_iterator& operator=(typename Container::const_reference value);
> + insert_iterator& operator=(const typename _Container::value_type&
> value);
> insert_iterator& operator*();
> insert_iterator& operator++();
> insert_iterator& operator++(int);
> @@ -624,7 +624,7 @@
> typedef _Container container_type;
>
> _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container&
> __x) : container(&__x) {}
> - _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename
> _Container::const_reference __value)
> + _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const
> typename _Container::value_type& __value)
> {container->push_back(__value); return *this;}
> #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
> _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename
> _Container::value_type&& __value)
> @@ -657,7 +657,7 @@
> typedef _Container container_type;
>
> _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container&
> __x) : container(&__x) {}
> - _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename
> _Container::const_reference __value)
> + _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const
> typename _Container::value_type& __value)
> {container->push_front(__value); return *this;}
> #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
> _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename
> _Container::value_type&& __value)
> @@ -692,7 +692,7 @@
>
> _LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename
> _Container::iterator __i)
> : container(&__x), iter(__i) {}
> - _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename
> _Container::const_reference __value)
> + _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename
> _Container::value_type& __value)
> {iter = container->insert(iter, __value); ++iter; return *this;}
> #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
> _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename
> _Container::value_type&& __value)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100914/2bbdd170/attachment.html>
More information about the cfe-commits
mailing list