#include <boost/type_index.hpp>
#include <iostream>
#include <vector>
int main()
{
std::vector<int> initv { 42, 31, 7 };
std::vector v1{initv.begin(), initv.end()}; // CTAD
std::vector<int> v2{initv.begin(), initv.end()};
std::cout << boost::typeindex::type_id_with_cvr<decltype(v1)>().pretty_name() << std::endl;
std::cout << boost::typeindex::type_id_with_cvr<decltype(v2)>().pretty_name() << std::endl;
}
output:
std::vector<__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >, std::allocator<__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > > > >
std::vector<int, std::allocator<int> >
CTAD produces a vector with iterators, not integers.
Is this correct, given that std::vector
has a constructor that takes iterators ?