@@ -379,8 +379,40 @@ TEST(ChannelTest, Transform)
379379
380380 // Transform input channel values from MovableOnly to int by multiplying by 2 and write to output channel
381381 const auto double_transformer = [&input_chan, &output_chan]() {
382- std::transform (input_chan.begin (), input_chan.end (), msd::back_inserter (output_chan),
383- [](auto && value) -> int { return value.getValue () * 2 ; });
382+ const auto double_value = [](auto && value) -> int { return value.getValue () * 2 ; };
383+
384+ #ifdef _MSC_VER
385+ for (auto && value : input_chan) {
386+ output_chan.write (double_value (value));
387+ }
388+
389+ // Does not work with std::transform:
390+ //
391+ // could be 'void std::queue<T,std::deque<T,std::allocator<int>>>::push(int &&)'
392+ // with
393+ // [
394+ // T=ChannelTest_Traits_Test::TestBody::type
395+ // ]
396+ // D:\a\cpp-channel\cpp-channel\include\msd\channel.hpp(105,20):
397+ // 'void std::queue<T,std::deque<T,std::allocator<int>>>::push(int &&)': cannot convert argument 1 from
398+ // '_OutIt' to 'int &&' with
399+ // [
400+ // T=ChannelTest_Traits_Test::TestBody::type
401+ // ]
402+ // and
403+ // [
404+ // _OutIt=msd::blocking_writer_iterator<msd::channel<ChannelTest_Traits_Test::TestBody::type>>
405+ // ]
406+ // D:\a\cpp-channel\cpp-channel\include\msd\channel.hpp(105,43):
407+ // Reason: cannot convert from '_OutIt' to 'int'
408+ // with
409+ // [
410+ // _OutIt=msd::blocking_writer_iterator<msd::channel<ChannelTest_Traits_Test::TestBody::type>>
411+ // ]
412+ #else
413+ std::transform (input_chan.begin (), input_chan.end (), msd::back_inserter (output_chan), double_value);
414+ #endif // _MSC_VER
415+
384416 output_chan.close ();
385417 };
386418
0 commit comments