boost_no_std_oi_assign.ipp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // (C) Copyright John Maddock 2001.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/config for the most recent version.
  6. // MACRO: BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN
  7. // TITLE: That the std output iterators are assignable
  8. // DESCRIPTION: Some std lib output iterators are not assignable
  9. // even this is required by the standard.
  10. #include <iterator>
  11. #include <list>
  12. #include <iostream>
  13. namespace boost_no_std_output_iterator_assign {
  14. int test()
  15. {
  16. std::list<int> l;
  17. std::back_insert_iterator<std::list<int> > bi1(l);
  18. std::back_insert_iterator<std::list<int> > bi2(l);
  19. bi1 = bi2;
  20. std::front_insert_iterator<std::list<int> > fi1(l);
  21. std::front_insert_iterator<std::list<int> > fi2(l);
  22. fi1 = fi2;
  23. std::ostream_iterator<char> osi1(std::cout);
  24. std::ostream_iterator<char> osi2(std::cout);
  25. osi1 = osi2;
  26. return 0;
  27. }
  28. }