11
11
12
12
#include < __algorithm/copy.h>
13
13
#include < __algorithm/copy_backward.h>
14
+ #include < __algorithm/copy_n.h>
14
15
#include < __algorithm/fill_n.h>
15
16
#include < __algorithm/iterator_operations.h>
16
17
#include < __algorithm/max.h>
@@ -701,7 +702,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(const vector& __v
701
702
__alloc_(__storage_traits::select_on_container_copy_construction(__v.__alloc_)) {
702
703
if (__v.size () > 0 ) {
703
704
__vallocate (__v.size ());
704
- __construct_at_end (__v.begin (), __v.end (), __v.size ());
705
+ std::copy_n (__v.__begin_ , __external_cap_to_internal (__v.size ()), __begin_);
706
+ __size_ = __v.size ();
705
707
}
706
708
}
707
709
@@ -710,7 +712,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(const vector& __v
710
712
: __begin_(nullptr ), __size_(0 ), __cap_(0 ), __alloc_(__a) {
711
713
if (__v.size () > 0 ) {
712
714
__vallocate (__v.size ());
713
- __construct_at_end (__v.begin (), __v.end (), __v.size ());
715
+ std::copy_n (__v.__begin_ , __external_cap_to_internal (__v.size ()), __begin_);
716
+ __size_ = __v.size ();
714
717
}
715
718
}
716
719
@@ -723,7 +726,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>& vector<bool, _Allocator>
723
726
__vdeallocate ();
724
727
__vallocate (__v.__size_ );
725
728
}
726
- std::copy (__v.__begin_ , __v. __begin_ + __external_cap_to_internal (__v.__size_ ), __begin_);
729
+ std::copy_n (__v.__begin_ , __external_cap_to_internal (__v.__size_ ), __begin_);
727
730
}
728
731
__size_ = __v.__size_ ;
729
732
}
0 commit comments