I am writing the code and error message below.
template<template <typename...> class container_type>
void test_int(string container_name){
container_type<int,std::vector> container1;
container_type<int,std::set> container2;
container_type<int,std::list> container3;
...
main.cpp
test_int<ArrayList>("arraylist"); ---> error
ArrayList<int,std::Vector> test; ---> no error
....
compiler says that:
test.cpp:17:32: error: type/value mismatch at argument 1 in template
parameter list for ‘template<class ...> class container_type’
container_type<int,std::vector> container1;
^
test.cpp:17:32: note: expected a type, got ‘vector’
test.cpp:18:29: error: type/value mismatch at argument 1 in template
parameter list for ‘template<class ...> class container_type’
container_type<int,std::set> container2;
^
test.cpp:18:29: note: expected a type, got ‘set’
test.cpp:19:30: error: type/value mismatch at argument 1 in template
parameter list for ‘template<class ...> class container_type’
container_type<int,std::list> container3;
How Can I solve this ?
Aucun commentaire:
Enregistrer un commentaire