[libcxx] r269789 - Implement LWG2576: istream_iterator and ostream_iterator should use std::addressof

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Tue May 17 13:00:53 PDT 2016


I added a test for operator->() in r269812. Marshall and I discussed
offline about how not all parts of this change are testable (and hence not
meaningful) but that's what the standard says to do.


On Tue, May 17, 2016 at 1:51 PM, David Blaikie via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Test coverage?
>
> On Tue, May 17, 2016 at 10:44 AM, Marshall Clow via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Author: marshall
>> Date: Tue May 17 12:44:40 2016
>> New Revision: 269789
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=269789&view=rev
>> Log:
>> Implement LWG2576: istream_iterator and ostream_iterator should use
>> std::addressof
>>
>> Modified:
>>     libcxx/trunk/include/iterator
>>     libcxx/trunk/www/cxx1z_status.html
>>
>> Modified: libcxx/trunk/include/iterator
>> URL:
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=269789&r1=269788&r2=269789&view=diff
>>
>> ==============================================================================
>> --- libcxx/trunk/include/iterator (original)
>> +++ libcxx/trunk/include/iterator Tue May 17 12:44:40 2016
>> @@ -772,14 +772,14 @@ private:
>>      _Tp __value_;
>>  public:
>>      _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() :
>> __in_stream_(0), __value_() {}
>> -    _LIBCPP_INLINE_VISIBILITY istream_iterator(istream_type& __s) :
>> __in_stream_(&__s)
>> +    _LIBCPP_INLINE_VISIBILITY istream_iterator(istream_type& __s) :
>> __in_stream_(_VSTD::addressof(__s))
>>          {
>>              if (!(*__in_stream_ >> __value_))
>>                  __in_stream_ = 0;
>>          }
>>
>>      _LIBCPP_INLINE_VISIBILITY const _Tp& operator*() const {return
>> __value_;}
>> -    _LIBCPP_INLINE_VISIBILITY const _Tp* operator->() const {return
>> &(operator*());}
>> +    _LIBCPP_INLINE_VISIBILITY const _Tp* operator->() const {return
>> _VSTD::addressof((operator*()));}
>>      _LIBCPP_INLINE_VISIBILITY istream_iterator& operator++()
>>          {
>>              if (!(*__in_stream_ >> __value_))
>> @@ -811,9 +811,9 @@ private:
>>      const char_type* __delim_;
>>  public:
>>      _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s)
>> -        : __out_stream_(&__s), __delim_(0) {}
>> +        : __out_stream_(_VSTD::addressof(__s)), __delim_(0) {}
>>      _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const
>> _CharT* __delimiter)
>> -        : __out_stream_(&__s), __delim_(__delimiter) {}
>> +        : __out_stream_(_VSTD::addressof(__s)), __delim_(__delimiter) {}
>>      _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp&
>> __value_)
>>          {
>>              *__out_stream_ << __value_;
>>
>> Modified: libcxx/trunk/www/cxx1z_status.html
>> URL:
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=269789&r1=269788&r2=269789&view=diff
>>
>> ==============================================================================
>> --- libcxx/trunk/www/cxx1z_status.html (original)
>> +++ libcxx/trunk/www/cxx1z_status.html Tue May 17 12:44:40 2016
>> @@ -222,7 +222,7 @@
>>         <tr><td><a href="
>> http://cplusplus.github.io/LWG/lwg-defects.html#2572">2572</a></td><td>The
>> remarks for <tt>shared_ptr::operator*</tt> should apply to
>> <i>cv</i>-qualified <tt>void</tt> as
>> well</td><td>Jacksonville</td><td>Complete</td></tr>
>>         <tr><td><a href="
>> http://cplusplus.github.io/LWG/lwg-defects.html#2574">2574</a></td><td>[fund.ts.v2]
>> <tt>std::experimental::function::operator=(F&&)</tt> should be
>> constrained</td><td>Jacksonville</td><td></td></tr>
>>         <tr><td><a href="
>> http://cplusplus.github.io/LWG/lwg-defects.html#2575">2575</a></td><td>[fund.ts.v2]
>> <tt>experimental::function::assign</tt> should be
>> removed</td><td>Jacksonville</td><td></td></tr>
>> -       <tr><td><a href="
>> http://cplusplus.github.io/LWG/lwg-defects.html#2576">2576</a></td><td><tt>istream_iterator</tt>
>> and <tt>ostream_iterator</tt> should use
>> <tt>std::addressof</tt></td><td>Jacksonville</td><td></td></tr>
>> +       <tr><td><a href="
>> http://cplusplus.github.io/LWG/lwg-defects.html#2576">2576</a></td><td><tt>istream_iterator</tt>
>> and <tt>ostream_iterator</tt> should use
>> <tt>std::addressof</tt></td><td>Jacksonville</td><td>Complete</td></tr>
>>         <tr><td><a href="
>> http://cplusplus.github.io/LWG/lwg-defects.html#2577">2577</a></td><td><tt>{shared,unique}_lock</tt>
>> should use
>> <tt>std::addressof</tt></td><td>Jacksonville</td><td>Complete</td></tr>
>>         <tr><td><a href="
>> http://cplusplus.github.io/LWG/lwg-defects.html#2579">2579</a></td><td>Inconsistency
>> wrt Allocators in <tt>basic_string</tt> assignment vs.
>> <tt>basic_string::assign</tt></td><td>Jacksonville</td><td>Complete</td></tr>
>>         <tr><td><a href="
>> http://cplusplus.github.io/LWG/lwg-defects.html#2581">2581</a></td><td>Specialization
>> of <tt><type_traits></tt> variable templates should be
>> prohibited</td><td>Jacksonville</td><td>Complete</td></tr>
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160517/722e9621/attachment.html>


More information about the cfe-commits mailing list