پاسخ داده شده: بررسی پارامتر از نوع std::vector
با template specialization به راحتی قابل فهمیدن هستش به صورت زیر:
#include <stdio.h>
#include <type_traits>
#include <vector>
#include <iostream>
using namespace std;
template<typename >
struct is_std_vector: std::false_type{
};
template<typename T_,typename U_>
struct is_std_vector<std::vector<T_,U_>>: std::true_type{
};
int main()
{
std::vector<int> vec;
int not_vec;
cout <<is_std_vector<decltype(vec)>::value << endl;
cout << is_std_vector<decltype(not_vec)>::value << endl;
}
