Created
March 8, 2016 04:33
-
-
Save EricWF/f12015b4915f675e3679 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <type_traits> | |
| template <class ...Args, class = typename std::enable_if<sizeof...(Args) == 0>::type> | |
| int maxSize() { return 0; } | |
| template <class First, class ...Args> | |
| int maxSize() { | |
| return sizeof(First) > maxSize<Args...>() ? sizeof(First) : maxSize<Args...>(); | |
| } | |
| int main() { | |
| maxSize<>(); | |
| maxSize<int, int>(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment