xtensor-r icon indicating copy to clipboard operation
xtensor-r copied to clipboard

problem with rlogical type for rtensor

Open ThibHlln opened this issue 1 year ago • 0 comments

Hi,

I have been experiencing compilation errors when trying to work with rtensor containing rlogical (i.e. boolean) data.

For example, if I turn your test https://github.com/xtensor-stack/xtensor-r/blob/0a84316e99eb47a1ea87dee572d0b22fa19ca80d/test/rcpp_tests.cpp#L56-L61

into

int cpp_lgl(xt::rtensor<rlogical, 2>& x)
{
  xassert(x(0, 0) == 1);
  x(1, 1) = 0;
  return 1;
}

Compilation fails when reaching https://github.com/xtensor-stack/xtensor/blob/d1499d900733cd089bd868ca1ca5fdce01e89b97/include/xtensor/xbuffer_adaptor.hpp#L630-L635 with the following error message:

cannot convert 'rlogical*' to 'xt::detail::xbuffer_storage<int*, std::allocator >::pointer' {aka 'int*'} in initialization

N.B. I am using xtensor==0.24.2 and xtensor-r==0.14.0.

ThibHlln avatar Jul 07 '22 09:07 ThibHlln