I have been surprised to find that this simple exemple does not compile:
#include <memory>
#include <vector>
#include <array>
using vt = std::vector<std::unique_ptr<int>>;
using at = std::array<std::unique_ptr<int>,1>;
int main(){
auto a = at{std::make_unique<int>(10)}; //compile fine
auto v = vt{std::make_unique<int>(10)}; //error
}
Why is there no vector constructor taking as argument type initializer_list<T>&&
?
Aucun commentaire:
Enregistrer un commentaire