std::make_unsigned损坏/链接错误
std::make_unsigned mangling/linking error
我正试图做一些类似的事情
template<class T>
void foo(typename std::make_unsigned<T>::type x)
{
//do a lot with x (do not want to repeat for signed vs unsigned)
}
template<class T>
void foo(T x)
{
if(x < 0)
{x=-x;}
foo<typename std::make_unsigned<T>::type>
(static_cast<typename std::make_unsigned<T>::type >(x));
}
当我尝试使用强制显式实例化(extern templates)时,我从nm得到以下解映射输出:
void foo<unsigned long long>(std::make_unsigned<unsigned long long>::type)
现在,为什么std::make_unsigned::type不发出与我写的无符号T显式相同的类型?相反,我得到了未定义的引用。
我认为不允许显式初始化/加密成员。但我找不到确切的c++参考。
相关文章:
- 静态数据成员的问题-修复链接错误会导致编译器错误
- Visual Studio mkl_link_tool.exe链接错误
- C++ 实现模板单例类时出现链接错误
- 使用类模板的方法链接错误
- MySQL C++连接器链接错误
- VS 2015 链接错误 无法构建依赖于 libcurl 的项目
- 运行 C++ 单元测试时LNK2005链接错误
- 对 CMake 中'cudaRegisterLinkedBinary'链接错误的未定义引用?
- 链接错误,包括我创建的相同头文件 - C++
- 在Embarcadero C++ Builder中生成的DLL未解决的外部链接错误
- 使用标头保护的多个定义链接错误
- 链接错误:未定义对 stdscr 和 wgetch 的引用
- 使用 Vivek 的 Vcam / 捕获源过滤器构建/链接错误
- 升压program_options中的链接错误
- 使用 g++ 预处理器进行替换会导致链接错误
- 在调试配置中编译工作正常,但发布会给出链接错误
- 相邻矩阵设置链接错误
- 包含常量变量并包含在多个文件中的标头的链接错误
- C++链接错误,我理解但无法解决
- 是什么导致macOS Mojave上的GoogleTest链接错误