[wpiutil] type_traits: Add is_constexpr() (#5997)

This commit is contained in:
Peter Johnson
2023-12-02 20:54:22 -08:00
committed by GitHub
parent 5172ab8fd0
commit 76ae090570
36 changed files with 65 additions and 34 deletions

View File

@@ -76,6 +76,11 @@ union trivial_helper {
} // end namespace detail
// https://stackoverflow.com/questions/55288555/c-check-if-statement-can-be-evaluated-constexpr
template<class Lambda, int=(Lambda{}(), 0)>
constexpr bool is_constexpr(Lambda) { return true; }
constexpr bool is_constexpr(...) { return false; }
} // end namespace wpi
#endif // WPIUTIL_WPI_TYPE_TRAITS_H