gtensor icon indicating copy to clipboard operation
gtensor copied to clipboard

const stream objects

Open bd4 opened this issue 2 years ago • 2 comments

If a stream or stream_view object is const, it becomes useless, as no methods will be allowed. This came up in GENE where there is a helper class which has const methods that use a stream member variable, and because the methods are const, this becomes const and the stream member becomes const, and it breaks. It's not obvious what the correct change is here - should stream methods be allowed on const, or should GENE be changed to make those methods non-const.

bd4 avatar Apr 25 '23 13:04 bd4

@germasch what do you think?

bd4 avatar Apr 25 '23 13:04 bd4

I think it could be argued that all usage of queue implies non-const behavior, because to use it at all you are enqueuing or synchronizes jobs in the queue. The get methods don't strictly need to be const, but if they are called it implies another part of the code will be using the queue in some way, which is non-const-ish. Plus if they are made const, the return object may become const and we are back to the enqueuing or syncing case not working.

bd4 avatar Apr 25 '23 13:04 bd4