boost_no_cxx11_smart_ptr.ipp 990 B

1234567891011121314151617181920212223242526272829303132333435
  1. // (C) Copyright John Maddock 2012
  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 more information.
  6. // MACRO: BOOST_NO_CXX11_SMART_PTR
  7. // TITLE: C++11 <memory> has no shared_ptr and unique_ptr
  8. // DESCRIPTION: The compiler does not support the C++11 smart pointer features added to <memory>
  9. #include <memory>
  10. // Hash functions for shared pointers should be in <memory>
  11. // but with some std lib's we have to include <functional> as well...
  12. #include <functional>
  13. namespace boost_no_cxx11_smart_ptr {
  14. int test()
  15. {
  16. std::unique_ptr<int> upi(new int);
  17. std::shared_ptr<int> spi(new int), spi2(new int);
  18. spi = std::static_pointer_cast<int>(spi);
  19. std::hash<std::shared_ptr<int> > h1;
  20. std::hash<std::unique_ptr<int> > h2;
  21. (void)h1;
  22. (void)h2;
  23. return 0;
  24. }
  25. }