Heoi, I've seen a C++ talk where someone made a lambda fizzbuzz implementation.
This is not it! Not even close to it! My question is, why can't I use the ostream&
auto fizz = [](int& x, std::ostream& os) { x % 3 == 0 ? os << "fizz" : 0; };
auto buzz = [](int& x, std::ostream& os) { x % 5 == 0 ? os << "buzz" : 0; };
for (int i = 0; i != 100; ++i)
{
fizz(i, std::cout);
buzz(i, std::cout);
}
And my Error message is :
E1776 function "std::basic_ostream<_Elem, _Traits>::basic_ostream(const std::basic_ostream<_Elem, _Traits>::_Myt &) [with _Elem=char, _Traits=std::char_traits<char>]" (declared at line 83 of "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\ostream") cannot be referenced -- it is a deleted function 56