ldionne added a comment.

It would be nice if all the TMP required to determine whether to call 
`__move_construct_forward(..., true_type)` or `__move_construct_forward(..., 
false_type)` was done in `__move_construct_forward` itself (or a helper). This 
way, callers wouldn't have to do it themselves. For example, vector currently 
needs

  typedef integral_constant<bool,
          __vector_should_construct_via_memcpy<_Tp, _Allocator>::value &&
          (is_same<_ForwardIterator, _Tp*>::value ||
           is_same<_ForwardIterator, const _Tp*>::value ||
           is_same<_ForwardIterator, pointer>::value)
      > __copy_via_memcpy;
  ...
  _VSTD::__copy_construct_forward(__a, __first, __last, this->__end_, 
__copy_via_memcpy());

It would be neat if we could just do

  VSTD::__copy_construct_forward(__a, __first, __last, this->__end_);

and have it dispatched correctly from there. That would make those functions 
potentially useful elsewhere. Does that make sense? Otherwise this LGTM.



================
Comment at: include/vector:296
+_LIBCPP_INLINE_VISIBILITY
+inline void
+__copy_construct_forward(_Alloc& __a, _Iter __begin1, _Iter __end1,
----------------
Do you really need `inline` here?


Repository:
  rCXX libc++

https://reviews.llvm.org/D49317



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to