@@ -37,8 +37,42 @@ int main()
3737 };
3838
3939 const auto transformer = [&input_chan, &output_chan]() {
40- std::transform (input_chan.begin (), input_chan.end (), msd::back_inserter (output_chan),
41- [](int value) { return value * 2 ; });
40+ const auto double_value = [](int value) { return value * 2 ; };
41+
42+ #ifdef _MSC_VER
43+ for (auto && value : input_chan) {
44+ output_chan.write (double_value (value));
45+ }
46+
47+ // Does not work with std::transform:
48+ //
49+ // could be 'void std::queue<T,std::deque<T,std::allocator<int>>>::push(int &&)'
50+ // with
51+ // [
52+ // T=ChannelTest_Traits_Test::TestBody::type
53+ // ]
54+ // D:\a\cpp-channel\cpp-channel\include\msd\channel.hpp(105,20):
55+ // 'void std::queue<T,std::deque<T,std::allocator<int>>>::push(int &&)': cannot convert argument 1 from
56+ // '_OutIt' to 'int &&' with
57+ // [
58+ // T=ChannelTest_Traits_Test::TestBody::type
59+ // ]
60+ // and
61+ // [
62+ // _OutIt=msd::blocking_writer_iterator<msd::channel<ChannelTest_Traits_Test::TestBody::type>>
63+ // ]
64+ // D:\a\cpp-channel\cpp-channel\include\msd\channel.hpp(105,43):
65+ // Reason: cannot convert from '_OutIt' to 'int'
66+ // with
67+ // [
68+ // _OutIt=msd::blocking_writer_iterator<msd::channel<ChannelTest_Traits_Test::TestBody::type>>
69+ // ]
70+ #else
71+ std::transform (input_chan.begin (), input_chan.end (), msd::back_inserter (output_chan), double_value);
72+ #endif // _MSC_VER
73+
74+ std::transform (input_chan.begin (), input_chan.end (), msd::back_inserter (output_chan), double_value);
75+
4276 output_chan.close ();
4377 };
4478
0 commit comments