Я сократил код до самого необходимого. Но я не понимаю значения параметра шаблона, предоставленного функции mangledName().
Код: Выделить всё
#include
struct MYS
{
int data = 345;
};
namespace TA
{
extern MYS externalX;
struct ptr_tX final
{
const int& ptr;
};
constexpr auto get_ptrX(MYS& t) noexcept
{
auto& p0 = t.data;
return ptr_tX{p0};
}
template
std::string_view mangledName()
{
return "Stuff";
}
}
int main()
{
// Here we are calling `mangledName()`
// But the call `get_ptrX()` is done to get the template parameter
// So I "think" this is done at compile time.
// But I don't understand what is being given as the parameter.
// Is it the type of the result?
// Is it the type of the function?
// Neither seem to be true and I don't understand what is going on.
// I can't seem to manually validate it. The `` is totally confusing me.
std::string_view key = TA::mangledName();
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... ction-call