andreiavrammsd / cpp-channel

Thread-safe container for sharing data between threads
https://blog.andreiavram.ro/cpp-channel-thread-safe-container-share-data-threads/
MIT License
400 stars 28 forks source link

Swap `operator<<` and `operator>>` to be similar to C++ streams #27

Closed longnguyen2004 closed 1 year ago

longnguyen2004 commented 1 year ago

Currently, the channel is on the right side of the operator, which is backwards from the C++ streams syntax, and makes chaining impossible (or at least very annoying) because << and >> are left associative. I suggest swapping the 2 operators in order to match C++ streams syntax.

andreiavrammsd commented 1 year ago

Sounds like a good point. Thanks for the idea! I will consider this. Let's leave the issue open until I get the time for this.

andreiavrammsd commented 1 year ago

@longnguyen2004, please take a look at #28 or directly see the new documentation.