nameof_module/test_package/test_package.cpp

20 lines
393 B
C++
Raw Normal View History

2019-07-27 16:53:03 +00:00
#include <nameof.hpp>
#include <cstdlib>
struct SomeStruct {};
SomeStruct structvar;
2019-07-30 18:44:48 +00:00
2019-07-27 16:53:03 +00:00
int main() {
constexpr auto name = NAMEOF(structvar);
static_assert("structvar" == name);
std::string_view res1 = NAMEOF(structvar);
std::string_view res2 = NAMEOF(::structvar);
2019-07-30 18:44:48 +00:00
2019-08-24 15:31:42 +00:00
bool success = (res1 == "structvar") && (res2 == "structvar");
2019-07-30 18:44:48 +00:00
2019-07-27 16:53:03 +00:00
return success ? EXIT_SUCCESS : EXIT_FAILURE;
}