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

to compile example streaming.cpp error under vs2022 #33

Closed zack-luan closed 1 year ago

zack-luan commented 1 year ago

The following code encountered an error while compiling streaming.cpp under VS2022:

template struct std::iterator_traits<msd::blocking_iterator> { using value_type = typename msd::blocking_iterator::value_type; using iterator_category = std::output_iterator_tag; };

The error message is as follows: C2794 “reference”: not “std::iterator_traits<_Iter>” ....

following improvements be made?

template struct std::iterator_traits<Yuanling::ThreadSafeChannelIterator> { using value_type = typename Yuanling::ThreadSafeChannelIterator::ValueType; using iterator_category = std::output_iterator_tag; using reference = std::reference_wrapper; };

andreiavrammsd commented 1 year ago

I'll get to this. Thank you!