-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: check blas_int; include in run_tests
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// ----------------------------------------------------------------------------- | ||
// see https://stackoverflow.com/questions/81870/is-it-possible-to-print-a-variables-type-in-standard-c | ||
#include <type_traits> | ||
#include <typeinfo> | ||
#include <memory> | ||
#include <string> | ||
#include <cstdlib> | ||
|
||
// for demangling on non-Microsoft platforms | ||
#ifndef _MSC_VER | ||
#include <cxxabi.h> | ||
#endif | ||
|
||
template <typename T> | ||
std::string get_type_name() | ||
{ | ||
using T_noref = typename std::remove_reference<T>::type; | ||
|
||
std::unique_ptr< char, void(*)(void*) > own( | ||
#ifndef _MSC_VER | ||
abi::__cxa_demangle( typeid( T_noref ).name(), nullptr, nullptr, nullptr ), | ||
#else | ||
nullptr, | ||
#endif | ||
std::free | ||
); | ||
|
||
std::string r = own != nullptr ? own.get() : typeid( T_noref ).name(); | ||
if (std::is_const<T_noref>::value) | ||
r += " const"; | ||
if (std::is_volatile<T_noref>::value) | ||
r += " volatile"; | ||
if (std::is_lvalue_reference<T>::value) | ||
r += "&"; | ||
else if (std::is_rvalue_reference<T>::value) | ||
r += "&&"; | ||
return r; | ||
} |
This file contains 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
This file contains 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