Skip to content

Instantly share code, notes, and snippets.

@EricWF
Created March 8, 2016 04:28
Show Gist options
  • Select an option

  • Save EricWF/ad68935634b24e0e79a3 to your computer and use it in GitHub Desktop.

Select an option

Save EricWF/ad68935634b24e0e79a3 to your computer and use it in GitHub Desktop.
template <class First, class Second, class ...Args>
int maxSize();
template <class First>
int maxSize();
template <class First, class Second, class ...Args>
int maxSize()
{
return maxSize<Second, Args...>() > sizeof(First) ? maxSize<Second, Args...>() : sizeof(First);
}
template <class First>
int maxSize() {
return sizeof(First);
}
int main() {
maxSize<int, int>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment