1
2
3
4
5
6
7
8
9
10
#include <iostream>
#include <vector>
int main()
{
const std::vector<int> myVec { 0, 1, 2, 3, 4, 5 } ;
const std::vector<int> partialCopy( myVec.begin(), myVec.begin() ) ;
std::cout << "partialCopy.empty()? " << std::boolalpha << partialCopy.empty() << '\n' ; // true
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
g++ -std=c++20 -O3 -Wall -Wextra -pedantic-errors -pthread main.cpp && ./a.out
echo ================================
clang++ -std=c++2a -stdlib=libc++ -O3 -Wall -Wextra -pedantic-errors main.cpp && ./a.out
partialCopy.empty()? true
================================
partialCopy.empty()? true