Skip to content

Commit

Permalink
Example code common include: Added a mechanism for printing type name…
Browse files Browse the repository at this point in the history
…s as a compile-time warnings
  • Loading branch information
eyalroz authored and Eyal Rozenberg committed Feb 15, 2024
1 parent 1c635b4 commit 62d9054
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ void report_context_stack(const std::string& prefix);
#include <iomanip>
#include <numeric>

template <typename T>
[[gnu::warning("type printed for your convenience")]]
bool your_type_was_() { return true; }

#define print_type_of(_x) your_type_was_<decltype(_x)>()

const char* cache_preference_name(cuda::multiprocessor_cache_preference_t pref)
{
static const char* cache_preference_names[] = {
Expand Down

0 comments on commit 62d9054

Please sign in to comment.