[PATCH] D15862: A possible direction for fixing https://llvm.org/bugs/show_bug.cgi?id=25973.
Duncan P. N. Exon Smith via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 4 12:35:53 PST 2016
> On 2016-Jan-04, at 12:02, Marshall Clow via cfe-commits <cfe-commits at lists.llvm.org> wrote:
>
> mclow.lists updated this revision to Diff 43906.
> mclow.lists added a comment.
>
> Howard suggested a fix for the "is incremental" problem in the type trait. I also added assignable.
>
>
> http://reviews.llvm.org/D15862
>
> Files:
> include/algorithm
> include/iterator
> include/string
>
Direction seems reasonable to me FWIW. One comment on the latest patch:
> <D15862.43906.patch>_______________________________________________
> Index: include/string
> ===================================================================
> --- include/string
> +++ include/string
> @@ -1201,6 +1201,24 @@
> #pragma warning( pop )
> #endif // _LIBCPP_MSVC
>
> +#ifdef _LIBCPP_HAS_NO_NOEXCEPT
> +struct __libcpp_string_gets_noexcept_iterator_impl : public _LIBCPP_BOOL_CONSTANT(false) {};
> +#else
> +template <class _Iter>
> +struct __libcpp_string_gets_noexcept_iterator_impl : public _LIBCPP_BOOL_CONSTANT((
> + __is_forward_iterator<_Iter>::value &&
> + noexcept(++(declval<_Iter&>())) &&
> + is_nothrow_assignable<_Iter&, _Iter>::value &&
> + noexcept(declval<_Iter>() == declval<_Iter>()) &&
> + noexcept(*declval<_Iter>())
> +)) {};
> +#endif
> +
> +
> +template <class _Iter>
> +struct __libcpp_string_gets_noexcept_iterator
> + : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value || __libcpp_string_gets_noexcept_iterator_impl<_Iter>::value) {};
This seems unnecessarily complicated. Can you do the following now that
you're not calling `.operator++()`?
```
#ifdef _LIBCPP_HAS_NO_NOEXCEPT
struct __libcpp_string_gets_noexcept_iterator_impl
: public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {};
#else
// ...__libcpp_string_gets_noexcept_iterator_impl as in your patch...
#endif
template <class _Iter>
struct __libcpp_string_gets_noexcept_iterator
: public _LIBCPP_BOOL_CONSTANT(__libcpp_string_gets_noexcept_iterator_impl<_Iter>::value) {};
```
This avoids instantiating __libcpp_is_trivial_iterator in the
!_LIBCPP_HAS_NO_NOEXCEPT case.
> +
> #ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
>
>
More information about the cfe-commits
mailing list