Skip to content

Commit

Permalink
add: sizeof_max
Browse files Browse the repository at this point in the history
  • Loading branch information
chocolacula committed Oct 15, 2023
1 parent e9aa1b3 commit bda0401
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions library/include/er/tools/sizeof_max.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include <cstddef>

template <typename T>
constexpr size_t sizeof_max(const T& /*unused*/) {
return sizeof(T);
}

template <typename T, typename... Args>
constexpr size_t sizeof_max(const T& /**/, Args... args) {
return sizeof(T) > sizeof_max(args...) ? sizeof(T) : sizeof_max(args...);
}

0 comments on commit bda0401

Please sign in to comment.