const_wrapper_fail.cpp 480 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2018 Andrzej Krzemieński
  2. // Copyright 2018 Peter Dimov
  3. // Distributed under the Boost Software License, Version 1.0.
  4. #include <boost/core/swap.hpp>
  5. namespace boost
  6. {
  7. template<class T> struct Wrapper
  8. {
  9. T value;
  10. };
  11. template<class T> inline void swap( Wrapper<T> & w, Wrapper<T> & v )
  12. {
  13. boost::swap( w, v );
  14. }
  15. } // namespace boost
  16. int main()
  17. {
  18. boost::Wrapper<int> const w = { 2 };
  19. boost::Wrapper<int> const v = { 3 };
  20. swap( w, v );
  21. }