fork(3) download
  1. #include <iostream>
  2. #include <iterator>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. struct magic { int a, b; };
  8. inline magic & operator ++ (magic &m) { return ++m.a, ++m.b, m; }
  9. inline double operator * (const magic &m) { return (double)m.a / m.b; }
  10. inline bool operator != (const magic &l, const magic &r) { return l.a != r.a || l.b != r.b; }
  11.  
  12. //auto t = for_each(magic {44, 11}, magic {144, 111}, [](double x) { cout << x << '\n'; });
  13.  
  14. int main() {
  15. copy(magic {44, 11}, magic {144, 111}, ostream_iterator<double>(std::cout, "\n"));
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
In file included from /usr/include/c++/5/bits/char_traits.h:39:0,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h: In instantiation of '_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = magic; _OI = std::ostream_iterator<double>]':
/usr/include/c++/5/bits/stl_algobase.h:436:45:   required from '_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = magic; _OI = std::ostream_iterator<double>]'
/usr/include/c++/5/bits/stl_algobase.h:469:8:   required from '_OI std::copy(_II, _II, _OI) [with _II = magic; _OI = std::ostream_iterator<double>]'
prog.cpp:15:82:   required from here
/usr/include/c++/5/bits/stl_algobase.h:391:57: error: no type named 'value_type' in 'struct std::iterator_traits<magic>'
       typedef typename iterator_traits<_II>::value_type _ValueTypeI;
                                                         ^
/usr/include/c++/5/bits/stl_algobase.h:393:64: error: no type named 'iterator_category' in 'struct std::iterator_traits<magic>'
       typedef typename iterator_traits<_II>::iterator_category _Category;
                                                                ^
/usr/include/c++/5/bits/stl_algobase.h:397:9: error: no type named 'value_type' in 'struct std::iterator_traits<magic>'
         && __are_same<_ValueTypeI, _ValueTypeO>::__value);
         ^
/usr/include/c++/5/bits/stl_algobase.h:400:44: error: no type named 'iterator_category' in 'struct std::iterator_traits<magic>'
                        _Category>::__copy_m(__first, __last, __result);
                                            ^
stdout
Standard output is empty