I'd like to see something like this added to std::exception
and types derived from it:
virtual ::std::string_view what_view () const noexcept;
In this file:
https://github.com/Ebenezer-group/onwards/blob/master/cmwAmbassador.cc
there's some code like this:
}catch(::std::exception const& ex){
syslog_wrapper(LOG_ERR,"Mediate request: %s",ex.what());
middle_messages_front::Marshal(localsendbuf,false,ex.what());
}
I can't change the first call to "what" unless I find an alternative to
syslog. But I could change the second call to "what" to "what_view"
and avoid the need to recalculate the length of the string.
The proposed function could be implemented like this:
virtual ::std::string_view what_view () const noexcept
{ return std::string_view(whatStr); } // where whatStr is a std::string.
At least that's how I would do it here:
https://github.com/Ebenezer-group/onwards/blob/master/ErrorWords.hh
I'm not planning on going to the upcoming C++ standardization
meeting in Kona, Hawii, but if someone is, feel free to mention
this. Thanks.
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net