revise shared_vector casting

Rename existing castTo() as castToUnsafe().
Add new castTo() which is doesn't allow non-void -> non-void
and may throw on void -> non-void
This commit is contained in:
Michael Davidsaver
2020-03-25 17:00:47 -07:00
parent 5ee4f546c1
commit d811485b90
3 changed files with 102 additions and 5 deletions
+5
View File
@@ -203,6 +203,11 @@ std::ostream& operator<<(std::ostream& strm, const Limiter& lim)
return strm;
}
void _throw_bad_cast(ArrayType from, ArrayType to)
{
throw std::logic_error(SB()<<"Unable to cast array from "<<from<<" to "<<to);
}
Escaper::Escaper(const char* v)
:val(v)
,count(v ? strlen(v) : 0)