Andrea Bocci
Andrea Bocci
Note that this can happen any time a buffer is copied: ```c++ const auto buffer = alpaka::allocBuf(host, alpaka::Vec(64u)); // does not compile: // buffer[42] = 0; // modifies the contents...
> the automatic cast `auto copy = buffer;` arguably should not compile. This is not a cast, it's a copy: `copy` and `buffer` are two different objects, that _point_ to...
> So basically your very first example function template `modify_const_buffer(TBuf buffer)` also says it can modify buffer elements for `TBuf` being an alpaka buffer, similar to a `foo(int *buf)` saying...
> From my pov alpaka buffers give const-correctness as much as their pointer semantic allows. In my view, which as we figured on the VC is different from yours, a...
Sorry, but no. This > I tend to think of it more as a `const int * const` with a downside of "downmoting" to just `int * const` in situations...
> Also if we are being technical `auto copy = buffer;` explicitly tells to throw away `const` No, it does not, and that's the whole point ! It means to...
Note that I do not have a better solution to suggest :-/ One could make the copy and assignment operators only accept non-`const` buffers as argument - but that's likely...
> I guess a classical solution is to have a `ConstBuffer` type with matching interface, so that `const` is part of the type and this is truly a "shallow copy...
Just thinking aloud: if we have a `std::shared_ptr`, we can automatically convert it to a `std::shared_ptr`: ```c++ #include #include using Buffer = std::shared_ptr; using ConstBuffer = std::shared_ptr; Buffer make_buffer() {...
Hi @psychocoderHPC , > If I remember correctly @fwyzard ask why in his application so many streams were created, it could be that calling `getDevByIdx` is the reason. thanks for...