| 359 | struct try_convert_and_check { |
| 360 | using source_type = typename cni_decayed_convertor<_SourceT, _TargetT>::source_type; |
| 361 | static _TargetT convert(any &val) |
| 362 | { |
| 363 | if (val.is_type_of<source_type>()) { |
| 364 | try { |
| 365 | return cni_decayed_convertor<_SourceT, _TargetT>::convert_to_cpp(val); |
| 366 | } |
| 367 | catch (...) { |
| 368 | throw cs::runtime_error("Type Conversion Failed. At " + std::to_string(index + 1) + ". Expected " + |
| 369 | cxx_demangle(get_name_of_type<_TargetT>()) + ", provided " + |
| 370 | cxx_demangle(get_name_of_type<_SourceT>())); |
| 371 | } |
| 372 | } |
| 373 | else if (val.is_type_of<_TargetT>()) |
| 374 | return convert_helper<_TargetT>::get_val(val); |
| 375 | else |
| 376 | throw cs::runtime_error("Invalid Argument. At " + std::to_string(index + 1) + ". Expected " + |
| 377 | cxx_demangle(get_name_of_type<_TargetT>()) + ", compatible with " + |
| 378 | cxx_demangle(get_name_of_type<source_type>()) + ", provided " + |
| 379 | val.get_type_name()); |
| 380 | } |
| 381 | }; |
| 382 | |
| 383 | template <typename _TargetT, typename _CheckT, std::size_t index> |
nothing calls this directly
no test coverage detected