I mean it compiled

This commit is contained in:
NaifBanana 2026-04-10 00:41:01 -05:00
parent 0ab3f7e808
commit 18de24649a

View File

@ -38,14 +38,9 @@ template<typename StringType, typename ErrorType>
struct NBErrorWhatString; struct NBErrorWhatString;
class ErrorBase_what_str_impl : public std::exception { class ErrorBase_what_str_impl : public std::exception {
template <typename T> public:
T what_str() const; virtual std::string what_str_impl() const = 0;
virtual std::wstring what_wstr_impl() const = 0;
template <>
virtual std::wstring what_str() const;
template<>
virtual std::string what_str() const;
}; };
template<class ErrorType> template<class ErrorType>
@ -165,8 +160,8 @@ protected:
filename_ filename_
) {} ) {}
std::string (ErrorBase::*_trace_what_str)(); std::string what_str_impl() const override final { return what_str(); }
std::wstring (ErrorBase::*_trace_what_wstr)(); std::wstring what_wstr_impl() const override final { return what_str<std::wstring>(); }
}; };
template <typename ErrorType> template <typename ErrorType>
const std::string ErrorBase<ErrorType>::type = ErrorType::type; const std::string ErrorBase<ErrorType>::type = ErrorType::type;
@ -181,7 +176,8 @@ struct NBErrorWhatString<std::wstring, ErrorType> {
if (err.trace) { if (err.trace) {
std::wstring trace_msg; std::wstring trace_msg;
if (err.traceIsNBError) { if (err.traceIsNBError) {
trace_msg = std::static_pointer_cast<ErrorBase_what_str_impl>(err.trace)->template what_str<std::wstring>(); // How can I access
trace_msg = std::static_pointer_cast<const ErrorBase_what_str_impl>(err.trace)->what_wstr_impl();
} else { } else {
trace_msg = nb::str_to_wstr(std::string(err.trace->what())); trace_msg = nb::str_to_wstr(std::string(err.trace->what()));
} }