GCC compiler gives me the following macros:
__FILE__ so that I can print out the file name + directory.__LINE__ so that I c
Using c++14 with constexpr you can use this: WHERE macro.
Based on usage of:
#include "string/ConstexprString.hpp"
#define S1(x) #x
#define S2(x) S1(x)
// WHERE - const char* const should be used as temporary value
#define WHERE (string::make(__PRETTY_FUNCTION__) + ":" + string::make(S2(__LINE__))).get()
// It is safe to store e.g. `constexpr auto where = WHERE_STR;`
#define WHERE_STR (string::make(__PRETTY_FUNCTION__) + ":" + string::make(S2(__LINE__)))
// Called: void (anonymous namespace)::exampleUseCaseWhere(int):18
std::cout << "Called: " << WHERE << std::endl;
Full & running example here