@@ -359,6 +359,11 @@ class MovableOnly {
359359 int value{0 };
360360};
361361
362+ template msd::blocking_writer_iterator<msd::channel<int >>& msd::blocking_writer_iterator<msd::channel<int >>::operator =
363+ <int >(int &&);
364+
365+ template bool msd::channel<int >::write(int &&);
366+
362367TEST (ChannelTest, Transform)
363368{
364369 const int numbers = 100 ;
@@ -379,40 +384,8 @@ TEST(ChannelTest, Transform)
379384
380385 // Transform input channel values from MovableOnly to int by multiplying by 2 and write to output channel
381386 const auto double_transformer = [&input_chan, &output_chan]() {
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-
387+ std::transform (input_chan.begin (), input_chan.end (), msd::back_inserter (output_chan),
388+ [](auto && value) -> int { return value.getValue () * 2 ; });
416389 output_chan.close ();
417390 };
418391
0 commit comments