print any vec
This commit is contained in:
parent
94d4cc90ac
commit
c4dc3407e0
1 changed files with 9 additions and 3 deletions
|
@ -4,10 +4,16 @@
|
|||
#include <vector>
|
||||
|
||||
template <typename T>
|
||||
void print_vec(const std::vector<const T> vec) {
|
||||
void print_vec(const std::vector<T> vec) {
|
||||
std::cout << "[ (" << vec.size() << ")\n";
|
||||
for (const T it : vec) {
|
||||
std::cout << " " << it << "\n";
|
||||
for (const T &it : vec) {
|
||||
std::cout << " ";
|
||||
if (std::is_pointer<T>::value) {
|
||||
std::cout << *it;
|
||||
} else {
|
||||
std::cout << it;
|
||||
}
|
||||
std::cout << "\n";
|
||||
}
|
||||
std::cout << "]\n";
|
||||
}
|
||||
|
|
Reference in a new issue