The following code attempts to check for NAN values in a 2-D string xtensor. The reason it's checking for NANs is that the xtensor is created from an sql query which can return NAN values.
xt::xtensor<std::string, 2> a =
{ {std::string("A1"), std::string("A2"), std::string("A3"), std::string("A4"), std::string("A5")},
{std::string("B1"), std::string("B2"), std::string("B3"), std::string("B4"), std::string("B5")}};
auto nan_list = xt::isnan(a); // <- this line causes the compile error
The code gets the following compile error:
Severity Code Description Project File Line Suppression State
Error C2665 'fpclassify': none of the 3 overloads could convert all the argument types Experiment C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h 413
Message lnt-arithmetic-overflow A sub-expression may overflow before being assigned to a wider type. Experiment C:\Users\echrsro\source\repos\Experiment\Experiment\cAntenna_file.cpp 430
Message could be 'int fpclassify(long double) noexcept' Experiment C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h 298
Message or 'int fpclassify(double) noexcept' Experiment C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h 293
Message or 'int fpclassify(float) noexcept' Experiment C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h 288
Warning C6031 Return value ignored: 'getchar'. Experiment C:\Users\echrsro\source\repos\Experiment\Experiment\Experiment.cpp 220
Warning C6031 Return value ignored: 'getchar'. Experiment C:\Users\echrsro\source\repos\Experiment\Experiment\Experiment.cpp 232
Message see reference to class template instantiation 'xt::xconst_accessible<xt::xfunction<F,const xt::xtensor_container<xt::uvector<std::string,std::allocator<std::string>>,2,xt::layout_type::row_major,xt::xtensor_expression_tag> &>>' being compiled Experiment C:\Users\echrsro\source\vcpkg\installed\x64-windows\include\xtensor\xfunction.hpp 179
Message see reference to class template instantiation 'xt::xcontainer_inner_types<D>' being compiled Experiment C:\Users\echrsro\source\vcpkg\installed\x64-windows\include\xtensor\xaccessible.hpp 35
Message see reference to class template instantiation 'xt::xfunction<F,const xt::xtensor_container<xt::uvector<std::string,std::allocator<std::string>>,2,xt::layout_type::row_major,xt::xtensor_expression_tag> &>' being compiled Experiment C:\Users\echrsro\source\repos\Experiment\Experiment\Experiment.cpp 1718
Message see reference to function template instantiation 'bool isnan<T>(_Ty) noexcept' being compiled Experiment C:\Users\echrsro\source\vcpkg\installed\x64-windows\include\xtensor\xmath.hpp 345
Message see reference to function template instantiation 'bool xt::math::isnan_fun::operator ()<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>(const T &) const' being compiled Experiment C:\Users\echrsro\source\vcpkg\installed\x64-windows\include\xtensor\xfunction.hpp 145
Warning C6054 String 'str' might not be zero-terminated. Experiment C:\Users\echrsro\source\repos\Experiment\Experiment\cAntenna_file.cpp 353
Message while trying to match the argument list '(_Ty)' Experiment C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt_math.h 412