提交 d3ddf050 编写于 作者: Y Yi Wang

Correct specialization of throw_on_error for pointer types

上级 ae3a9c48
......@@ -127,9 +127,15 @@ inline typename std::enable_if<sizeof...(Args) != 0, void>::type throw_on_error(
#endif // PADDLE_ONLY_CPU
template <typename T>
inline void throw_on_error(T* e) {
throw_on_error(e != nullptr, "");
template <typename T, typename... Args>
inline typename std::enable_if<std::is_pointer<T>::value, void>::type
throw_on_error(T stat, const Args&... args) {
if (stat == nullptr) {
return;
} else {
throw std::runtime_error("Pointer value is nullptr: " +
string::Sprintf(args...));
}
}
template <typename T>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册