Created
November 2, 2020 23:42
-
-
Save jharmer95/974ebbf0c78deaff08aac51670b7aab7 to your computer and use it in GitHub Desktop.
Iterating through parameter pack TYPES with a lambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <type_traits> | |
template<typename T> | |
void printStuff1() | |
{ | |
if constexpr(std::is_pointer_v<T>) | |
{ | |
std::cout << "POINTER\n"; | |
} | |
else | |
{ | |
std::cout << "NOT\n"; | |
} | |
} | |
template<typename... Args> | |
void printStuff() | |
{ | |
[](...){}((printStuff1<Args>(), 0)...); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment