Commit 8dd67869 authored by Sebastian Wolf's avatar Sebastian Wolf

Allow C++14 compilation.

parent d925ba39
Pipeline #1864 failed with stages
in 12 minutes and 39 seconds
......@@ -43,13 +43,34 @@ namespace xerus {
};
/// @brief The pipe operator allows to add everything that can be converted to string to the error_info and derived exceptions.
template<typename error_t, class T, typename std::enable_if<std::is_base_of<generic_error, std::remove_cvref_t<error_t>>::value, int>::type = 0>
std::remove_cvref_t<error_t>& operator<<(error_t&& o, const T& _info) noexcept {
template<typename error_t, class T>
typename std::enable_if<std::is_base_of<generic_error, error_t>::value, error_t&>::type
operator<<(error_t& o, const T& _info) noexcept {
std::ostringstream errorStream(o.errorInfo, std::ios_base::ate | std::ios_base::out);
errorStream << _info;
o.errorInfo = errorStream.str();
return o;
}
/// @brief The pipe operator allows to add everything that can be converted to string to the error_info and derived exceptions.
template<typename error_t, class T>
typename std::enable_if<std::is_base_of<generic_error, error_t>::value, error_t&>::type
operator<<(error_t&& o, const T& _info) noexcept {
std::ostringstream errorStream(o.errorInfo, std::ios_base::ate | std::ios_base::out);
errorStream << _info;
o.errorInfo = errorStream.str();
return o;
}
// Once we have C++20... :-/
// /// @brief The pipe operator allows to add everything that can be converted to string to the error_info and derived exceptions.
// template<typename error_t, class T, typename std::enable_if<std::is_base_of<generic_error, std::remove_cvref_t<error_t>>::value, int>::type = 0>
// std::remove_cvref_t<error_t>& operator<<(error_t&& o, const T& _info) noexcept {
// std::ostringstream errorStream(o.errorInfo, std::ios_base::ate | std::ios_base::out);
// errorStream << _info;
// o.errorInfo = errorStream.str();
// return o;
// }
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment